Skip to content

Commit bd58558

Browse files
committed
ci: containerize ubuntu cli jobs
1 parent 662d246 commit bd58558

File tree

1 file changed

+155
-130
lines changed

1 file changed

+155
-130
lines changed

.github/workflows/build.yml

+155-130
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,18 @@ on:
1313
# The below variables reduce repetitions across similar targets
1414
env:
1515
REMOVE_BUNDLED_PACKAGES : sudo rm -rf /usr/local
16-
BUILD_DEFAULT_LINUX: 'cmake -S . -B build -D ARCH="default" -D BUILD_TESTS=ON -D CMAKE_BUILD_TYPE=Release && cmake --build build --target all && cmake --build build --target wallet_api'
16+
# ARCH="default" (not "native") ensures, that a different execution host can execute binaries compiled elsewhere.
17+
BUILD_DEFAULT_LINUX: 'cmake -S . -B build -D ARCH="default" -D BUILD_TESTS=ON -D CMAKE_BUILD_TYPE=Release && cmake --build --target all && cmake --build build --target wallet_api'
1718
APT_INSTALL_LINUX: 'apt -y install build-essential cmake libboost-all-dev miniupnpc libunbound-dev graphviz doxygen libunwind8-dev pkg-config libssl-dev libzmq3-dev libsodium-dev libhidapi-dev libusb-1.0-0-dev libprotobuf-dev protobuf-compiler ccache git'
1819
APT_SET_CONF: |
19-
tee -a /etc/apt/apt.conf.d/80-custom << EOF
20-
Acquire::Retries "3";
21-
Acquire::http::Timeout "120";
22-
Acquire::ftp::Timeout "120";
23-
EOF
20+
tee -a /etc/apt/apt.conf.d/80-custom << EOF
21+
Acquire::Retries "3";
22+
Acquire::http::Timeout "120";
23+
Acquire::ftp::Timeout "120";
24+
EOF
2425
CCACHE_SETTINGS: |
25-
ccache --max-size=150M
26-
ccache --set-config=compression=true
26+
ccache --max-size=150M
27+
ccache --set-config=compression=true
2728
USE_DEVICE_TREZOR_MANDATORY: ON
2829

2930
jobs:
@@ -33,23 +34,23 @@ jobs:
3334
env:
3435
CCACHE_TEMPDIR: /tmp/.ccache-temp
3536
steps:
36-
- uses: actions/checkout@v4
37-
with:
38-
submodules: recursive
39-
- uses: actions/cache@v4
40-
with:
41-
path: /Users/runner/Library/Caches/ccache
42-
key: ccache-${{ runner.os }}-build-${{ github.sha }}
43-
restore-keys: ccache-${{ runner.os }}-build-
44-
- uses: ./.github/actions/set-make-job-count
45-
- name: install dependencies
46-
run: |
47-
HOMEBREW_NO_AUTO_UPDATE=1 brew install boost hidapi openssl zmq miniupnpc expat libunwind-headers protobuf@21 ccache
48-
brew link protobuf@21 boost
49-
- name: build
50-
run: |
51-
${{env.CCACHE_SETTINGS}}
52-
make -j${{env.MAKE_JOB_COUNT}}
37+
- uses: actions/checkout@v4
38+
with:
39+
submodules: recursive
40+
- uses: actions/cache@v4
41+
with:
42+
path: /Users/runner/Library/Caches/ccache
43+
key: ccache-${{ runner.os }}-build-${{ github.sha }}
44+
restore-keys: ccache-${{ runner.os }}-build-
45+
- uses: ./.github/actions/set-make-job-count
46+
- name: install dependencies
47+
run: |
48+
HOMEBREW_NO_AUTO_UPDATE=1 brew install boost hidapi openssl zmq miniupnpc expat libunwind-headers protobuf@21 ccache
49+
brew link protobuf@21 boost
50+
- name: build
51+
run: |
52+
${{env.CCACHE_SETTINGS}}
53+
make -j${{env.MAKE_JOB_COUNT}}
5354
5455
build-windows:
5556
name: 'Windows (MSYS2)'
@@ -61,23 +62,23 @@ jobs:
6162
run:
6263
shell: msys2 {0}
6364
steps:
64-
- uses: actions/checkout@v4
65-
with:
66-
submodules: recursive
67-
- uses: actions/cache@v4
68-
with:
69-
path: C:\Users\runneradmin\.ccache
70-
key: ccache-${{ runner.os }}-build-${{ github.sha }}
71-
restore-keys: ccache-${{ runner.os }}-build-
72-
- uses: msys2/setup-msys2@v2
73-
with:
74-
update: true
75-
install: mingw-w64-x86_64-toolchain make mingw-w64-x86_64-cmake mingw-w64-x86_64-ccache mingw-w64-x86_64-boost mingw-w64-x86_64-openssl mingw-w64-x86_64-zeromq mingw-w64-x86_64-libsodium mingw-w64-x86_64-hidapi mingw-w64-x86_64-protobuf mingw-w64-x86_64-libusb mingw-w64-x86_64-unbound git pkg-config
76-
- uses: ./.github/actions/set-make-job-count
77-
- name: build
78-
run: |
79-
${{env.CCACHE_SETTINGS}}
80-
make release-static-win64 -j${{env.MAKE_JOB_COUNT}}
65+
- uses: actions/checkout@v4
66+
with:
67+
submodules: recursive
68+
- uses: actions/cache@v4
69+
with:
70+
path: C:\Users\runneradmin\.ccache
71+
key: ccache-${{ runner.os }}-build-${{ github.sha }}
72+
restore-keys: ccache-${{ runner.os }}-build-
73+
- uses: msys2/setup-msys2@v2
74+
with:
75+
update: true
76+
install: mingw-w64-x86_64-toolchain make mingw-w64-x86_64-cmake mingw-w64-x86_64-ccache mingw-w64-x86_64-boost mingw-w64-x86_64-openssl mingw-w64-x86_64-zeromq mingw-w64-x86_64-libsodium mingw-w64-x86_64-hidapi mingw-w64-x86_64-protobuf mingw-w64-x86_64-libusb mingw-w64-x86_64-unbound git pkg-config
77+
- uses: ./.github/actions/set-make-job-count
78+
- name: build
79+
run: |
80+
${{env.CCACHE_SETTINGS}}
81+
make release-static-win64 -j${{env.MAKE_JOB_COUNT}}
8182
8283
build-arch:
8384
name: 'Arch Linux'
@@ -99,6 +100,7 @@ jobs:
99100
run: ${{env.BUILD_DEFAULT_LINUX}}
100101

101102
build-debian:
103+
# Oldest supported Debian version
102104
name: 'Debian 10'
103105
runs-on: ubuntu-latest
104106
container:
@@ -123,106 +125,129 @@ jobs:
123125
CMAKE_BUILD_PARALLEL_LEVEL: ${{env.MAKE_JOB_COUNT}}
124126
run: ${{env.BUILD_DEFAULT_LINUX}}
125127

126-
# See the OS labels and monitor deprecations here:
127-
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources
128-
129128
build-ubuntu:
130129
name: ${{ matrix.name }}
131-
runs-on: ${{ matrix.os }}
132-
env:
133-
CCACHE_TEMPDIR: /tmp/.ccache-temp
130+
runs-on: ubuntu-latest
134131
strategy:
135132
fail-fast: false
136133
matrix:
137134
include:
138-
- os: ubuntu-20.04
139-
name: Ubuntu 20.04
140-
- os: ubuntu-22.04
141-
name: Ubuntu 22.04
142-
steps:
143-
- uses: actions/checkout@v4
144-
with:
145-
submodules: recursive
146-
- uses: actions/cache@v4
147-
with:
148-
path: ~/.ccache
149-
key: ccache-${{ runner.os }}-build-${{ matrix.os }}-${{ github.sha }}
150-
restore-keys: ccache-${{ runner.os }}-build-${{ matrix.os }}
151-
- uses: ./.github/actions/set-make-job-count
152-
- name: remove bundled packages
153-
run: ${{env.REMOVE_BUNDLED_PACKAGES}}
154-
- name: set apt conf
155-
run: sudo ${{env.APT_SET_CONF}}
156-
- name: update apt
157-
run: sudo apt update
158-
- name: install monero dependencies
159-
run: sudo ${{env.APT_INSTALL_LINUX}}
160-
- name: build
135+
# Oldest supported Ubuntu LTS version
136+
- name: Ubuntu 20.04
137+
container: ubuntu:20.04
138+
139+
# Most popular Ubuntu LTS version
140+
- name: Ubuntu 22.04
141+
container: ubuntu:22.04
142+
container:
143+
image: ${{ matrix.container }}
161144
env:
162-
CMAKE_BUILD_PARALLEL_LEVEL: ${{env.MAKE_JOB_COUNT}}
163-
run: |
164-
${{env.CCACHE_SETTINGS}}
165-
${{env.BUILD_DEFAULT_LINUX}}
145+
DEBIAN_FRONTEND: noninteractive
146+
CCACHE_TEMPDIR: /tmp/.ccache-temp
147+
CCACHE_DIR: ~/.ccache
148+
steps:
149+
- name: set apt conf
150+
run: ${{env.APT_SET_CONF}}
151+
- name: update apt
152+
run: apt update
153+
- name: install monero dependencies
154+
run: ${{env.APT_INSTALL_LINUX}}
155+
- name: configure git
156+
run: git config --global --add safe.directory '*'
157+
- uses: actions/checkout@v4
158+
with:
159+
submodules: recursive
160+
- uses: actions/cache@v4
161+
with:
162+
path: ~/.ccache
163+
key: ccache-${{ matrix.container }}-build-${{ github.sha }}
164+
restore-keys: ccache-${{ matrix.container }}-build-
165+
- uses: ./.github/actions/set-make-job-count
166+
- name: build
167+
env:
168+
CMAKE_BUILD_PARALLEL_LEVEL: ${{env.MAKE_JOB_COUNT}}
169+
run: |
170+
${{env.CCACHE_SETTINGS}}
171+
${{env.BUILD_DEFAULT_LINUX}}
166172
167173
test-ubuntu:
168-
name: "Ubuntu 20.04 (tests)"
174+
name: "${{ matrix.name }} (tests)"
169175
needs: build-ubuntu
170-
runs-on: ubuntu-20.04
171-
env:
172-
CCACHE_TEMPDIR: /tmp/.ccache-temp
173-
steps:
174-
- uses: actions/checkout@v4
175-
with:
176-
submodules: recursive
177-
- name: ccache
178-
uses: actions/cache@v4
179-
with:
180-
path: ~/.ccache
181-
key: ccache-${{ runner.os }}-build-ubuntu-latest-${{ github.sha }}
182-
restore-keys: ccache-${{ runner.os }}-build-ubuntu-latest
183-
- uses: ./.github/actions/set-make-job-count
184-
- name: remove bundled packages
185-
run: ${{env.REMOVE_BUNDLED_PACKAGES}}
186-
- name: set apt conf
187-
run: sudo ${{env.APT_SET_CONF}}
188-
- name: update apt
189-
run: sudo apt update
190-
- name: install monero dependencies
191-
run: sudo ${{env.APT_INSTALL_LINUX}}
192-
- name: install Python dependencies
193-
run: pip install requests psutil monotonic zmq deepdiff
194-
- name: create dummy disk drives for testing
195-
run: tests/create_test_disks.sh >> $GITHUB_ENV
196-
- name: tests
176+
runs-on: ubuntu-latest
177+
strategy:
178+
matrix:
179+
include:
180+
- name: Ubuntu 20.04
181+
container: ubuntu:20.04
182+
container:
183+
image: ${{ matrix.container }}
197184
env:
198-
CTEST_OUTPUT_ON_FAILURE: ON
199-
DNS_PUBLIC: tcp://9.9.9.9
200-
CMAKE_BUILD_PARALLEL_LEVEL: ${{env.MAKE_JOB_COUNT}}
201-
run: |
202-
${{env.CCACHE_SETTINGS}}
203-
${{env.BUILD_DEFAULT_LINUX}}
204-
cmake --build build --target test
205-
206-
207-
# ARCH="default" (not "native") ensures, that a different execution host can execute binaries compiled elsewhere.
208-
# BUILD_SHARED_LIBS=ON speeds up the linkage part a bit, reduces size, and is the only place where the dynamic linkage is tested.
185+
DEBIAN_FRONTEND: noninteractive
186+
CCACHE_TEMPDIR: /tmp/.ccache-temp
187+
CCACHE_DIR: ~/.ccache
188+
options: --privileged
189+
steps:
190+
- name: set apt conf
191+
run: ${{env.APT_SET_CONF}}
192+
- name: update apt
193+
run: apt update
194+
- name: install monero dependencies
195+
run: ${{env.APT_INSTALL_LINUX}}
196+
- name: install pip
197+
run: apt install -y python3-pip
198+
- name: install Python dependencies
199+
run: pip install requests psutil monotonic zmq deepdiff
200+
- name: configure git
201+
run: git config --global --add safe.directory '*'
202+
- uses: actions/checkout@v4
203+
with:
204+
submodules: recursive
205+
- uses: actions/cache@v4
206+
with:
207+
path: ~/.ccache
208+
key: ccache-${{ matrix.container }}-build-${{ github.sha }}
209+
restore-keys: ccache-${{ matrix.container }}-build-
210+
- name: create dummy disk drives for testing
211+
run: tests/create_test_disks.sh >> $GITHUB_ENV
212+
- uses: ./.github/actions/set-make-job-count
213+
- name: tests
214+
env:
215+
CTEST_OUTPUT_ON_FAILURE: ON
216+
DNS_PUBLIC: tcp://9.9.9.9
217+
CMAKE_BUILD_PARALLEL_LEVEL: ${{env.MAKE_JOB_COUNT}}
218+
run: |
219+
${{env.CCACHE_SETTINGS}}
220+
${{env.BUILD_DEFAULT_LINUX}}
221+
cmake --build build --target test
209222
210223
source-archive:
211224
name: "source archive"
212-
runs-on: ubuntu-20.04
225+
runs-on: ubuntu-latest
226+
container:
227+
image: ubuntu:20.04
228+
env:
229+
DEBIAN_FRONTEND: noninteractive
213230
steps:
214-
- uses: actions/checkout@v4
215-
with:
216-
fetch-depth: 0
217-
submodules: recursive
218-
- name: archive
219-
run: |
220-
pip install git-archive-all
221-
export VERSION="monero-$(git describe)"
222-
export OUTPUT="$VERSION.tar"
223-
echo "OUTPUT=$OUTPUT" >> $GITHUB_ENV
224-
/home/runner/.local/bin/git-archive-all --prefix "$VERSION/" --force-submodules "$OUTPUT"
225-
- uses: actions/upload-artifact@v4
226-
with:
227-
name: ${{ env.OUTPUT }}
228-
path: /home/runner/work/${{ github.event.repository.name }}/${{ github.event.repository.name }}/${{ env.OUTPUT }}
231+
- name: set apt conf
232+
run: ${{env.APT_SET_CONF}}
233+
- name: update apt
234+
run: apt update
235+
- name: install dependencies
236+
run: apt install -y git python3-pip
237+
- name: configure git
238+
run: git config --global --add safe.directory '*'
239+
- uses: actions/checkout@v4
240+
with:
241+
fetch-depth: 0
242+
submodules: recursive
243+
- name: archive
244+
run: |
245+
pip install git-archive-all
246+
export VERSION="monero-$(git describe)"
247+
export OUTPUT="$VERSION.tar"
248+
echo "OUTPUT=$OUTPUT" >> $GITHUB_ENV
249+
git-archive-all --prefix "$VERSION/" --force-submodules "$OUTPUT"
250+
- uses: actions/upload-artifact@v4
251+
with:
252+
name: ${{ env.OUTPUT }}
253+
path: ${{ env.OUTPUT }}

0 commit comments

Comments
 (0)