From 68bf89cc0296b3bd8713d682f06cf26e35f91018 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20H=C3=BCbener?= Date: Sat, 3 Feb 2024 12:46:49 +0100 Subject: [PATCH 1/8] tmp change to run on all branches --- .github/workflows/rust.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index b1923f7..5ad8343 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -1,12 +1,12 @@ name: Rust on: - push: - branches: [main] - paths: ["**/*.rs", "**/Cargo.toml", "**/Cargo.lock", ".github/*.yml"] - pull_request: - branches: [main] - paths: ["**/*.rs", "**/Cargo.toml", "**/Cargo.lock"] + push +# branches: [main] +# paths: ["**/*.rs", "**/Cargo.toml", "**/Cargo.lock", ".github/*.yml"] +# pull_request: +# branches: [main] +# paths: ["**/*.rs", "**/Cargo.toml", "**/Cargo.lock"] jobs: From db95c8382482139f1ca934a4d90ac3bf97120269 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20H=C3=BCbener?= Date: Sat, 3 Feb 2024 12:48:37 +0100 Subject: [PATCH 2/8] activate on push dependent again --- .github/workflows/rust.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 5ad8343..098e2c7 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -1,12 +1,12 @@ name: Rust on: - push -# branches: [main] -# paths: ["**/*.rs", "**/Cargo.toml", "**/Cargo.lock", ".github/*.yml"] -# pull_request: -# branches: [main] -# paths: ["**/*.rs", "**/Cargo.toml", "**/Cargo.lock"] + push: + # branches: [main] + paths: ["**/*.rs", "**/Cargo.toml", "**/Cargo.lock", ".github/**/*.yml"] + pull_request: + branches: [main] + paths: ["**/*.rs", "**/Cargo.toml", "**/Cargo.lock"] jobs: From 77f492d03d59bfd2ef2d6ac380a0d43d291f25c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20H=C3=BCbener?= Date: Sat, 3 Feb 2024 12:55:42 +0100 Subject: [PATCH 3/8] use cache --- .github/workflows/rust.yml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 098e2c7..8d5dc37 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -2,7 +2,7 @@ name: Rust on: push: - # branches: [main] + branches: [main] paths: ["**/*.rs", "**/Cargo.toml", "**/Cargo.lock", ".github/**/*.yml"] pull_request: branches: [main] @@ -33,6 +33,10 @@ jobs: - uses: dtolnay/rust-toolchain@stable with: toolchain: stable + - uses: actions/cache@v4 + with: + path: ~/target + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - run: cargo check --no-default-features --features=${{ matrix.features}} clippy: @@ -47,6 +51,10 @@ jobs: with: toolchain: stable components: clippy + - uses: actions/cache@v4 + with: + path: ~/target + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - run: cargo clippy --no-default-features --features=${{ matrix.features}} test: @@ -60,4 +68,8 @@ jobs: - uses: dtolnay/rust-toolchain@stable with: toolchain: stable + - uses: actions/cache@v4 + with: + path: ~/target + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - run: cargo test --no-default-features --features=${{ matrix.features}} From 5cd399a6166f642a7993a944302ce5aa9faa4f6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20H=C3=BCbener?= Date: Sat, 3 Feb 2024 12:56:21 +0100 Subject: [PATCH 4/8] tmp remove branch restriction --- .github/workflows/rust.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 8d5dc37..9cf2280 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -2,7 +2,7 @@ name: Rust on: push: - branches: [main] + # branches: [main] paths: ["**/*.rs", "**/Cargo.toml", "**/Cargo.lock", ".github/**/*.yml"] pull_request: branches: [main] From 0267a05f444c5e35d22b8f64e98cb663646d9cea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20H=C3=BCbener?= Date: Sat, 3 Feb 2024 13:02:33 +0100 Subject: [PATCH 5/8] change cache paths --- .github/workflows/rust.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 9cf2280..7bb94a2 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -35,7 +35,9 @@ jobs: toolchain: stable - uses: actions/cache@v4 with: - path: ~/target + path: | + ~/.cargo + ./target key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - run: cargo check --no-default-features --features=${{ matrix.features}} @@ -53,7 +55,9 @@ jobs: components: clippy - uses: actions/cache@v4 with: - path: ~/target + path: | + ~/.cargo + ./target key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - run: cargo clippy --no-default-features --features=${{ matrix.features}} @@ -70,6 +74,8 @@ jobs: toolchain: stable - uses: actions/cache@v4 with: - path: ~/target + path: | + ~/.cargo + ./target key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - run: cargo test --no-default-features --features=${{ matrix.features}} From 1d480da9e731dafe81cae17c0379861939b37f7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20H=C3=BCbener?= Date: Sat, 3 Feb 2024 14:06:04 +0100 Subject: [PATCH 6/8] use rust-cache action --- .github/workflows/rust.yml | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 7bb94a2..349e5e6 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -33,12 +33,9 @@ jobs: - uses: dtolnay/rust-toolchain@stable with: toolchain: stable - - uses: actions/cache@v4 - with: - path: | - ~/.cargo - ./target - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + - uses: Swatinem/rust-cache@v2 + # with: + # save-if: ${{ github.ref == 'refs/heads/master' }} - run: cargo check --no-default-features --features=${{ matrix.features}} clippy: @@ -53,12 +50,9 @@ jobs: with: toolchain: stable components: clippy - - uses: actions/cache@v4 - with: - path: | - ~/.cargo - ./target - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + - uses: Swatinem/rust-cache@v2 + # with: + # save-if: ${{ github.ref == 'refs/heads/master' }} - run: cargo clippy --no-default-features --features=${{ matrix.features}} test: @@ -72,10 +66,7 @@ jobs: - uses: dtolnay/rust-toolchain@stable with: toolchain: stable - - uses: actions/cache@v4 - with: - path: | - ~/.cargo - ./target - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + - uses: Swatinem/rust-cache@v2 + # with: + # save-if: ${{ github.ref == 'refs/heads/master' }} - run: cargo test --no-default-features --features=${{ matrix.features}} From 6663eef6cd9fa882d0fdbb8109e68f05d80db570 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20H=C3=BCbener?= Date: Sat, 3 Feb 2024 14:08:44 +0100 Subject: [PATCH 7/8] use cache key unique key over different jobs --- .github/workflows/rust.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 349e5e6..d4f7f13 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -34,7 +34,8 @@ jobs: with: toolchain: stable - uses: Swatinem/rust-cache@v2 - # with: + with: + shared-key: "build-cache" # save-if: ${{ github.ref == 'refs/heads/master' }} - run: cargo check --no-default-features --features=${{ matrix.features}} @@ -51,7 +52,8 @@ jobs: toolchain: stable components: clippy - uses: Swatinem/rust-cache@v2 - # with: + with: + shared-key: "build-cache" # save-if: ${{ github.ref == 'refs/heads/master' }} - run: cargo clippy --no-default-features --features=${{ matrix.features}} @@ -67,6 +69,7 @@ jobs: with: toolchain: stable - uses: Swatinem/rust-cache@v2 - # with: + with: + shared-key: "build-cache" # save-if: ${{ github.ref == 'refs/heads/master' }} - run: cargo test --no-default-features --features=${{ matrix.features}} From c00ad041b334be04cc050c7f28f7e3cd4a729a37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20H=C3=BCbener?= Date: Sat, 3 Feb 2024 14:11:22 +0100 Subject: [PATCH 8/8] cleanup --- .github/workflows/rust.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index d4f7f13..49a1c4a 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -2,7 +2,7 @@ name: Rust on: push: - # branches: [main] + branches: [main] paths: ["**/*.rs", "**/Cargo.toml", "**/Cargo.lock", ".github/**/*.yml"] pull_request: branches: [main] @@ -36,7 +36,7 @@ jobs: - uses: Swatinem/rust-cache@v2 with: shared-key: "build-cache" - # save-if: ${{ github.ref == 'refs/heads/master' }} + save-if: ${{ github.ref == 'refs/heads/master' }} - run: cargo check --no-default-features --features=${{ matrix.features}} clippy: @@ -54,7 +54,7 @@ jobs: - uses: Swatinem/rust-cache@v2 with: shared-key: "build-cache" - # save-if: ${{ github.ref == 'refs/heads/master' }} + save-if: ${{ github.ref == 'refs/heads/master' }} - run: cargo clippy --no-default-features --features=${{ matrix.features}} test: @@ -71,5 +71,5 @@ jobs: - uses: Swatinem/rust-cache@v2 with: shared-key: "build-cache" - # save-if: ${{ github.ref == 'refs/heads/master' }} + save-if: ${{ github.ref == 'refs/heads/master' }} - run: cargo test --no-default-features --features=${{ matrix.features}}