From 8e3e7dac312613dd161483cc222d599bc8d0b2e1 Mon Sep 17 00:00:00 2001 From: Philipp Schuster Date: Fri, 17 Mar 2023 16:16:38 +0100 Subject: [PATCH 1/5] ci: cache per rust version --- .github/workflows/_build-rust.yml | 4 ++-- .github/workflows/rust.yml | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/_build-rust.yml b/.github/workflows/_build-rust.yml index a294cc34..074d3582 100644 --- a/.github/workflows/_build-rust.yml +++ b/.github/workflows/_build-rust.yml @@ -52,8 +52,8 @@ jobs: ~/.cargo/registry/cache/ ~/.cargo/git/db/ target/ - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - restore-keys: ${{ runner.os }}-cargo- + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-${{ inputs.rust-version }} + restore-keys: ${{ runner.os }}-cargo-${{ inputs.rust-version }} - run: cargo version - name: Code Formatting if: ${{ inputs.do-style-check }} diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index f34ef430..58b2cd39 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -16,28 +16,28 @@ env: jobs: build_multiboot2_msrv: - name: "build (msrv)" + name: build (msrv) uses: ./.github/workflows/_build-rust.yml with: rust-version: 1.56.1 do-style-check: false build_multiboot2_stable: - name: "build (stable)" + name: build (stable) uses: ./.github/workflows/_build-rust.yml with: rust-version: stable do-style-check: false build_multiboot2_nightly: - name: "build (nightly)" + name: build (nightly) uses: ./.github/workflows/_build-rust.yml with: rust-version: nightly do-style-check: false build_nostd_multiboot2_msrv: - name: "build no_std (msrv)" + name: build no_std (msrv) uses: ./.github/workflows/_build-rust.yml with: rust-version: 1.56.1 @@ -45,7 +45,7 @@ jobs: rust-target: thumbv7em-none-eabihf build_nostd_multiboot2_stable: - name: "build no_std (stable)" + name: build no_std (stable) uses: ./.github/workflows/_build-rust.yml with: rust-version: stable @@ -53,7 +53,7 @@ jobs: rust-target: thumbv7em-none-eabihf build_nostd_multiboot2_nightly: - name: "build no_std (nightly)" + name: build no_std (nightly) uses: ./.github/workflows/_build-rust.yml with: rust-version: nightly @@ -61,7 +61,7 @@ jobs: rust-target: thumbv7em-none-eabihf style_multiboot2_msrv: - name: "style (msrv)" + name: style (msrv) uses: ./.github/workflows/_build-rust.yml with: rust-version: 1.56.1 @@ -69,7 +69,7 @@ jobs: do-test: false style_multiboot2_stable: - name: "style (stable)" + name: style (stable) uses: ./.github/workflows/_build-rust.yml with: rust-version: stable From 7e71a3bd1af623709c590eab56542bd25298eee1 Mon Sep 17 00:00:00 2001 From: Philipp Schuster Date: Fri, 17 Mar 2023 16:24:32 +0100 Subject: [PATCH 2/5] ci: needs relation This ensures cache inconsistencies, as the first job in the pipeline will create the cache for later jobs. --- .github/workflows/rust.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 58b2cd39..1c424b99 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -38,6 +38,7 @@ jobs: build_nostd_multiboot2_msrv: name: build no_std (msrv) + needs: build_multiboot2_msrv uses: ./.github/workflows/_build-rust.yml with: rust-version: 1.56.1 @@ -46,6 +47,7 @@ jobs: build_nostd_multiboot2_stable: name: build no_std (stable) + needs: build_multiboot2_stable uses: ./.github/workflows/_build-rust.yml with: rust-version: stable @@ -54,6 +56,7 @@ jobs: build_nostd_multiboot2_nightly: name: build no_std (nightly) + needs: build_multiboot2_nightly uses: ./.github/workflows/_build-rust.yml with: rust-version: nightly @@ -62,6 +65,7 @@ jobs: style_multiboot2_msrv: name: style (msrv) + needs: build_multiboot2_msrv uses: ./.github/workflows/_build-rust.yml with: rust-version: 1.56.1 @@ -70,6 +74,7 @@ jobs: style_multiboot2_stable: name: style (stable) + needs: build_multiboot2_stable uses: ./.github/workflows/_build-rust.yml with: rust-version: stable From ff36c1e62f11e9e5b7773618d3f504248dfc0fd7 Mon Sep 17 00:00:00 2001 From: Philipp Schuster Date: Fri, 17 Mar 2023 16:32:38 +0100 Subject: [PATCH 3/5] ci: cleaner job names --- .github/workflows/rust.yml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 1c424b99..f23f872c 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -15,66 +15,66 @@ env: CARGO_TERM_COLOR: always jobs: - build_multiboot2_msrv: + build_msrv: name: build (msrv) uses: ./.github/workflows/_build-rust.yml with: rust-version: 1.56.1 do-style-check: false - build_multiboot2_stable: + build_stable: name: build (stable) uses: ./.github/workflows/_build-rust.yml with: rust-version: stable do-style-check: false - build_multiboot2_nightly: + build_nightly: name: build (nightly) uses: ./.github/workflows/_build-rust.yml with: rust-version: nightly do-style-check: false - build_nostd_multiboot2_msrv: + build_nostd_msrv: name: build no_std (msrv) - needs: build_multiboot2_msrv + needs: build_msrv uses: ./.github/workflows/_build-rust.yml with: rust-version: 1.56.1 do-style-check: false rust-target: thumbv7em-none-eabihf - build_nostd_multiboot2_stable: + build_nostd_stable: name: build no_std (stable) - needs: build_multiboot2_stable + needs: build_stable uses: ./.github/workflows/_build-rust.yml with: rust-version: stable do-style-check: false rust-target: thumbv7em-none-eabihf - build_nostd_multiboot2_nightly: + build_nostd_nightly: name: build no_std (nightly) - needs: build_multiboot2_nightly + needs: build_nightly uses: ./.github/workflows/_build-rust.yml with: rust-version: nightly do-style-check: false rust-target: thumbv7em-none-eabihf - style_multiboot2_msrv: + style_msrv: name: style (msrv) - needs: build_multiboot2_msrv + needs: build_msrv uses: ./.github/workflows/_build-rust.yml with: rust-version: 1.56.1 do-style-check: true do-test: false - style_multiboot2_stable: + style_stable: name: style (stable) - needs: build_multiboot2_stable + needs: build_stable uses: ./.github/workflows/_build-rust.yml with: rust-version: stable From 8ee2b3f2d2240a700f674e4531ce11297815e7c2 Mon Sep 17 00:00:00 2001 From: Philipp Schuster Date: Fri, 17 Mar 2023 16:32:46 +0100 Subject: [PATCH 4/5] ci: also nightly style job --- .github/workflows/rust.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index f23f872c..702c704a 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -80,3 +80,12 @@ jobs: rust-version: stable do-style-check: true do-test: false + + style_nightly: + name: style (nightly) + needs: build_nightly + uses: ./.github/workflows/_build-rust.yml + with: + rust-version: nightly + do-style-check: true + do-test: false From 7151b01ab188747a076ba8fcf4dc5ada54c8d319 Mon Sep 17 00:00:00 2001 From: Philipp Schuster Date: Fri, 17 Mar 2023 16:26:41 +0100 Subject: [PATCH 5/5] ci: fix hash in cache key --- .github/workflows/_build-rust.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/_build-rust.yml b/.github/workflows/_build-rust.yml index 074d3582..1856bdb3 100644 --- a/.github/workflows/_build-rust.yml +++ b/.github/workflows/_build-rust.yml @@ -52,7 +52,8 @@ jobs: ~/.cargo/registry/cache/ ~/.cargo/git/db/ target/ - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-${{ inputs.rust-version }} + # We do not have a Cargo.lock here, so I hash Cargo.toml + key: ${{ runner.os }}-rust-${{ inputs.rust-version }}-cargo-${{ hashFiles('**/Cargo.toml') }} restore-keys: ${{ runner.os }}-cargo-${{ inputs.rust-version }} - run: cargo version - name: Code Formatting