Try fix build #61
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' | ||
|
Check failure on line 1 in .github/workflows/test.yml
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| pull_request: | ||
| branches: | ||
| - main | ||
| workflow_dispatch: | ||
| jobs: | ||
| linux: | ||
| runs-on: ubuntu-24.04 | ||
| name: linux (pytest) | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - 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 python3-pytest python3-pytest-rerunfailures python3-pytest-cov lcov | ||
| pip3 install pybind11-stubgen pytest --break-system-packages | ||
| - name: Install expat | ||
| run: | | ||
| wget https://github.com/libexpat/libexpat/releases/download/R_2_4_8/expat-2.4.8.tar.bz2 | ||
| tar -xf expat-2.4.8.tar.bz2 | ||
| sudo rm expat-2.4.8.tar.bz2 | ||
| cd expat-2.4.8 | ||
| ./configure --enable-static --disable-shared | ||
| make | ||
| sudo make install | ||
| cd ../ | ||
| - name: Install unbound | ||
| run: | | ||
| wget https://www.nlnetlabs.nl/downloads/unbound/unbound-1.22.0.tar.gz | ||
| tar xzf unbound-1.22.0.tar.gz | ||
| sudo apt install -y build-essential | ||
| sudo apt install -y libssl-dev | ||
| sudo apt install -y libexpat1-dev | ||
| sudo apt-get install -y bison | ||
| sudo apt-get install -y flex | ||
| cd unbound-1.22.0 | ||
| ./configure --with-libexpat=/usr --with-ssl=/usr --enable-static-exe | ||
| make | ||
| sudo make install | ||
| cd ../ | ||
| # TODO re-enable this after https://github.com/woodser/monero-cpp/pull/95 and remove custom regtest build | ||
| # - name: Update submodules | ||
| # run: | | ||
| # git submodule update --init --recursive | ||
| # TODO remove regtest build | ||
| - name: Clone monero-cpp (regtest) | ||
| run: | | ||
| cd external | ||
| rm -rf monero-cpp | ||
| git clone -b regtest-env --single-branch --recurse-submodules https://github.com/everoddandeven/monero-cpp.git | ||
| cd .. | ||
| - name: Build monero | ||
| run: | | ||
| cd external/monero-cpp/external/monero-project | ||
| mkdir -p build/release | ||
| cd build/release | ||
| cmake -DSTATIC=ON -DBUILD_64=ON -DCMAKE_BUILD_TYPE=Release ../../ | ||
| make -j3 wallet cryptonote_protocol | ||
| cd ../../../../../../ | ||
| - name: Install monero-cpp | ||
| run: | | ||
| cd external/monero-cpp | ||
| mkdir -p build | ||
| cd build | ||
| cmake .. | ||
| cmake --build . | ||
| make -j3 | ||
| sudo cp libmonero-cpp.so /usr/lib/ | ||
| cd ../../../ | ||
| - name: Install monero-python | ||
| run: | | ||
| mkdir -p build | ||
| export CFLAGS="--coverage -O0 -g" | ||
| export CXXFLAGS="--coverage -O0 -g" | ||
| export LDFLAGS="--coverage" | ||
| COVERAGE=1 pip3 install -vvv . | ||
| - name: Setup test environment | ||
| run: | | ||
| docker compose -f tests/docker-compose.yml up -d node_1 node_2 xmr_wallet_1 xmr_wallet_2 | ||
| - name: Reset coverage counters | ||
| run: | | ||
| lcov --directory . --zerocounters | ||
| - name: Run tests | ||
| env: | ||
| IN_CONTAINER: "true" | ||
| run: | | ||
| pytest --cov=tests --cov-report=xml | ||
| - name: Cleanup test environment | ||
| if: always() | ||
| run: docker compose -f tests/docker-compose.yml down -v | ||
| - name: Generate coverage report | ||
| run: | | ||
| lcov --capture --directory . --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 | ||
| - name: Upload coverage report | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: coverage-reports-linux | ||
| path: | | ||
| coverage.info | ||
| coverage.xml | ||
| windows: | ||
| name: windows (pytest) | ||
| runs-on: windows-latest | ||
| 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 | ||
| run: | | ||
| python -m pip install pytest pytest-rerunfailures pytest-cov | ||
| - name: Install | ||
| - name: Setup MSYS2 MINGW64 | ||
| uses: msys2/setup-msys2@v2 | ||
| with: | ||
| msystem: MINGW64 | ||
| update: true | ||
| install: >- | ||
| mingw-w64-x86_64-toolchain | ||
| mingw-w64-x86_64-cmake | ||
| mingw-w64-x86_64-openssl | ||
| mingw-w64-x86_64-zeromq | ||
| mingw-w64-x86_64-libsodium | ||
| mingw-w64-x86_64-hidapi | ||
| mingw-w64-x86_64-unbound | ||
| mingw-w64-x86_64-protobuf | ||
| mingw-w64-x86_64-libusb | ||
| mingw-w64-x86_64-ntldd | ||
| mingw-w64-x86_64-gcovr | ||
| git | ||
| make | ||
| gettext | ||
| base-devel | ||
| wget | ||
| - name: Install ICU v75.1.1 | ||
| shell: msys2 {0} | ||
| run: | | ||
| wget https://repo.msys2.org/mingw/mingw64/mingw-w64-x86_64-icu-75.1-1-any.pkg.tar.zst | ||
| pacman -U --noconfirm mingw-w64-x86_64-icu-75.1-1-any.pkg.tar.zst | ||
| - name: Install boost v1.85.0 | ||
| shell: msys2 {0} | ||
| run: | | ||
| wget https://repo.msys2.org/mingw/mingw64/mingw-w64-x86_64-boost-1.85.0-4-any.pkg.tar.zst | ||
| pacman -U --noconfirm mingw-w64-x86_64-boost-1.85.0-4-any.pkg.tar.zst | ||
| - name: Install pybind11 v2.11.1 | ||
| shell: msys2 {0} | ||
| run: | | ||
| wget https://repo.msys2.org/mingw/mingw64/mingw-w64-x86_64-pybind11-2.11.1-1-any.pkg.tar.zst | ||
| pacman -U --noconfirm mingw-w64-x86_64-pybind11-2.11.1-1-any.pkg.tar.zst | ||
| # TODO remove regtest build | ||
| - name: Clone monero-cpp (regtest) | ||
| shell: msys2 {0} | ||
| run: | | ||
| cd external | ||
| rm -rf monero-cpp | ||
| git clone -b regtest-env --single-branch --recurse-submodules https://github.com/everoddandeven/monero-cpp.git | ||
| cd .. | ||
| - name: Build monero | ||
| shell: msys2 {0} | ||
| 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 wallet cryptonote_protocol | ||
| - name: Build monero-cpp | ||
| shell: msys2 {0} | ||
| run: | | ||
| cd external/monero-cpp | ||
| mkdir -p build | ||
| cd build | ||
| cmake .. | ||
| cmake --build . | ||
| - name: Build monero-python | ||
| shell: msys2 {0} | ||
| run: | | ||
| mkdir -p build | ||
| cd build | ||
| export WIN_PYTHON_EXE=$(cygpath -u "$PYTHON") | ||
| cmake .. -DPython3_EXECUTABLE="$WIN_PYTHON_EXE" \ | ||
| -DPython3_FIND_STRATEGY=LOCATION \ | ||
| -DPython3_FIND_REGISTRY=NEVER | ||
| cmake --build . | ||
| mkdir -p ../dist | ||
| cp *.pyd ../dist/monero.pyd | ||
| ntldd -R *.pyd | grep mingw64 | awk '{print $3}' | while read -r line; do | ||
| cp "$(cygpath -u "$line")" ../dist/ | ||
| done | ||
| - name: Setup test environment | ||
| shell: bash | ||
| run: | | ||
| docker compose -f tests/docker-compose.yml up -d node_1 node_2 xmr_wallet_1 xmr_wallet_2 | ||
| - name: Run Pytest | ||
| shell: bash | ||
| env: | ||
| IN_CONTAINER: "true" | ||
| PYTHONPATH: ${{ github.workspace }}/dist | ||
| PATH: "${{ github.workspace }}/dist:/usr/bin:$PATH" | ||
| run: | | ||
| python -m pytest --cov=tests --cov-report=xml | ||
| - name: Cleanup test environment | ||
| if: always() | ||
| shell: bash | ||
| run: docker compose -f tests/docker-compose.yml down -v | ||
| - name: Generate coverage report | ||
| shell: msys2 {0} | ||
| run: | | ||
| gcovr -r . --filter src/ --lcov coverage.info | ||
| - name: Upload coverage report | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: coverage-reports-windows | ||
| path: | | ||
| coverage.info | ||
| coverage.xml | ||