Skip to content

Commit

Permalink
Merge pull request #1052 from powdr-labs/build-cache
Browse files Browse the repository at this point in the history
daily rust cache for PR-tests action
  • Loading branch information
lvella authored Feb 12, 2024
2 parents 04dd072 + dcf4587 commit 4fedb58
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 13 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/build-cache.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Generate rust cache for PR builds
on:
workflow_dispatch:
schedule:
- cron: '0 2 * * *' # run at 2 AM UTC

env:
CARGO_TERM_COLOR: always

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Install Rust toolchain 1.74 (with clippy and rustfmt)
run: rustup toolchain install 1.74-x86_64-unknown-linux-gnu && rustup component add clippy --toolchain 1.74-x86_64-unknown-linux-gnu && rustup component add rustfmt --toolchain 1.74-x86_64-unknown-linux-gnu
- name: Lint
run: cargo clippy --all --all-targets --all-features --profile pr-tests -- -D warnings
- name: Lint
run: cargo clippy --all --all-targets --no-default-features --profile pr-tests -- -D warnings
- name: Format
run: cargo fmt --all --check --verbose
- name: Build
run: cargo build --all-targets --all --all-features --profile pr-tests
- name: Check without Halo2
run: cargo check --all --no-default-features --profile pr-tests
- name: ⚡ Save rust cache
uses: actions/cache/save@v3
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
Cargo.lock
key: ${{ runner.os }}-cargo-pr-tests-${{ hashFiles('**/Cargo.lock') }}
19 changes: 6 additions & 13 deletions .github/workflows/pr-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@ jobs:
uses: actions/cache/restore@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-pr-tests-${{ hashFiles('**/Cargo.toml') }}
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
Cargo.lock
key: ${{ runner.os }}-cargo-pr-tests-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-pr-tests-
- name: Install Rust toolchain 1.74 (with clippy and rustfmt)
Expand All @@ -45,15 +47,6 @@ jobs:
- uses: taiki-e/install-action@nextest
- name: Create tests archive
run: cargo nextest archive --archive-file tests.tar.zst --cargo-profile pr-tests --workspace --all-features
- name: ⚡ Save rust cache
if: github.ref == 'refs/heads/main'
uses: actions/cache/save@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-pr-tests-${{ hashFiles('**/Cargo.toml') }}
- name: Upload tests archive
uses: actions/upload-artifact@v2
with:
Expand Down

0 comments on commit 4fedb58

Please sign in to comment.