Quellcode durchsuchen

Merge pull request #126 from rust-osdev/ci

ci: cache per rust version
Philipp Schuster vor 2 Jahren
Ursprung
Commit
95fb832897
2 geänderte Dateien mit 33 neuen und 18 gelöschten Zeilen
  1. 3 2
      .github/workflows/_build-rust.yml
  2. 30 16
      .github/workflows/rust.yml

+ 3 - 2
.github/workflows/_build-rust.yml

@@ -52,8 +52,9 @@ jobs:
             ~/.cargo/registry/cache/
             ~/.cargo/git/db/
             target/
-          key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
-          restore-keys: ${{ runner.os }}-cargo-
+          # 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
         if: ${{ inputs.do-style-check }}

+ 30 - 16
.github/workflows/rust.yml

@@ -15,63 +15,77 @@ env:
   CARGO_TERM_COLOR: always
 
 jobs:
-  build_multiboot2_msrv:
-    name: "build (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:
-    name: "build (stable)"
+  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)"
+  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)"
+  build_nostd_msrv:
+    name: build no_std (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:
-    name: "build no_std  (stable)"
+  build_nostd_stable:
+    name: build no_std (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:
-    name: "build no_std  (nightly)"
+  build_nostd_nightly:
+    name: build no_std (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:
-    name: "style (msrv)"
+  style_msrv:
+    name: style (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:
-    name: "style (stable)"
+  style_stable:
+    name: style (stable)
+    needs: build_stable
     uses: ./.github/workflows/_build-rust.yml
     with:
       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