Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use GITHUB_SHA instead of hash of Cargo.lock for build caches #672

Merged
merged 5 commits into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .github/workflows/cargo_build_cache.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Store cargo build cache

on:
push:
branches:
- main
paths:
- 'smart-contracts/**.rs'
- 'smart-contracts/**.toml'
workflow_dispatch:

jobs:
store-build-cache:
- name: Check out repository code
uses: actions/checkout@v3
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Rust check
run: cargo check
working-directory: smart-contracts
- name: Store dependencies
uses: actions/cache/save@v4
with:
path: |
~/.cargo
~/go
**/target
key: ${{ runner.os }}-cargo-$GITHUB_SHA
restore-keys: ${{ runner.os }}-cargo
11 changes: 9 additions & 2 deletions .github/workflows/cl_vault.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,16 @@ on:
- 'smart-contracts/contracts/cl-vault/**.rs'
- 'smart-contracts/contracts/dex-router-osmosis/Cargo.toml'
- 'smart-contracts/contracts/dex-router-osmosis/**.rs'
- '.github/workflows/**.yml'
push:
branches:
- main
paths:
- 'smart-contracts/contracts/cl-vault/Cargo.toml'
- 'smart-contracts/contracts/cl-vault/**.rs'
- 'smart-contracts/contracts/dex-router-osmosis/Cargo.toml'
- 'smart-contracts/contracts/dex-router-osmosis/**.rs'
- '.github/workflows/**.yml'
workflow_dispatch:

jobs:
Expand All @@ -27,13 +34,13 @@ jobs:
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Restore dependencies
uses: actions/cache@v4
uses: actions/cache/restore@v4
with:
path: |
~/.cargo
~/go
**/target
key: ${{ runner.os }}-cargo-$${{ hashFiles('smart-contracts/Cargo.lock') }}
key: ${{ runner.os }}-cargo-$GITHUB_SHA
restore-keys: ${{ runner.os }}-cargo
- name: Build dex-router-osmosis
run: cargo test-tube-build
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/dex_router_osmosis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,14 @@ on:
paths:
- 'smart-contracts/contracts/dex-router-osmosis/Cargo.toml'
- 'smart-contracts/contracts/dex-router-osmosis/**.rs'
- '.github/workflows/**.yml'
push:
branches:
- main
paths:
- 'smart-contracts/contracts/dex-router-osmosis/Cargo.toml'
- 'smart-contracts/contracts/dex-router-osmosis/**.rs'
- '.github/workflows/**.yml'
workflow_dispatch:

jobs:
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/lst_adapter_osmosis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,14 @@ on:
paths:
- 'smart-contracts/contracts/lst-adapter-osmosis/Cargo.toml'
- 'smart-contracts/contracts/lst-adapter-osmosis/**.rs'
- '.github/workflows/**.yml'
push:
branches:
- main
paths:
- 'smart-contracts/contracts/lst-adapter-osmosis/Cargo.toml'
- 'smart-contracts/contracts/lst-adapter-osmosis/**.rs'
- '.github/workflows/**.yml'
workflow_dispatch:

jobs:
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/lst_dex_adapter_osmosis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,14 @@ on:
paths:
- 'smart-contracts/contracts/lst-dex-adapter-osmosis/Cargo.toml'
- 'smart-contracts/contracts/lst-dex-adapter-osmosis/**.rs'
- '.github/workflows/**.yml'
push:
branches:
- main
paths:
- 'smart-contracts/contracts/lst-dex-adapter-osmosis/Cargo.toml'
- 'smart-contracts/contracts/lst-dex-adapter-osmosis/**.rs'
- '.github/workflows/**.yml'
workflow_dispatch:

jobs:
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/merkle_incentives.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,14 @@ on:
paths:
- 'smart-contracts/contracts/merkle-incentives/Cargo.toml'
- 'smart-contracts/contracts/merkle-incentives/**.rs'
- '.github/workflows/**.yml'
push:
branches:
- main
paths:
- 'smart-contracts/contracts/merkle-incentives/Cargo.toml'
- 'smart-contracts/contracts/merkle-incentives/**.rs'
- '.github/workflows/**.yml'
workflow_dispatch:

jobs:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/quasar_types.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@ on:
- main
paths:
- 'smart-contracts/packages/quasar-types/**'
- '.github/workflows/**.yml'
push:
branches:
- main
paths:
- 'smart-contracts/packages/quasar-types/**'
- '.github/workflows/**.yml'
workflow_dispatch:

jobs:
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/range_middleware.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,14 @@ on:
paths:
- 'smart-contracts/contracts/range-middleware/Cargo.toml'
- 'smart-contracts/contracts/range-middleware/**.rs'
- '.github/workflows/**.yml'
push:
branches:
- main
paths:
- 'smart-contracts/contracts/range-middleware/Cargo.toml'
- 'smart-contracts/contracts/range-middleware/**.rs'
- '.github/workflows/**.yml'
workflow_dispatch:

jobs:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/rust_basic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ jobs:
uses: dtolnay/rust-toolchain@stable
- name: Restore dependencies
if: env.GIT_DIFF
uses: actions/cache@v4
uses: actions/cache/restore@v4
with:
path: |
~/.cargo
~/go
**/target
key: ${{ runner.os }}-cargo-$${{ hashFiles('smart-contracts/Cargo.lock') }}
key: ${{ runner.os }}-cargo-$GITHUB_SHA
restore-keys: ${{ runner.os }}-cargo
- name: Rust lint
if: env.GIT_DIFF
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/rust_test_tube.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ jobs:
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Restore dependencies
uses: actions/cache@v4
uses: actions/cache/restore@v4
with:
path: |
~/.cargo
~/go
**/target
key: ${{ runner.os }}-cargo-$${{ hashFiles('smart-contracts/Cargo.lock') }}
key: ${{ runner.os }}-cargo-$GITHUB_SHA
restore-keys: ${{ runner.os }}-cargo
- name: Build ${{ inputs.contract }}
run: cargo test-tube-build
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/token_burner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,14 @@ on:
paths:
- 'smart-contracts/contracts/token-burner/Cargo.toml'
- 'smart-contracts/contracts/token-burner/**.rs'
- '.github/workflows/**.yml'
push:
branches:
- main
paths:
- 'smart-contracts/contracts/token-burner/Cargo.toml'
- 'smart-contracts/contracts/token-burner/**.rs'
- '.github/workflows/**.yml'
workflow_dispatch:

jobs:
Expand Down
Loading