Repository navigation
ci: build version from pyproject #427
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: 'Tests' | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| # Only on pull requests: the release needs a successful run for every commit on main. | |
| # If Tests ever becomes a required check, a skipped run stays Pending and blocks the merge. | |
| paths-ignore: | |
| - 'README.md' | |
| - 'LICENSE' | |
| - '.gitignore' | |
| - 'donate.png' | |
| - 'docs/**' | |
| # other workflows, not run by this one (build-*.yml have their own pull_request trigger) | |
| - '.github/workflows/build-*.yml' | |
| - '.github/workflows/codacy.yml' | |
| - '.github/workflows/release.yml' | |
| workflow_dispatch: | |
| # A new push to a pull request cancels the previous run. Runs that are not | |
| # from a pull request 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 | |
| jobs: | |
| linux: | |
| runs-on: ubuntu-24.04 | |
| name: linux (pytest) | |
| timeout-minutes: 120 | |
| env: | |
| CCACHE_DIR: ${{ github.workspace }}/.ccache | |
| CCACHE_MAXSIZE: 500M | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Install dependencies | |
| run: | | |
| sudo apt update | |
| sudo apt install -y build-essential cmake pkg-config libssl-dev libzmq3-dev libunbound-dev libsodium-dev libunwind8-dev liblzma-dev libreadline6-dev libexpat1-dev libpgm-dev qttools5-dev-tools libhidapi-dev libusb-1.0-0-dev libprotobuf-dev protobuf-compiler libudev-dev libboost-chrono-dev libboost-date-time-dev libboost-filesystem-dev libboost-locale-dev libboost-program-options-dev libboost-regex-dev libboost-serialization-dev libboost-system-dev libboost-thread-dev python3 ccache doxygen graphviz git curl autoconf libtool gperf nettle-dev libevent-dev debhelper python3-all python3-pip python3-pybind11 lcov python3-scikit-build-core | |
| pip3 install pybind11-stubgen pytest pytest-rerunfailures pytest-cov pytest-timeout pyproject-metadata --break-system-packages | |
| - name: Install expat | |
| run: | | |
| wget https://github.com/libexpat/libexpat/releases/download/R_2_7_1/expat-2.7.1.tar.bz2 | |
| echo "45c98ae1e9b5127325d25186cf8c511fa814078e9efeae7987a574b482b79b3d expat-2.7.1.tar.bz2" | sha256sum -c | |
| tar -xf expat-2.7.1.tar.bz2 | |
| cd expat-2.7.1 | |
| ./configure --enable-static --disable-shared --with-pic | |
| make | |
| sudo make install | |
| cd ../ | |
| - name: Install unbound | |
| run: | | |
| wget https://www.nlnetlabs.nl/downloads/unbound/unbound-1.22.0.tar.gz | |
| echo "c5dd1bdef5d5685b2cedb749158dd152c52d44f65529a34ac15cd88d4b1b3d43 unbound-1.22.0.tar.gz" | sha256sum -c | |
| tar xzf unbound-1.22.0.tar.gz | |
| cd unbound-1.22.0 | |
| ./configure --with-libexpat=/usr/local --with-ssl=/usr --enable-static --disable-shared --with-pic | |
| # monero only needs libunbound, skip the daemon and the tools | |
| make -j"$(nproc)" lib | |
| sudo make install-lib | |
| cd ../ | |
| - name: Restore ccache | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: .ccache | |
| key: ccache-linux-test_${{ github.sha }} | |
| restore-keys: | | |
| ccache-linux-test_ | |
| - 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 | |
| cmake -DSTATIC=ON -DARCH=x86-64 -DBUILD_64=ON -DCMAKE_BUILD_TYPE=Release ../../ | |
| make -j3 wallet cryptonote_protocol | |
| cd ../../../../../../ | |
| - name: Build monero-cpp | |
| run: | | |
| cd external/monero-cpp | |
| mkdir -p build | |
| cd build | |
| cmake .. -DENABLE_COVERAGE=ON -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache | |
| cmake --build . | |
| make -j3 | |
| cd ../../../ | |
| - name: Install monero-python | |
| run: | | |
| mkdir -p build | |
| cmake -B build -DENABLE_COVERAGE=ON | |
| cmake --build build | |
| cp build/monero.cpython-312-x86_64-linux-gnu.so ~/.local/lib/python3.12/site-packages/ | |
| - 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 populate it. | |
| if: ${{ !cancelled() && github.event_name != 'pull_request' }} | |
| uses: actions/cache/save@v4 | |
| with: | |
| path: .ccache | |
| key: ccache-linux-test_${{ github.sha }} | |
| - name: Setup test environment | |
| run: | | |
| docker compose -f tests/docker-compose.yml up -d node_1 node_2 xmr_wallet_1 xmr_wallet_2 xmr_wallet_3 | |
| sleep 10 | |
| - name: Reset coverage counters | |
| run: | | |
| lcov --directory . --zerocounters | |
| - name: Run unit & integration tests | |
| env: | |
| IN_CONTAINER: "true" | |
| run: | | |
| pytest --cov=tests --cov-report=xml | |
| - name: Dump container logs | |
| if: always() | |
| run: | | |
| mkdir -p container-logs | |
| for svc in node_1 node_2 xmr_wallet_1 xmr_wallet_2 xmr_wallet_3; do | |
| docker compose -f tests/docker-compose.yml logs --no-color --timestamps "$svc" > "container-logs/$svc.log" 2>&1 || true | |
| done | |
| - name: Upload container logs | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: container-logs-linux | |
| path: container-logs/ | |
| - name: Cleanup test environment | |
| if: always() | |
| run: docker compose -f tests/docker-compose.yml down -v | |
| - name: Upload tests logs | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-logs | |
| path: monero_tests_*.log | |
| - name: Generate python bindings coverage report | |
| if: always() | |
| run: | | |
| lcov --capture --directory build --ignore-errors mismatch,mismatch,inconsistent,source,source,gcov,gcov --output-file coverage_full.info | |
| lcov --ignore-errors unused,unused --remove coverage_full.info '/usr/*' '*/external/*' '*/pybind11/*' '*monero-cpp/*' '*monero-project/*' --output-file coverage.info | |
| sed -i "s|$(pwd)/||g" coverage.info | |
| genhtml coverage.info --output-directory coverage_monero_python_bindings_html --ignore-errors mismatch,inconsistent,source,corrupt --title "monero-python bindings coverage @ ${GITHUB_SHA::7}" | |
| lcov --summary coverage.info | |
| - name: Generate python tests coverage report | |
| if: always() | |
| run: | | |
| coverage html -d coverage_monero_python_tests_html --title "monero-python tests coverage @ ${GITHUB_SHA::7}" | |
| - name: Generate monero-cpp coverage report | |
| if: always() | |
| run: | | |
| lcov --capture --directory external/monero-cpp/build --directory build --ignore-errors mismatch,mismatch,inconsistent,source,source,gcov,gcov --output-file coverage_monero_cpp_full.info | |
| lcov --ignore-errors unused,unused --extract coverage_monero_cpp_full.info '*/monero-cpp/src/*' --output-file coverage_monero_cpp.info | |
| sed -i "s|$(pwd)/||g" coverage_monero_cpp.info | |
| genhtml coverage_monero_cpp.info --output-directory coverage_monero_cpp_html --ignore-errors mismatch,inconsistent,source,corrupt --title "monero-cpp coverage @ ${GITHUB_SHA::7}" | |
| lcov --summary coverage_monero_cpp.info | |
| - name: Upload coverage report | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-reports-linux | |
| path: | | |
| coverage.info | |
| coverage.xml | |
| coverage_monero_cpp.info | |
| coverage_monero_cpp_html/ | |
| coverage_monero_python_bindings_html/ | |
| coverage_monero_python_tests_html/ | |
| windows: | |
| name: windows (pytest) | |
| runs-on: windows-latest | |
| env: | |
| CCACHE_DIR: ${{ github.workspace }}/.ccache | |
| CCACHE_MAXSIZE: 500M | |
| defaults: | |
| run: | |
| shell: msys2 {0} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Setup Python 3.13 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.13' | |
| architecture: 'x64' | |
| - name: Install pytest and dependencies | |
| shell: bash | |
| run: | | |
| python -m pip install pytest pytest-rerunfailures pytest-timeout pytest-cov typing_extensions scikit-build-core | |
| - name: Setup MSYS2 MINGW64 | |
| uses: msys2/setup-msys2@66cd2cce69caa17b53920067426061ca1de3a884 # v2.32.0 | |
| with: | |
| msystem: MINGW64 | |
| update: true | |
| install: >- | |
| mingw-w64-x86_64-cmake | |
| mingw-w64-x86_64-openssl | |
| mingw-w64-x86_64-zeromq | |
| mingw-w64-x86_64-libsodium | |
| mingw-w64-x86_64-unbound | |
| mingw-w64-x86_64-protobuf | |
| mingw-w64-x86_64-ntldd | |
| mingw-w64-x86_64-ccache | |
| git | |
| make | |
| gettext | |
| base-devel | |
| wget | |
| - name: Install pinned MinGW64 toolchain v16.2.0 | |
| run: | | |
| wget https://repo.msys2.org/mingw/mingw64/mingw-w64-x86_64-headers-14.0.0.r375.g9c1abbbf5-1-any.pkg.tar.zst | |
| echo "acad5748942953f91a0f2bba03e20437b909366e55949f478f1b2f2d30c726a7 mingw-w64-x86_64-headers-14.0.0.r375.g9c1abbbf5-1-any.pkg.tar.zst" | sha256sum -c | |
| wget https://repo.msys2.org/mingw/mingw64/mingw-w64-x86_64-crt-14.0.0.r375.g9c1abbbf5-1-any.pkg.tar.zst | |
| echo "d24b4e7614756414ae3ef58793265448a3ca7d5fd447a991e9b2facde7b59d75 mingw-w64-x86_64-crt-14.0.0.r375.g9c1abbbf5-1-any.pkg.tar.zst" | sha256sum -c | |
| wget https://repo.msys2.org/mingw/mingw64/mingw-w64-x86_64-binutils-2.47-3-any.pkg.tar.zst | |
| echo "827363748ce3320683319d860ee4fcfcdbb36baf66aac6dab0ec3822be2d4ff7 mingw-w64-x86_64-binutils-2.47-3-any.pkg.tar.zst" | sha256sum -c | |
| wget https://repo.msys2.org/mingw/mingw64/mingw-w64-x86_64-libmangle-14.0.0.r375.g9c1abbbf5-1-any.pkg.tar.zst | |
| echo "481babe8c2fdfa4fc7f51bf13939701719af9f8166ef6a91a9a209cc25961b03 mingw-w64-x86_64-libmangle-14.0.0.r375.g9c1abbbf5-1-any.pkg.tar.zst" | sha256sum -c | |
| wget https://repo.msys2.org/mingw/mingw64/mingw-w64-x86_64-winpthreads-14.0.0.r375.g9c1abbbf5-1-any.pkg.tar.zst | |
| echo "7d86a267b6069198d28f3e77314282ff7b4e3c7bb8fe482299ca58f7a5b439db mingw-w64-x86_64-winpthreads-14.0.0.r375.g9c1abbbf5-1-any.pkg.tar.zst" | sha256sum -c | |
| wget https://repo.msys2.org/mingw/mingw64/mingw-w64-x86_64-libwinpthread-14.0.0.r375.g9c1abbbf5-1-any.pkg.tar.zst | |
| echo "1d0ed7fda332a5c879de210f3d72c75fa1f3df7cc63dd951e763dec8eb02c1ee mingw-w64-x86_64-libwinpthread-14.0.0.r375.g9c1abbbf5-1-any.pkg.tar.zst" | sha256sum -c | |
| wget https://repo.msys2.org/mingw/mingw64/mingw-w64-x86_64-winstorecompat-14.0.0.r375.g9c1abbbf5-1-any.pkg.tar.zst | |
| echo "7fcafd7ba30bd47000263e76a06bd893406c64f88955825f0a9188407a35c3d3 mingw-w64-x86_64-winstorecompat-14.0.0.r375.g9c1abbbf5-1-any.pkg.tar.zst" | sha256sum -c | |
| wget https://repo.msys2.org/mingw/mingw64/mingw-w64-x86_64-tools-14.0.0.r375.g9c1abbbf5-1-any.pkg.tar.zst | |
| echo "c17557d09371e39db38deb56c7da6ae54e2c65b6f3466ca02f4da26b616ca8c3 mingw-w64-x86_64-tools-14.0.0.r375.g9c1abbbf5-1-any.pkg.tar.zst" | sha256sum -c | |
| wget https://repo.msys2.org/mingw/mingw64/mingw-w64-x86_64-pkgconf-1~3.0.7-1-any.pkg.tar.zst | |
| echo "37b97f372409fa7cf54d709bab892f34e9c62d2658230a09f783a89a55ae590e mingw-w64-x86_64-pkgconf-1~3.0.7-1-any.pkg.tar.zst" | sha256sum -c | |
| wget https://repo.msys2.org/mingw/mingw64/mingw-w64-x86_64-make-4.4.1-5-any.pkg.tar.zst | |
| echo "c19e7caf09bbc89b2730556b2da73004118d4e1f967a685cc48524c7ff80d864 mingw-w64-x86_64-make-4.4.1-5-any.pkg.tar.zst" | sha256sum -c | |
| wget https://repo.msys2.org/mingw/mingw64/mingw-w64-x86_64-gcc-libs-16.2.0-3-any.pkg.tar.zst | |
| echo "f8e25ea67bb796e7f65550f0dca9fce4cdde8aaa3dadafe4d13c6a8233c8de26 mingw-w64-x86_64-gcc-libs-16.2.0-3-any.pkg.tar.zst" | sha256sum -c | |
| wget https://repo.msys2.org/mingw/mingw64/mingw-w64-x86_64-gcc-16.2.0-3-any.pkg.tar.zst | |
| echo "8b37c953ae12f3d8fa05c854236463231ea0a294dff423007cbd93d4d8089f9f mingw-w64-x86_64-gcc-16.2.0-3-any.pkg.tar.zst" | sha256sum -c | |
| # gcc-libs is split into libgcc, libstdc++ and cc-libs since 16.2.0-4 and the | |
| # new packages conflict with the pinned gcc-libs, so drop them before the downgrade | |
| for p in libgcc libstdc++ cc-libs; do | |
| if pacman -Q mingw-w64-x86_64-$p > /dev/null 2>&1; then | |
| pacman -Rdd --noconfirm mingw-w64-x86_64-$p | |
| fi | |
| done | |
| pacman -U --noconfirm \ | |
| mingw-w64-x86_64-headers-14.0.0.r375.g9c1abbbf5-1-any.pkg.tar.zst \ | |
| mingw-w64-x86_64-crt-14.0.0.r375.g9c1abbbf5-1-any.pkg.tar.zst \ | |
| mingw-w64-x86_64-binutils-2.47-3-any.pkg.tar.zst \ | |
| mingw-w64-x86_64-libmangle-14.0.0.r375.g9c1abbbf5-1-any.pkg.tar.zst \ | |
| mingw-w64-x86_64-winpthreads-14.0.0.r375.g9c1abbbf5-1-any.pkg.tar.zst \ | |
| mingw-w64-x86_64-libwinpthread-14.0.0.r375.g9c1abbbf5-1-any.pkg.tar.zst \ | |
| mingw-w64-x86_64-winstorecompat-14.0.0.r375.g9c1abbbf5-1-any.pkg.tar.zst \ | |
| mingw-w64-x86_64-tools-14.0.0.r375.g9c1abbbf5-1-any.pkg.tar.zst \ | |
| mingw-w64-x86_64-pkgconf-1~3.0.7-1-any.pkg.tar.zst \ | |
| mingw-w64-x86_64-make-4.4.1-5-any.pkg.tar.zst \ | |
| mingw-w64-x86_64-gcc-libs-16.2.0-3-any.pkg.tar.zst \ | |
| mingw-w64-x86_64-gcc-16.2.0-3-any.pkg.tar.zst | |
| - name: Install ICU v78.3 | |
| run: | | |
| wget https://repo.msys2.org/mingw/mingw64/mingw-w64-x86_64-icu-78.3-4-any.pkg.tar.zst | |
| echo "8486a018aca2e56d1fcd2eed2069011f2e1da02e03af72b38916ee06cbe7203f mingw-w64-x86_64-icu-78.3-4-any.pkg.tar.zst" | sha256sum -c | |
| pacman -U --noconfirm mingw-w64-x86_64-icu-78.3-4-any.pkg.tar.zst | |
| - name: Install hidapi v0.15.0 and libusb v1.0.30 | |
| run: | | |
| # dropped from the msys2 mingw64 repo, install the archived packages | |
| wget https://repo.msys2.org/mingw/mingw64/mingw-w64-x86_64-hidapi-0.15.0-2-any.pkg.tar.zst | |
| echo "89fb61549a437d65076a092a367fcb264fc7045ee9ebef48cd81f5a76a5588f8 mingw-w64-x86_64-hidapi-0.15.0-2-any.pkg.tar.zst" | sha256sum -c | |
| wget https://repo.msys2.org/mingw/mingw64/mingw-w64-x86_64-libusb-1.0.30-1-any.pkg.tar.zst | |
| echo "124edc26b009678a4c5e759481a364abf63ed7f2f49a53092e8bd0a47c0c0740 mingw-w64-x86_64-libusb-1.0.30-1-any.pkg.tar.zst" | sha256sum -c | |
| pacman -U --noconfirm mingw-w64-x86_64-hidapi-0.15.0-2-any.pkg.tar.zst mingw-w64-x86_64-libusb-1.0.30-1-any.pkg.tar.zst | |
| - name: Install boost v1.92.0 | |
| run: | | |
| wget https://repo.msys2.org/mingw/mingw64/mingw-w64-x86_64-boost-1.92.0-3-any.pkg.tar.zst | |
| echo "8d5a7621778e955a52755940fe16ead78c0e57a2ff443418b43c25388df1ba2a mingw-w64-x86_64-boost-1.92.0-3-any.pkg.tar.zst" | sha256sum -c | |
| wget https://repo.msys2.org/mingw/mingw64/mingw-w64-x86_64-boost-libs-1.92.0-3-any.pkg.tar.zst | |
| echo "832ee9a748c387fc70e0fb90f3bd6d513db627d3c283512123aeb904f4b2dc5a mingw-w64-x86_64-boost-libs-1.92.0-3-any.pkg.tar.zst" | sha256sum -c | |
| # boost-libs in the repo is a newer rebuild that needs the split gcc runtime | |
| pacman -U --noconfirm mingw-w64-x86_64-boost-1.92.0-3-any.pkg.tar.zst mingw-w64-x86_64-boost-libs-1.92.0-3-any.pkg.tar.zst | |
| - name: Install pybind11 v2.13.6 | |
| run: | | |
| wget https://repo.msys2.org/mingw/mingw64/mingw-w64-x86_64-pybind11-2.13.6-2-any.pkg.tar.zst | |
| echo "5b56ad87bc544336b2d51edb8bb0614f46542571362daf4d7e53bf23120175a1 mingw-w64-x86_64-pybind11-2.13.6-2-any.pkg.tar.zst" | sha256sum -c | |
| pacman -U --noconfirm mingw-w64-x86_64-pybind11-2.13.6-2-any.pkg.tar.zst | |
| - name: Restore ccache | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: .ccache | |
| key: ccache-windows_${{ github.sha }} | |
| restore-keys: | | |
| ccache-windows_ | |
| - 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 | |
| cmake -G "MSYS Makefiles" \ | |
| -D STATIC=ON \ | |
| -D ARCH="x86-64" \ | |
| -D BUILD_64=ON \ | |
| -D CMAKE_BUILD_TYPE=Release \ | |
| -D BUILD_TAG="win-x64" \ | |
| -D CMAKE_TOOLCHAIN_FILE="../../cmake/64-bit-toolchain.cmake" \ | |
| -D MSYS2_FOLDER=$(cd $MINGW_PREFIX/.. && pwd -W) \ | |
| ../../ | |
| make -j$(nproc) wallet cryptonote_protocol | |
| - name: Build monero-cpp | |
| run: | | |
| cd external/monero-cpp | |
| mkdir -p build | |
| cd build | |
| cmake .. -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache | |
| cmake --build . --parallel $(nproc) | |
| - name: Build monero-python | |
| run: | | |
| mkdir -p build | |
| cd build | |
| export WIN_PYTHON_EXE=$(cygpath -u "$pythonLocation/python.exe") | |
| cmake .. -DPython3_EXECUTABLE="$WIN_PYTHON_EXE" \ | |
| -DPython3_FIND_STRATEGY=LOCATION \ | |
| -DPython3_FIND_REGISTRY=NEVER | |
| cmake --build . --parallel $(nproc) | |
| mkdir -p ../dist | |
| cp *.pyd ../dist/monero.pyd | |
| cd ../dist | |
| ntldd -R *.pyd | grep mingw64 | awk '{print $3}' | while read -r line; do | |
| cp "$(cygpath -u "$line")" . | |
| done | |
| cd .. | |
| - 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 populate it. | |
| if: ${{ !cancelled() && github.event_name != 'pull_request' }} | |
| uses: actions/cache/save@v4 | |
| with: | |
| path: .ccache | |
| key: ccache-windows_${{ github.sha }} | |
| - name: Run unit tests | |
| shell: bash | |
| env: | |
| IN_CONTAINER: "true" | |
| PYTHONPATH: ${{ github.workspace }}/dist | |
| PATH: "${{ github.workspace }}/dist:/usr/bin:$PATH" | |
| run: | | |
| python -m pytest -m unit | |
| macos: | |
| name: ${{ matrix.os }} (pytest) | |
| runs-on: ${{ matrix.os }} | |
| env: | |
| CCACHE_DIR: ${{ github.workspace }}/.ccache | |
| CCACHE_MAXSIZE: 500M | |
| CCACHE_COMPILERCHECK: "%compiler% -v" | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [macos-14, macos-15, macos-15-intel] | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| 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 unbound 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-rerunfailures pytest-timeout pytest-cov setuptools wheel scikit-build-core --break-system-packages | |
| - name: Install pybind11 v2.13.6 | |
| run: | | |
| pip3 install pybind11==2.13.6 pybind11-stubgen --break-system-packages | |
| - name: Restore ccache | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: .ccache | |
| key: ccache-${{ matrix.os }}_${{ github.sha }} | |
| 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: Install monero-python | |
| run: | | |
| mkdir -p build | |
| pip3 install --no-build-isolation -vvv . --break-system-packages | |
| - 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 populate it. | |
| if: ${{ !cancelled() && github.event_name != 'pull_request' }} | |
| uses: actions/cache/save@v4 | |
| with: | |
| path: .ccache | |
| key: ccache-${{ matrix.os }}_${{ github.sha }} | |
| - name: Run unit tests | |
| run: | | |
| pytest -m unit |