Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build-deb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ jobs:
with:
key: ccache-deb-${{ matrix.name }}-${{ matrix.arch }}

- name: Upload deb package
- name: Upload monero-python package
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: python3-monero_${{ steps.version.outputs.version }}-1${{ matrix.name }}1_${{ matrix.arch }}
Expand All @@ -113,7 +113,7 @@ jobs:
# the segments and the exports of the module in the package, and the stack protector and the branch protection in its code. The
# module of the armhf package is read but not disassembled, the objdump of the arm64 runner does not read 32 bit arm.
# After the upload, so that a package that fails can be downloaded and looked at. The release needs this job to succeed
- name: Check hardening and exports
- name: Verify libraries
run: |
dpkg-deb -x debian/artifacts/python3-monero_*.deb deb-check
bin/check_elf_hardening.sh deb-check/usr/lib/python3/dist-packages/monero*.so
130 changes: 130 additions & 0 deletions .github/workflows/build-linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
name: Build Linux Module

# Called by build.yml. It builds monero-project, monero-cpp and the module, the last two with the coverage on, and uploads the module
# with the files that the coverage needs. The tests of build.yml run on it, in several jobs. The packages of Linux are the deb ones,
# which build-deb.yml makes.
on:
workflow_call:

permissions:
contents: read
actions: write # replace the ccache entries

jobs:
ubuntu:
name: linux-x86_64
runs-on: ubuntu-24.04
timeout-minutes: 120
env:
CCACHE_DIR: ${{ github.workspace }}/.ccache
CCACHE_MAXSIZE: 500M

steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
submodules: recursive

- name: Install dependencies
run: |
bin/install_dependencies_linux.sh
pip3 install -r requirements-build.txt --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@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: .ccache
key: ccache-linux-test
restore-keys: |
ccache-linux-test_

- name: Reset ccache statistics
run: ccache --zero-stats

- name: Build monero-project
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 libraries
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: Build monero-python module
run: |
mkdir -p build
cmake -B build -DENABLE_COVERAGE=ON -Dpybind11_DIR="$(python3 -m pybind11 --cmakedir)"
cmake --build build

# stubgen, pinned because a new version can report more, reads the signatures that pybind11 writes in
# the docstrings and fails on what is wrong with the bindings: a C++ type that leaked into one, a default
# that is only a repr, a parameter with no name. The bindings are the same on every platform.
- name: Lint the bindings with pybind11-stubgen
env:
PYTHONPATH: ${{ github.workspace }}/build
run: python3 bin/lint_bindings.py

- 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-linux-test

# The module, and the .gcno that lcov reads together with the .gcda that the tests write: the ones of monero-cpp and of the module
# are the only ones, monero-project is not built with the coverage. The tests of build.yml extract it at the root of the
# workspace, where the paths of the .gcda are the ones that the build had.
- name: Package the build for the tests
run: |
find build external/monero-cpp/build \( -name 'monero*.so' -o -name '*.gcno' \) -print0 | tar --null -czf linux-build.tar.gz -T -
ls -l linux-build.tar.gz

- name: Upload monero-python build
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: monero-python-linux-x86_64
path: linux-build.tar.gz
# already compressed
compression-level: 0
retention-days: 7
41 changes: 15 additions & 26 deletions .github/workflows/build-macos.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,17 @@
name: Build MacOS

# Called by build.yml, which has the triggers and the concurrency group: a group here would be the one of the caller, and the
# jobs of the same run would cancel each other.
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'
- 'requirements-build.txt'
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 }}
mac-os:
name: ${{ matrix.arch }}
runs-on: ${{ matrix.os }}
timeout-minutes: 120
env:
Expand All @@ -37,7 +22,11 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [macos-15, macos-15-intel]
include:
- os: macos-15
arch: mac-arm64
- os: macos-15-intel
arch: mac-x86_64

steps:
- name: Checkout repository
Expand Down Expand Up @@ -65,7 +54,7 @@ jobs:
"$RUNNER_TEMP/venv/bin/pip" install -r requirements-build.txt

# static, against openssl@3: the unbound of brew is built with OpenSSL 4
- name: Install unbound
- name: Install unbound (static)
run: bin/install_unbound_macos.sh

- name: Restore ccache
Expand All @@ -79,7 +68,7 @@ jobs:
- name: Reset ccache statistics
run: ccache --zero-stats

- name: Build monero
- name: Build monero-project
run: |
cd external/monero-cpp/external/monero-project
mkdir -p build/release
Expand All @@ -92,7 +81,7 @@ jobs:
make -j3 wallet cryptonote_protocol
cd ../../../../../../

- name: Build monero-cpp
- name: Build monero-cpp libraries
run: |
cd external/monero-cpp
mkdir -p build
Expand All @@ -102,7 +91,7 @@ jobs:
make -j3
cd ../../../

- name: Build monero-python
- name: Build monero-python module
run: |
mkdir -p build
python3 -m pip wheel . -w dist --no-build-isolation
Expand All @@ -123,12 +112,12 @@ jobs:
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
- name: Verify libraries
run: |
python3 -m zipfile -e wheelhouse/*.whl wheel-check
bin/check_macho_hardening.sh wheel-check/monero*.so

- name: Upload artifacts
- name: Upload monero-python wheel
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: monero-${{ matrix.os }}
Expand Down
32 changes: 9 additions & 23 deletions .github/workflows/build-windows.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,17 @@
name: Build Windows Package

# Called by build.yml, which has the triggers and the concurrency group: a group here would be the one of the caller, and the
# jobs of the same run would cancel each other.
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
paths:
- '.github/workflows/build-windows.yml'
- 'CMakeLists.txt'
- 'bin/check_pe_hardening.sh'
- 'requirements-build.txt'
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:
msys2-mingw64:
name: MSYS2 MinGW64
windows:
name: windows
timeout-minutes: 120
runs-on: windows-latest
env:
Expand Down Expand Up @@ -162,7 +148,7 @@ jobs:
- name: Reset ccache statistics
run: ccache --zero-stats

- name: Build monero
- name: Build monero-project
run: |
cd external/monero-cpp/external/monero-project
mkdir -p build/release
Expand All @@ -178,15 +164,15 @@ jobs:
../../
make -j$(nproc) wallet cryptonote_protocol

- name: Build monero-cpp
- name: Build monero-cpp libraries
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 wheel
- name: Build monero-python module
run: |
export WIN_PYTHON_EXE=$(cygpath -u "$pythonLocation/python.exe")
export CMAKE_BUILD_PARALLEL_LEVEL=$(nproc)
Expand All @@ -213,13 +199,13 @@ jobs:
"$WIN_PYTHON_EXE" -m delvewheel repair dist/*.whl -w wheelhouse --add-path "$MINGW_BIN_WIN"

# the flags of the image (ASLR, DEP) and the exports of the module in the wheel that is published
- name: Check hardening and exports
- name: Verify libraries
run: |
export WIN_PYTHON_EXE=$(cygpath -u "$pythonLocation/python.exe")
"$WIN_PYTHON_EXE" -m zipfile -e wheelhouse/*.whl wheel-check
bash bin/check_pe_hardening.sh wheel-check/monero*.pyd

- name: Upload artifacts
- name: Upload monero-python wheel
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: monero-python-win-amd64
Expand Down
Loading
Loading