Skip to content

Commit

Permalink
Build aarch64 in CI (#764)
Browse files Browse the repository at this point in the history
  • Loading branch information
rukai committed Aug 31, 2022
1 parent eb2d8b3 commit 3a86fcd
Show file tree
Hide file tree
Showing 6 changed files with 81 additions and 18 deletions.
3 changes: 3 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ rustflags = [
"-C", "link-arg=-undefined",
"-C", "link-arg=dynamic_lookup",
]

[target.aarch64-unknown-linux-gnu]
linker = "aarch64-linux-gnu-gcc"
43 changes: 43 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Build

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

# Cancel already running jobs
concurrency:
group: build_${{ github.head_ref }}
cancel-in-progress: true

env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1

jobs:
build:
strategy:
matrix:
include:
- name: Ubuntu 22.04 - Release - x86_64
runner: ubuntu-22.04
cargo_flags: --release
- name: Ubuntu 22.04 - Release - aarch64
runner: ubuntu-22.04
cargo_flags: --target aarch64-unknown-linux-gnu --release
name: ${{ matrix.name }}
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v2
# We purposefully dont cache here as build_and_test will always be the bottleneck
# so we should leave the cache alone so build_and_test can make more use of it.
- name: Install ubuntu packages
run: shotover-proxy/build/install_ubuntu_packages.sh
- name: Install cargo-hack
run: cargo install cargo-hack --version 0.5.8
- name: Ensure that shotover-proxy compiles and has no warnings under every possible combination of features
# some things to explicitly point out:
# * clippy also reports rustc warnings and errors
# * clippy --all-targets is not run so we only build the shotover_proxy executable
run: cargo hack --feature-powerset clippy --locked ${{ matrix.cargo_flags }} -- -D warnings
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Testing
name: Build and Test

on:
push:
Expand All @@ -8,27 +8,25 @@ on:

# Cancel already running jobs
concurrency:
group: testing_${{ github.head_ref }}
group: build_and_test_${{ github.head_ref }}
cancel-in-progress: true

env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1

jobs:
build:
build_and_test:
strategy:
matrix:
include:
# the cassandra cpp driver is only supported on 18.04
- name: Ubuntu 18.04 - Release
runner: ubuntu-18.04
cargo_profile: --release
cargo_flags: --release
- name: Ubuntu 18.04 - Debug
runner: ubuntu-18.04
cargo_profile:
- name: Ubuntu 20.04 - Debug
runner: ubuntu-20.04
cargo_profile:
cargo_flags:
name: ${{ matrix.name }}
runs-on: ${{ matrix.runner }}
steps:
Expand All @@ -50,11 +48,9 @@ jobs:
# some things to explicitly point out:
# * clippy also reports rustc warnings and errors
# * clippy --all-targets causes clippy to run against tests and examples which it doesnt do by default.
run: cargo hack --feature-powerset clippy --all-targets --locked ${{ matrix.cargo_profile }} -- -D warnings
run: cargo hack --feature-powerset clippy --all-targets --locked ${{ matrix.cargo_flags }} -- -D warnings
- name: Ensure that tests pass
run: cargo test ${{ matrix.cargo_profile }} --all-features -- --include-ignored --show-output --nocapture
# can not run tests if cpp driver not installed
if: ${{ matrix.runner == 'ubuntu-18.04' }}
run: cargo test ${{ matrix.cargo_flags }} --all-features -- --include-ignored --show-output --nocapture
- name: Ensure that custom benches run
run: cargo run --release --example cassandra_bench -- --config-dir example-configs/cassandra-passthrough --rate 1000
if: ${{ matrix.name == 'Ubuntu 18.04 - Release' }}
Expand All @@ -64,8 +60,3 @@ jobs:
git status
exit 1
fi
- name: License Check
run: |
cargo install --locked cargo-deny
cargo deny check licenses
if: ${{ matrix.name == 'Ubuntu 20.04 - Debug' }}
25 changes: 25 additions & 0 deletions .github/workflows/license_check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: License Check

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

# Cancel already running jobs
concurrency:
group: license_check_${{ github.head_ref }}
cancel-in-progress: true

env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1

jobs:
license_check:
runs-on: ubuntu-22.04
name: License Check
steps:
- uses: actions/checkout@v2
- run: cargo install --locked cargo-deny
- run: cargo deny check licenses
1 change: 1 addition & 0 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[toolchain]
channel = "1.63"
components = [ "rustfmt", "clippy" ]
targets = [ "aarch64-unknown-linux-gnu" ]
2 changes: 1 addition & 1 deletion shotover-proxy/build/install_ubuntu_packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -e

sudo apt-get update
sudo apt-get install -y libpcap-dev wget
sudo apt-get install -y libpcap-dev wget gcc-aarch64-linux-gnu

. /etc/lsb-release

Expand Down

0 comments on commit 3a86fcd

Please sign in to comment.