faster, cheaper (pick two): improve CI workflow and switch to free github runner (#5702)

Co-authored-by: Douwe Osinga <douwe@block.xyz>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Jack Amadeo
2025-11-14 09:58:57 -08:00
committed by GitHub
parent bbac7d6250
commit d4f66f4855
8 changed files with 127 additions and 214 deletions
+41 -24
View File
@@ -1,3 +1,5 @@
name: CI
on:
push:
branches:
@@ -10,8 +12,6 @@ on:
- main
workflow_dispatch:
name: CI
jobs:
changes:
runs-on: ubuntu-latest
@@ -41,23 +41,21 @@ jobs:
- name: Checkout Code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # pin@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Run cargo fmt
run: source ./bin/activate-hermit && cargo fmt --check
run: cargo fmt --check
rust-build-and-test:
name: Build and Test Rust Project
runs-on: goose
runs-on: ubuntu-latest
needs: changes
if: needs.changes.outputs.code == 'true' || github.event_name != 'pull_request'
steps:
- name: Checkout Code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # pin@v4
- name: Activate hermit and set CARGO_HOME
run: |
source bin/activate-hermit
echo "CARGO_HOME=$CARGO_HOME" >> $GITHUB_ENV
echo "RUSTUP_HOME=$RUSTUP_HOME" >> $GITHUB_ENV
- uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Install Dependencies
run: |
@@ -65,32 +63,52 @@ jobs:
sudo apt install -y libdbus-1-dev gnome-keyring libxcb1-dev
- name: Cache Cargo artifacts
uses: actions/cache@2f8e54208210a422b2efd51efaa6bd6d7ca8920f # pin@v3
with:
path: |
${{ env.CARGO_HOME }}/bin/
${{ env.CARGO_HOME }}/registry/index/
${{ env.CARGO_HOME }}/registry/cache/
${{ env.CARGO_HOME }}/git/db/
target/
key: ${{ runner.os }}-cargo-debug-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-debug-
uses: Swatinem/rust-cache@v2
- name: Build and Test
run: |
gnome-keyring-daemon --components=secrets --daemonize --unlock <<< 'foobar'
source ../bin/activate-hermit
export CARGO_INCREMENTAL=0
cargo test --jobs 2
cargo test -- --skip scenario_tests::scenarios::tests
cargo test --jobs 1 scenario_tests::scenarios::tests
working-directory: crates
rust-lint:
name: Lint Rust Code
runs-on: ubuntu-latest
needs: changes
if: needs.changes.outputs.code == 'true' || github.event_name != 'pull_request'
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # pin@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- uses: Swatinem/rust-cache@v2
- name: Lint
run: |
source ./bin/activate-hermit
# use the non-hermit rust toolchain because the rust-cache action does not
# play nicely with hermit-managed rust
hermit uninstall rustup
export CARGO_INCREMENTAL=0
./scripts/clippy-lint.sh
openapi-schema-check:
name: Check OpenAPI Schema is Up-to-Date
runs-on: ubuntu-latest
needs: changes
if: needs.changes.outputs.code == 'true' || github.event_name != 'pull_request'
steps:
- name: Checkout Code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # pin@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Cache Cargo artifacts
uses: Swatinem/rust-cache@v2
- name: Install Node.js Dependencies for OpenAPI Check
run: source ../../bin/activate-hermit && npm ci
working-directory: ui/desktop
@@ -98,6 +116,7 @@ jobs:
- name: Check OpenAPI Schema is Up-to-Date
run: |
source ./bin/activate-hermit
hermit uninstall rustup
just check-openapi-schema
desktop-lint:
@@ -130,5 +149,3 @@ jobs:
- name: Run Tests
run: source ../../bin/activate-hermit && npm run test:run
working-directory: ui/desktop