Skip to content

tests: add zmq listening #76

tests: add zmq listening

tests: add zmq listening #76

Workflow file for this run

name: Build MacOS
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
paths:
- '.github/workflows/build-macos.yml'
- 'CMakeLists.txt'
- 'bin/check_macho_hardening.sh'
- 'bin/install_unbound_macos.sh'
workflow_dispatch:
workflow_call:
# A new push to a pull request cancels the previous run. Other events get their own
# group so they are never cancelled or replaced.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
permissions:
contents: read
actions: write # replace the ccache entries
jobs:
build:
name: ${{ matrix.os }}
runs-on: ${{ matrix.os }}
timeout-minutes: 120
env:
CCACHE_DIR: ${{ github.workspace }}/.ccache
CCACHE_MAXSIZE: 500M
CCACHE_COMPILERCHECK: "%compiler% -v"
strategy:
fail-fast: false
matrix:
os: [macos-15, macos-15-intel]
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
submodules: recursive
- name: Install dependencies
run: |
HOMEBREW_NO_AUTO_UPDATE=1 brew install python boost@1.85 hidapi openssl@3 zmq libpgm miniupnpc expat libunwind-headers protobuf ccache
brew unlink boost || true
brew link boost@1.85 --force
# brew links openssl@4 into /opt/homebrew, and the -I/opt/homebrew/include of boost and zeromq comes
# before the one of openssl@3, so its headers win over the ones of OPENSSL_ROOT_DIR
brew unlink openssl@4 || true
# brew's openssl is OpenSSL 4 on the newer runner images, which boost 1.85 does not build with.
# monero-project and monero-cpp take brew's openssl unless they are given another one, so
# they get it on the command line, and the module finds it in the environment
echo "OPENSSL_ROOT_DIR=$(brew --prefix openssl@3)" >> "$GITHUB_ENV"
pip3 install pytest pytest-cov setuptools wheel scikit-build-core --break-system-packages
# static, against openssl@3: the unbound of brew is built with OpenSSL 4
- name: Install unbound
run: bin/install_unbound_macos.sh
- name: Install pybind11 v2.13.6
run: |
pip3 install pybind11==2.13.6 pybind11-stubgen --break-system-packages
- name: Install delocate
run: |
pip3 install delocate --break-system-packages
- name: Restore ccache
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: .ccache
key: ccache-${{ matrix.os }}
restore-keys: |
ccache-${{ matrix.os }}_
- name: Reset ccache statistics
run: ccache --zero-stats
- name: Build monero
run: |
cd external/monero-cpp/external/monero-project
mkdir -p build/release
cd build/release
# monero builds with -march=native unless it is told which cpu to build for, and objects compiled
# on a runner with newer instructions, restored by ccache or shipped in a package, end in an illegal
# instruction on another cpu
ARCH=$([ "$(uname -m)" = x86_64 ] && echo x86-64 || echo armv8-a)
cmake -DSTATIC=ON -DARCH="$ARCH" -DBUILD_64=ON -DCMAKE_BUILD_TYPE=Release -DOPENSSL_ROOT_DIR="$OPENSSL_ROOT_DIR" ../../
make -j3 wallet cryptonote_protocol
cd ../../../../../../
- name: Build monero-cpp
run: |
cd external/monero-cpp
mkdir -p build
cd build
cmake .. -DOPENSSL_ROOT_DIR="$OPENSSL_ROOT_DIR" -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
cmake --build .
make -j3
cd ../../../
- name: Build monero-python
run: |
mkdir -p build
python3 -m pip wheel . -w dist --no-build-isolation
- name: Show ccache statistics
if: ${{ !cancelled() }}
run: ccache --show-stats
- name: Save ccache
# Pull requests only read the cache, pushes to main and manual runs replace it.
if: ${{ !cancelled() && github.event_name != 'pull_request' }}
uses: ./.github/actions/save-ccache
with:
key: ccache-${{ matrix.os }}
- name: Repair wheel with delocate
run: |
delocate-wheel -w wheelhouse -v dist/*.whl
# the canary and the exports of the module in the wheel that is published
- name: Check hardening and exports
run: |
python3 -m zipfile -e wheelhouse/*.whl wheel-check
bin/check_macho_hardening.sh wheel-check/monero*.so
- name: Upload artifacts
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: monero-${{ matrix.os }}
path: wheelhouse/*.whl