From 5e50f4f5cabc655c99f2369c9abd67075b5dd8c0 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 24 Oct 2022 12:43:44 +0200 Subject: [PATCH 1/6] Merge non-test targets into single build target There's lots of duplication between all of them, and all of their runtimes are dominated by the setup costs of the runners. I don't think getting the separate reporting for each is worth it. --- .github/workflows/ci.yml | 75 +++++++--------------------------------- 1 file changed, 12 insertions(+), 63 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7994a2c72..767421902 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,8 +24,8 @@ defaults: shell: bash jobs: - fmt: - name: Format + build: + name: Build runs-on: ubuntu-latest steps: - name: Check out repository @@ -38,59 +38,30 @@ jobs: override: true profile: minimal target: ${{ matrix.target }} - - name: Run `cargo fmt` + - name: Set up Rust cache + uses: Swatinem/rust-cache@1232abb8968faf344409165de17cbf9e7f340fd8 + - name: Check formatting uses: actions-rs/cargo@4ff6ec2846f6e7217c1a9b0b503506665f134c4b with: command: fmt args: --all -- --check - - clippy: - name: Clippy - runs-on: ubuntu-latest - steps: - - name: Check out repository - uses: actions/checkout@v3 - - name: Set up toolchain - uses: oxidecomputer/actions-rs_toolchain@oxide/master - # see https://github.com/actions-rs/toolchain/pull/209 - # uses: actions-rs/toolchain@v1 - with: - override: true - profile: minimal - target: ${{ matrix.target }} - - name: Install Clippy - run: rustup component add clippy - - name: Set up Rust cache - uses: Swatinem/rust-cache@1232abb8968faf344409165de17cbf9e7f340fd8 - - name: Run `cargo clippy` + - name: Run Clippy uses: actions-rs/clippy-check@b5b5f21f4797c02da247df37026fcd0a5024aa4d with: token: ${{ secrets.GITHUB_TOKEN }} args: --all-features -- -D warnings - - docs: - name: Docs - runs-on: ubuntu-latest - steps: - - name: Check out repository - uses: actions/checkout@v3 - - name: Set up toolchain - uses: oxidecomputer/actions-rs_toolchain@oxide/master - # see https://github.com/actions-rs/toolchain/pull/209 - # uses: actions-rs/toolchain@v1 - with: - override: true - profile: minimal - target: ${{ matrix.target }} - - name: Set up Rust cache - uses: Swatinem/rust-cache@v1 - - name: Run `cargo doc` + - name: Build documentation uses: actions-rs/cargo@v1 with: command: doc args: --no-deps --document-private-items --all-features --workspace env: RUSTDOCFLAGS: -D warnings + - name: Run `cross-compiler` + uses: actions-rs/cargo@4ff6ec2846f6e7217c1a9b0b503506665f134c4b + with: + command: run + args: --package cross-compiler test: name: Test @@ -134,25 +105,3 @@ jobs: # Export Validator doesn't support Windows yet. Issue: # https://github.com/hannobraun/Fornjot/issues/920 if: ${{ matrix.os != 'windows-latest' }} - - wasm: - name: Cross-compile - runs-on: ubuntu-latest - steps: - - name: Check out repository - uses: actions/checkout@v3 - - name: Set up toolchain - uses: oxidecomputer/actions-rs_toolchain@oxide/master - # see https://github.com/actions-rs/toolchain/pull/209 - # uses: actions-rs/toolchain@v1 - with: - override: true - profile: minimal - target: ${{ matrix.target }} - - name: Set up Rust cache - uses: Swatinem/rust-cache@1232abb8968faf344409165de17cbf9e7f340fd8 - - name: Run `cross-compiler` - uses: actions-rs/cargo@4ff6ec2846f6e7217c1a9b0b503506665f134c4b - with: - command: run - args: --package cross-compiler From 4a1447567fa686edec4006618850afcf7a606eb1 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 24 Oct 2022 12:51:11 +0200 Subject: [PATCH 2/6] Don't use `actions-rs` to set up toolchain We have a `rust-toolchain.toml` in the repository, and `rustup` is installed on GitHub Actions, as far as I know. I think this should just do the right thing. We might lose caching with this, but I'm not sure that's worth it. Maybe once there is a maintained `actions-rs` alternative. --- .github/workflows/cd.yml | 18 ------------------ .github/workflows/ci.yml | 16 ---------------- 2 files changed, 34 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 686eda121..3afe813b7 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -35,15 +35,6 @@ jobs: - name: Checkout uses: actions/checkout@v3 - - name: Setup Toolchain - uses: oxidecomputer/actions-rs_toolchain@oxide/master - # see https://github.com/actions-rs/toolchain/pull/209 - # uses: actions-rs/toolchain@v1 - with: - override: true - profile: minimal - target: ${{ matrix.target }} - - name: Cache uses: Swatinem/rust-cache@v1 with: @@ -84,15 +75,6 @@ jobs: - name: Checkout uses: actions/checkout@v3 - - name: Setup Toolchain - uses: oxidecomputer/actions-rs_toolchain@oxide/master - # see https://github.com/actions-rs/toolchain/pull/209 - # uses: actions-rs/toolchain@v1 - with: - override: true - profile: minimal - target: ${{ matrix.target }} - - name: Operator | Cache uses: Swatinem/rust-cache@v1 with: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 767421902..c69f1afe3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,14 +30,6 @@ jobs: steps: - name: Check out repository uses: actions/checkout@v3 - - name: Set up toolchain - uses: oxidecomputer/actions-rs_toolchain@oxide/master - # see https://github.com/actions-rs/toolchain/pull/209 - # uses: actions-rs/toolchain@v1 - with: - override: true - profile: minimal - target: ${{ matrix.target }} - name: Set up Rust cache uses: Swatinem/rust-cache@1232abb8968faf344409165de17cbf9e7f340fd8 - name: Check formatting @@ -75,14 +67,6 @@ jobs: steps: - name: Check out repository uses: actions/checkout@v3 - - name: Set up toolchain - uses: oxidecomputer/actions-rs_toolchain@oxide/master - # see https://github.com/actions-rs/toolchain/pull/209 - # uses: actions-rs/toolchain@v1 - with: - override: true - profile: minimal - target: ${{ matrix.target }} - name: Set up Rust cache uses: Swatinem/rust-cache@1232abb8968faf344409165de17cbf9e7f340fd8 - name: Run `cargo build` From 0aaf6554a9f6ac261254a88eeb589e1a0aa2390d Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 24 Oct 2022 13:05:22 +0200 Subject: [PATCH 3/6] Replace use of `actions-rs` for simple tasks It's unmaintained[1] and I honestly don't even know what it does. [1]: https://github.com/actions-rs/toolchain/issues/216 --- .github/workflows/cd.yml | 5 +---- .github/workflows/ci.yml | 35 +++++++---------------------------- 2 files changed, 8 insertions(+), 32 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 3afe813b7..5ca844aff 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -41,10 +41,7 @@ jobs: key: ${{ matrix.target }} - name: Binaries | Compile - uses: actions-rs/cargo@v1 - with: - args: --release --target ${{ matrix.target }} - command: build + run: cargo build --release --target ${{ matrix.target }} - name: Binaries | Prepare upload run: | diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c69f1afe3..c20cd6b3e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,27 +33,15 @@ jobs: - name: Set up Rust cache uses: Swatinem/rust-cache@1232abb8968faf344409165de17cbf9e7f340fd8 - name: Check formatting - uses: actions-rs/cargo@4ff6ec2846f6e7217c1a9b0b503506665f134c4b - with: - command: fmt - args: --all -- --check + run: cargo fmt --all -- --check - name: Run Clippy - uses: actions-rs/clippy-check@b5b5f21f4797c02da247df37026fcd0a5024aa4d - with: - token: ${{ secrets.GITHUB_TOKEN }} - args: --all-features -- -D warnings + run: cargo clippy --all-features -- -D warnings - name: Build documentation - uses: actions-rs/cargo@v1 - with: - command: doc - args: --no-deps --document-private-items --all-features --workspace + run: cargo doc --no-deps --document-private-items --all-features --workspace env: RUSTDOCFLAGS: -D warnings - name: Run `cross-compiler` - uses: actions-rs/cargo@4ff6ec2846f6e7217c1a9b0b503506665f134c4b - with: - command: run - args: --package cross-compiler + run: cargo run --package cross-compiler test: name: Test @@ -70,22 +58,13 @@ jobs: - name: Set up Rust cache uses: Swatinem/rust-cache@1232abb8968faf344409165de17cbf9e7f340fd8 - name: Run `cargo build` - uses: actions-rs/cargo@4ff6ec2846f6e7217c1a9b0b503506665f134c4b - with: - command: build - args: --all-features + run: cargo build --all-features - name: Reject uncommitted changes run: git diff --exit-code - name: Run `cargo test` - uses: actions-rs/cargo@4ff6ec2846f6e7217c1a9b0b503506665f134c4b - with: - command: test - args: --all-features + run: cargo test --all-features - name: Run `export-validator` - uses: actions-rs/cargo@4ff6ec2846f6e7217c1a9b0b503506665f134c4b - with: - command: run - args: --package export-validator + run: cargo run --package export-validator # Export Validator doesn't support Windows yet. Issue: # https://github.com/hannobraun/Fornjot/issues/920 if: ${{ matrix.os != 'windows-latest' }} From 8bda4b86217c923f34a2896b91ec4762887f0cb6 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 24 Oct 2022 13:07:01 +0200 Subject: [PATCH 4/6] Move build test step to `Build` No need to run this multiple times per build. --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c20cd6b3e..3e76d1188 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,6 +36,8 @@ jobs: run: cargo fmt --all -- --check - name: Run Clippy run: cargo clippy --all-features -- -D warnings + - name: Reject uncommitted changes + run: git diff --exit-code - name: Build documentation run: cargo doc --no-deps --document-private-items --all-features --workspace env: @@ -59,8 +61,6 @@ jobs: uses: Swatinem/rust-cache@1232abb8968faf344409165de17cbf9e7f340fd8 - name: Run `cargo build` run: cargo build --all-features - - name: Reject uncommitted changes - run: git diff --exit-code - name: Run `cargo test` run: cargo test --all-features - name: Run `export-validator` From f4012cff0610aabaadd02c81a57e01336b9f14e6 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 24 Oct 2022 13:09:21 +0200 Subject: [PATCH 5/6] Upgrade to latest version of `rust-cache` --- .github/workflows/cd.yml | 4 ++-- .github/workflows/ci.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 5ca844aff..7476c4644 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -36,7 +36,7 @@ jobs: uses: actions/checkout@v3 - name: Cache - uses: Swatinem/rust-cache@v1 + uses: Swatinem/rust-cache@v2 with: key: ${{ matrix.target }} @@ -73,7 +73,7 @@ jobs: uses: actions/checkout@v3 - name: Operator | Cache - uses: Swatinem/rust-cache@v1 + uses: Swatinem/rust-cache@v2 with: key: release-operator-01 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3e76d1188..9db8e9087 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,7 +31,7 @@ jobs: - name: Check out repository uses: actions/checkout@v3 - name: Set up Rust cache - uses: Swatinem/rust-cache@1232abb8968faf344409165de17cbf9e7f340fd8 + uses: Swatinem/rust-cache@v2 - name: Check formatting run: cargo fmt --all -- --check - name: Run Clippy @@ -58,7 +58,7 @@ jobs: - name: Check out repository uses: actions/checkout@v3 - name: Set up Rust cache - uses: Swatinem/rust-cache@1232abb8968faf344409165de17cbf9e7f340fd8 + uses: Swatinem/rust-cache@v2 - name: Run `cargo build` run: cargo build --all-features - name: Run `cargo test` From 9647fae05b03947eee949a3ec8103ea25d08eab9 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 24 Oct 2022 13:10:18 +0200 Subject: [PATCH 6/6] Remove comment This was the original source, but we've divered from it a lot. The comment is probably more confusing than helpful at this point. And the attribution is immortalized in the commit log anyway. --- .github/workflows/ci.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9db8e9087..e7a6e0c02 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,7 +1,3 @@ ---- -# Source: https://github.com/hendrikmaus/rust-workflows -# -# Continuous Integration Workflow For Rust name: CI # Define the triggers; usually merges to the repository