Skip to content

Commit 712c60e

Browse files
authored
Fix the CI build for the Ubuntu release (#287)
* Fix the CI build for the Ubuntu release * Add reference * Restrict openssl dependency to linux target * Use arduino setup-protoc action in all CI jobs * Add some file cleaning to test CI for not going out of disk space * Prevent llvm removal in test CI * Robust removal * Add a job checking successful build of Ubuntu release
1 parent 1c2f766 commit 712c60e

File tree

3 files changed

+112
-14
lines changed

3 files changed

+112
-14
lines changed

.github/workflows/ci.yaml

Lines changed: 95 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@ jobs:
1010
- name: Checkout sources
1111
uses: actions/checkout@v3
1212

13-
- name: Install protoc
14-
run: sudo apt install -y protobuf-compiler
13+
- name: Install Protoc
14+
uses: arduino/setup-protoc@v1
15+
with:
16+
repo-token: ${{ secrets.GITHUB_TOKEN }}
1517

1618
- name: Install stable toolchain
1719
uses: dtolnay/rust-toolchain@stable
@@ -39,15 +41,55 @@ jobs:
3941
# matrix:
4042
# os: [ ubuntu-latest, macos-latest, windows-latest ]
4143
steps:
44+
# Clean unnecessary files to save disk space
45+
- name: clean unnecessary files to save space
46+
run: |
47+
docker rmi `docker images -q`
48+
sudo rm -rf /usr/share/dotnet /etc/mysql /etc/php /etc/sudo apt/sources.list.d
49+
sudo apt -y autoremove --purge
50+
sudo apt -y autoclean
51+
sudo apt clean
52+
rm --recursive --force "$AGENT_TOOLSDIRECTORY"
53+
df -h
54+
55+
# remove large packages manually (all but llvm)
56+
sudo apt-get remove -y '^aspnetcore-.*' || echo "::warning::The command [sudo apt-get remove -y '^aspnetcore-.*'] failed to complete successfully. Proceeding..."
57+
sudo apt-get remove -y '^dotnet-.*' --fix-missing || echo "::warning::The command [sudo apt-get remove -y '^dotnet-.*' --fix-missing] failed to complete successfully. Proceeding..."
58+
sudo apt-get remove -y 'php.*' --fix-missing || echo "::warning::The command [sudo apt-get remove -y 'php.*' --fix-missing] failed to complete successfully. Proceeding..."
59+
sudo apt-get remove -y '^mongodb-.*' --fix-missing || echo "::warning::The command [sudo apt-get remove -y '^mongodb-.*' --fix-missing] failed to complete successfully. Proceeding..."
60+
sudo apt-get remove -y '^mysql-.*' --fix-missing || echo "::warning::The command [sudo apt-get remove -y '^mysql-.*' --fix-missing] failed to complete successfully. Proceeding..."
61+
sudo apt-get remove -y azure-cli google-chrome-stable firefox powershell mono-devel libgl1-mesa-dri --fix-missing || echo "::warning::The command [sudo apt-get remove -y azure-cli google-chrome-stable firefox powershell mono-devel libgl1-mesa-dri --fix-missing] failed to complete successfully. Proceeding..."
62+
sudo apt-get remove -y google-cloud-sdk --fix-missing || echo "::debug::The command [sudo apt-get remove -y google-cloud-sdk --fix-missing] failed to complete successfully. Proceeding..."
63+
sudo apt-get remove -y google-cloud-cli --fix-missing || echo "::debug::The command [sudo apt-get remove -y google-cloud-cli --fix-missing] failed to complete successfully. Proceeding..."
64+
sudo apt-get autoremove -y || echo "::warning::The command [sudo apt-get autoremove -y] failed to complete successfully. Proceeding..."
65+
sudo apt-get clean || echo "::warning::The command [sudo apt-get clean] failed to complete successfully. Proceeding..."
66+
df -h
67+
68+
# Free up disk space on Ubuntu
69+
- name: Free Disk Space (Ubuntu)
70+
uses: jlumbroso/free-disk-space@main
71+
with:
72+
# This might remove tools that are actually needed, if set to "true" but frees about 6 GB
73+
tool-cache: false
74+
75+
# large packages, except llvm, are removed manually during the previous step
76+
# see: https://github.com/jlumbroso/free-disk-space/issues/6
77+
# TODO: use the discussed whitelist feature when available
78+
large-packages: false
79+
80+
swap-storage: true
81+
4282
- name: Checkout sources
4383
uses: actions/checkout@v3
4484

4585
- name: Fix CRLF on Windows
4686
if: runner.os == 'Windows'
4787
run: git config --global core.autocrlf false
4888

49-
- name: Install protoc
50-
run: sudo apt install -y protobuf-compiler
89+
- name: Install Protoc
90+
uses: arduino/setup-protoc@v1
91+
with:
92+
repo-token: ${{ secrets.GITHUB_TOKEN }}
5193

5294
- name: Install stable toolchain
5395
uses: dtolnay/rust-toolchain@stable
@@ -129,8 +171,10 @@ jobs:
129171
- name: Checkout sources
130172
uses: actions/checkout@v3
131173

132-
- name: Install protoc
133-
run: sudo apt install -y protobuf-compiler
174+
- name: Install Protoc
175+
uses: arduino/setup-protoc@v1
176+
with:
177+
repo-token: ${{ secrets.GITHUB_TOKEN }}
134178

135179
- name: Install stable toolchain
136180
uses: dtolnay/rust-toolchain@stable
@@ -162,10 +206,10 @@ jobs:
162206
- name: Checkout sources
163207
uses: actions/checkout@v3
164208

165-
- name: Install protoc
166-
run: |
167-
sudo apt update -y
168-
sudo apt install -y protobuf-compiler
209+
- name: Install Protoc
210+
uses: arduino/setup-protoc@v1
211+
with:
212+
repo-token: ${{ secrets.GITHUB_TOKEN }}
169213

170214
- name: Install llvm
171215
id: install_llvm
@@ -223,10 +267,10 @@ jobs:
223267
- name: Checkout sources
224268
uses: actions/checkout@v3
225269

226-
- name: Install protoc
227-
run: |
228-
sudo apt update -y
229-
sudo apt install -y protobuf-compiler
270+
- name: Install Protoc
271+
uses: arduino/setup-protoc@v1
272+
with:
273+
repo-token: ${{ secrets.GITHUB_TOKEN }}
230274

231275
- name: Install llvm
232276
id: install_llvm
@@ -271,3 +315,40 @@ jobs:
271315

272316
- name: Build wasm pack for nodejs
273317
run: cd wasm && wasm-pack build --target nodejs --out-dir nodejs/kaspa --features full
318+
319+
build-release:
320+
name: Build Ubuntu Release
321+
runs-on: ubuntu-latest
322+
steps:
323+
- name: Checkout sources
324+
uses: actions/checkout@v3
325+
326+
- name: Install Protoc
327+
uses: arduino/setup-protoc@v1
328+
with:
329+
repo-token: ${{ secrets.GITHUB_TOKEN }}
330+
331+
- name: Install stable toolchain
332+
uses: dtolnay/rust-toolchain@stable
333+
334+
- name: Cache
335+
uses: actions/cache@v3
336+
with:
337+
path: |
338+
~/.cargo/bin/
339+
~/.cargo/registry/index/
340+
~/.cargo/registry/cache/
341+
~/.cargo/git/db/
342+
target/
343+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
344+
345+
- name: Install zig
346+
if: runner.os == 'Linux'
347+
uses: goto-bus-stop/setup-zig@v2 # needed for cargo-zigbuild
348+
349+
- name: Build on Linux
350+
if: runner.os == 'Linux'
351+
# We're using musl to make the binaries statically linked and portable
352+
run: |
353+
cargo install cargo-zigbuild
354+
cargo --verbose zigbuild --bin kaspad --bin simpa --bin rothschild --release --target x86_64-unknown-linux-gnu.2.27 # Use an older glibc version

Cargo.lock

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rpc/wrpc/server/Cargo.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,9 @@ workflow-core.workspace = true
3333
workflow-log.workspace = true
3434
workflow-rpc.workspace = true
3535
num_cpus.workspace = true
36+
37+
[target.x86_64-unknown-linux-gnu.dependencies]
38+
# Adding explicitely the openssl dependency here is needed for a successful build with zigbuild
39+
# as used in the release deployment in GitHub CI
40+
# see: https://github.com/rust-cross/cargo-zigbuild/issues/127
41+
openssl = { version = "0.10", features = ["vendored"] }

0 commit comments

Comments
 (0)