Skip to content

Commit

Permalink
ci: refactor cache policy (#634)
Browse files Browse the repository at this point in the history
* include cargo toml in cache key

* deprecate stable debug

* create rocks cache

* disable rust logs

* fix: enable release for e2e
  • Loading branch information
mayconamaroCW authored Apr 19, 2024
1 parent d6c6db4 commit 3c7665d
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 25 deletions.
16 changes: 10 additions & 6 deletions .github/workflows/_setup-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ on:
required: false
type: string
default: ''
cache_key:
required: false
type: string
default: 'stable-release'

jobs:
setup_and_test:
Expand All @@ -29,10 +33,10 @@ jobs:
~/.cargo/git
~/.cargo/bin
target
key: ${{ runner.os }}-cargo-stable-debug-${{ hashFiles('**/Cargo.lock') }}
key: ${{ runner.os }}-cargo-${{ inputs.cache_key }}-${{ hashFiles('Cargo.lock', 'Cargo.toml') }}
restore-keys: |
${{ runner.os }}-cargo-stable-debug-
${{ runner.os }}-cargo-${{ github.workflow }}-
${{ runner.os }}-cargo-${{ inputs.cache_key }}-
${{ runner.os }}-cargo-stable-release-
- name: Set up Rust
if: ${{ steps.cache-cargo.outputs.cache-hit != 'true' }}
Expand All @@ -59,6 +63,6 @@ jobs:
- name: Run e2e tests
run: ${{ inputs.justfile_env }} just ${{ inputs.justfile_recipe }}
env:
RUST_BACKTRACE: 1
RUST_LOG: debug
RELEASE: 0
CARGO_PROFILE_RELEASE_DEBUG: 0
RUST_LOG: off
RELEASE: 1
3 changes: 1 addition & 2 deletions .github/workflows/doc-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,9 @@ jobs:
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-test-${{ hashFiles('**/Cargo.lock') }}
key: ${{ runner.os }}-cargo-test-${{ hashFiles('Cargo.lock', 'Cargo.toml') }}
restore-keys: |
${{ runner.os }}-cargo-test-
${{ runner.os }}-cargo-${{ github.workflow }}
- name: Set up Rust
if: ${{ steps.cache-cargo.outputs.cache-hit != 'true' }}
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/docs-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,9 @@ jobs:
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-nightly-debug-${{ hashFiles('**/Cargo.lock') }}
key: ${{ runner.os }}-cargo-nightly-debug-${{ hashFiles('Cargo.lock', 'Cargo.toml') }}
restore-keys: |
${{ runner.os }}-cargo-nightly-debug-
${{ runner.os }}-cargo-${{ github.workflow }}
- name: Set up Rust Nightly and Rust Docs
run: |
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/e2e-contracts-postgres.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,9 @@ jobs:
~/.cargo/git
~/.cargo/bin
target
key: ${{ runner.os }}-cargo-stable-release-${{ hashFiles('**/Cargo.lock') }}
key: ${{ runner.os }}-cargo-stable-release-${{ hashFiles('Cargo.lock', 'Cargo.toml') }}
restore-keys: |
${{ runner.os }}-cargo-stable-release-
${{ runner.os }}-cargo-${{ github.workflow }}-
- name: Set up Rust
if: ${{ steps.cache-cargo.outputs.cache-hit != 'true' }}
Expand Down Expand Up @@ -73,5 +72,5 @@ jobs:
run: just contracts-test-stratus-postgres --${{ matrix.contract }}
env:
CARGO_PROFILE_RELEASE_DEBUG: 0
RUST_LOG: debug
RUST_LOG: off
RELEASE: 1
6 changes: 3 additions & 3 deletions .github/workflows/e2e-contracts-rocks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ jobs:
~/.cargo/git
~/.cargo/bin
target
key: ${{ runner.os }}-cargo-stable-release-${{ hashFiles('**/Cargo.lock') }}
key: ${{ runner.os }}-cargo-stable-release-rocks-${{ hashFiles('Cargo.lock', 'Cargo.toml') }}
restore-keys: |
${{ runner.os }}-cargo-stable-release-rocks-
${{ runner.os }}-cargo-stable-release-
${{ runner.os }}-cargo-${{ github.workflow }}-
- name: Set up Rust
if: ${{ steps.cache-cargo.outputs.cache-hit != 'true' }}
Expand Down Expand Up @@ -73,5 +73,5 @@ jobs:
run: just contracts-test-stratus-rocks --${{ matrix.contract }}
env:
CARGO_PROFILE_RELEASE_DEBUG: 0
RUST_LOG: debug
RUST_LOG: off
RELEASE: 1
5 changes: 2 additions & 3 deletions .github/workflows/e2e-contracts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,9 @@ jobs:
~/.cargo/git
~/.cargo/bin
target
key: ${{ runner.os }}-cargo-stable-release-${{ hashFiles('**/Cargo.lock') }}
key: ${{ runner.os }}-cargo-stable-release-${{ hashFiles('Cargo.lock', 'Cargo.toml') }}
restore-keys: |
${{ runner.os }}-cargo-stable-release-
${{ runner.os }}-cargo-${{ github.workflow }}-
- name: Set up Rust
if: ${{ steps.cache-cargo.outputs.cache-hit != 'true' }}
Expand Down Expand Up @@ -73,5 +72,5 @@ jobs:
run: just contracts-test-stratus --${{ matrix.contract }}
env:
CARGO_PROFILE_RELEASE_DEBUG: 0
RUST_LOG: debug
RUST_LOG: off
RELEASE: 1
1 change: 1 addition & 0 deletions .github/workflows/e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ jobs:
uses: ./.github/workflows/_setup-e2e.yml
with:
justfile_recipe: 'e2e-stratus-rocks'
cache_key: 'stable-release-rocks'

concurrency:
group: ${{ github.workflow }}-rocks-${{ github.ref || github.run_id }}
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/int-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,9 @@ jobs:
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-test-${{ hashFiles('**/Cargo.lock') }}
key: ${{ runner.os }}-cargo-test-${{ hashFiles('Cargo.lock', 'Cargo.toml') }}
restore-keys: |
${{ runner.os }}-cargo-test-
${{ runner.os }}-cargo-${{ github.workflow }}
- name: Set up Rust
if: ${{ steps.cache-cargo.outputs.cache-hit != 'true' }}
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/lint-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,9 @@ jobs:
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-nightly-debug-${{ hashFiles('**/Cargo.lock') }}
key: ${{ runner.os }}-cargo-nightly-debug-${{ hashFiles('Cargo.lock', 'Cargo.toml') }}
restore-keys: |
${{ runner.os }}-cargo-nightly-debug-
${{ runner.os }}-cargo-${{ github.workflow }}
- name: Set up Rust Nightly
run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain nightly-2024-01-01
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,9 @@ jobs:
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-test-${{ hashFiles('**/Cargo.lock') }}
key: ${{ runner.os }}-cargo-test-${{ hashFiles('Cargo.lock', 'Cargo.toml') }}
restore-keys: |
${{ runner.os }}-cargo-test-
${{ runner.os }}-cargo-${{ github.workflow }}
- name: Set up Rust
if: ${{ steps.cache-cargo.outputs.cache-hit != 'true' }}
Expand Down

0 comments on commit 3c7665d

Please sign in to comment.