Repository navigation
131 lines (112 loc) · 5.22 KB
/
Copy pathbuild-linux.yml
File metadata and controls
131 lines (112 loc) · 5.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
name: Build Linux
# Called by ci.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 ci.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 apt packages
run: bin/install_dependencies_linux.sh
- name: Show the versions of the apt libraries
run: bin/show_versions_linux.sh | bin/job_summary.sh "apt libraries"
- name: Install the Python build requirements (requirements-build.txt)
run: pip3 install -r requirements-build.txt --break-system-packages
- name: Install expat 2.7.1 (static)
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 1.22.0 (static)
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: ./.github/actions/restore-ccache
with:
key: ccache-linux-test
- name: Reset ccache statistics
run: ccache --zero-stats
- name: Build monero-project (static, Release)
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 (with coverage)
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 the monero-python module (with coverage)
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 | bin/job_summary.sh "ccache"
- 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 ci.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 the Linux build
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: build-linux-x86_64
path: linux-build.tar.gz
# already compressed
compression-level: 0
retention-days: 7