From ccdafdd3fac825f5f86f9f543b5cee3af92951e3 Mon Sep 17 00:00:00 2001 From: Benedikt Reinartz Date: Thu, 25 May 2023 07:52:11 +0200 Subject: [PATCH 1/4] Introduce CI cache --- .github/workflows/main.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9500dfc1..7281152d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -50,6 +50,8 @@ jobs: with: components: clippy + - uses: Swatinem/rust-cache@v2 + - run: cargo clippy --all-targets --all-features -- -D warnings test: @@ -100,6 +102,8 @@ jobs: with: toolchain: ${{matrix.rust}} + - uses: Swatinem/rust-cache@v2 + - run: cargo test - name: Test rustler_mix From 51747981c9dab77c9bd13746918f9edfbf98d1ab Mon Sep 17 00:00:00 2001 From: Benedikt Reinartz Date: Thu, 25 May 2023 08:03:49 +0200 Subject: [PATCH 2/4] Share key between Clippy and Test runs --- .github/workflows/main.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7281152d..ec1153de 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -51,12 +51,15 @@ jobs: components: clippy - uses: Swatinem/rust-cache@v2 + with: + cache-on-failure: true + shared-key: rustler - run: cargo clippy --all-targets --all-features -- -D warnings test: name: OTP ${{matrix.pair.erlang}} / Elixir ${{matrix.pair.elixir}} / Rust ${{matrix.rust}} / OS ${{matrix.os}} - needs: [format, clippy] + # needs: [format, clippy] strategy: matrix: pair: @@ -103,6 +106,9 @@ jobs: toolchain: ${{matrix.rust}} - uses: Swatinem/rust-cache@v2 + with: + cache-on-failure: true + shared-key: rustler - run: cargo test From 7edbbd417a554409bd8fca4d800debfe240ff020 Mon Sep 17 00:00:00 2001 From: Benedikt Reinartz Date: Thu, 25 May 2023 08:15:22 +0200 Subject: [PATCH 3/4] Run explicit build step to fill the cache and use it in clippy/test --- .github/workflows/main.yml | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ec1153de..bef5a66c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -37,9 +37,30 @@ jobs: working-directory: rustler_tests run: mix format --check-formatted + build: + name: Build ${{matrix.os}} + runs-on: ${{matrix.os}}-latest + strategy: + matrix: + os: [ubuntu, windows, macos] + steps: + - uses: actions/checkout@v3 + + - uses: dtolnay/rust-toolchain@stable + with: + components: clippy + + - uses: Swatinem/rust-cache@v2 + with: + cache-on-failure: true + shared-key: rustler + + - run: cargo build + clippy: name: Clippy ${{matrix.os}} runs-on: ${{matrix.os}}-latest + needs: [build] strategy: matrix: os: [ubuntu, windows, macos] @@ -52,14 +73,14 @@ jobs: - uses: Swatinem/rust-cache@v2 with: - cache-on-failure: true shared-key: rustler + save-if: false - run: cargo clippy --all-targets --all-features -- -D warnings test: name: OTP ${{matrix.pair.erlang}} / Elixir ${{matrix.pair.elixir}} / Rust ${{matrix.rust}} / OS ${{matrix.os}} - # needs: [format, clippy] + needs: [build] strategy: matrix: pair: @@ -107,8 +128,8 @@ jobs: - uses: Swatinem/rust-cache@v2 with: - cache-on-failure: true shared-key: rustler + save-if: false - run: cargo test From 9c412d9a8c7700586db1678426fce2e0a0e069a9 Mon Sep 17 00:00:00 2001 From: Benedikt Reinartz Date: Thu, 25 May 2023 08:25:36 +0200 Subject: [PATCH 4/4] Also pre-build on nightly --- .github/workflows/main.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index bef5a66c..0e8a70a9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -38,17 +38,18 @@ jobs: run: mix format --check-formatted build: - name: Build ${{matrix.os}} + name: Build ${{matrix.os}} ${{matrix.toolchain}} runs-on: ${{matrix.os}}-latest strategy: matrix: os: [ubuntu, windows, macos] + toolchain: [stable, nightly] steps: - uses: actions/checkout@v3 - uses: dtolnay/rust-toolchain@stable with: - components: clippy + toolchain: ${{matrix.toolchain}} - uses: Swatinem/rust-cache@v2 with: