Skip to content

Commit

Permalink
Fix the CI build for the Ubuntu release (#287)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
tiram88 authored Sep 30, 2023
1 parent 1c2f766 commit 712c60e
Show file tree
Hide file tree
Showing 3 changed files with 112 additions and 14 deletions.
109 changes: 95 additions & 14 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ jobs:
- name: Checkout sources
uses: actions/checkout@v3

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

- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable
Expand Down Expand Up @@ -39,15 +41,55 @@ jobs:
# matrix:
# os: [ ubuntu-latest, macos-latest, windows-latest ]
steps:
# Clean unnecessary files to save disk space
- name: clean unnecessary files to save space
run: |
docker rmi `docker images -q`
sudo rm -rf /usr/share/dotnet /etc/mysql /etc/php /etc/sudo apt/sources.list.d
sudo apt -y autoremove --purge
sudo apt -y autoclean
sudo apt clean
rm --recursive --force "$AGENT_TOOLSDIRECTORY"
df -h
# remove large packages manually (all but llvm)
sudo apt-get remove -y '^aspnetcore-.*' || echo "::warning::The command [sudo apt-get remove -y '^aspnetcore-.*'] failed to complete successfully. Proceeding..."
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..."
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..."
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..."
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..."
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..."
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..."
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..."
sudo apt-get autoremove -y || echo "::warning::The command [sudo apt-get autoremove -y] failed to complete successfully. Proceeding..."
sudo apt-get clean || echo "::warning::The command [sudo apt-get clean] failed to complete successfully. Proceeding..."
df -h
# Free up disk space on Ubuntu
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
# This might remove tools that are actually needed, if set to "true" but frees about 6 GB
tool-cache: false

# large packages, except llvm, are removed manually during the previous step
# see: https://github.com/jlumbroso/free-disk-space/issues/6
# TODO: use the discussed whitelist feature when available
large-packages: false

swap-storage: true

- name: Checkout sources
uses: actions/checkout@v3

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

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

- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable
Expand Down Expand Up @@ -129,8 +171,10 @@ jobs:
- name: Checkout sources
uses: actions/checkout@v3

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

- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable
Expand Down Expand Up @@ -162,10 +206,10 @@ jobs:
- name: Checkout sources
uses: actions/checkout@v3

- name: Install protoc
run: |
sudo apt update -y
sudo apt install -y protobuf-compiler
- name: Install Protoc
uses: arduino/setup-protoc@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Install llvm
id: install_llvm
Expand Down Expand Up @@ -223,10 +267,10 @@ jobs:
- name: Checkout sources
uses: actions/checkout@v3

- name: Install protoc
run: |
sudo apt update -y
sudo apt install -y protobuf-compiler
- name: Install Protoc
uses: arduino/setup-protoc@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Install llvm
id: install_llvm
Expand Down Expand Up @@ -271,3 +315,40 @@ jobs:

- name: Build wasm pack for nodejs
run: cd wasm && wasm-pack build --target nodejs --out-dir nodejs/kaspa --features full

build-release:
name: Build Ubuntu Release
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3

- name: Install Protoc
uses: arduino/setup-protoc@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable

- name: Cache
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: Install zig
if: runner.os == 'Linux'
uses: goto-bus-stop/setup-zig@v2 # needed for cargo-zigbuild

- name: Build on Linux
if: runner.os == 'Linux'
# We're using musl to make the binaries statically linked and portable
run: |
cargo install cargo-zigbuild
cargo --verbose zigbuild --bin kaspad --bin simpa --bin rothschild --release --target x86_64-unknown-linux-gnu.2.27 # Use an older glibc version
11 changes: 11 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions rpc/wrpc/server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,9 @@ workflow-core.workspace = true
workflow-log.workspace = true
workflow-rpc.workspace = true
num_cpus.workspace = true

[target.x86_64-unknown-linux-gnu.dependencies]
# Adding explicitely the openssl dependency here is needed for a successful build with zigbuild
# as used in the release deployment in GitHub CI
# see: https://github.com/rust-cross/cargo-zigbuild/issues/127
openssl = { version = "0.10", features = ["vendored"] }

0 comments on commit 712c60e

Please sign in to comment.