-
Notifications
You must be signed in to change notification settings - Fork 510
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2649 from etungsten/cache-develop
actions-workflow: add caching to develop and PR build workflows
- Loading branch information
Showing
3 changed files
with
92 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# This workflow caches crate dependencies and build artifacts for tools (except 'test-tools' since we don't use them in build workflows). | ||
# The cache is only usable by workflows started from pull requests against the develop branch. | ||
name: CacheDepsAndTools | ||
on: | ||
push: | ||
branches: [develop] | ||
paths: | ||
- '.github/**' | ||
- 'sources/Cargo.lock' | ||
- 'tools/buildsys/**' | ||
- 'tools/pubsys*/**' | ||
- '!tools/pubsys/policies/**' | ||
- '!tools/pubsys/**.example' | ||
- '!tools/pubsys/**.template' | ||
- 'tools/Cargo.lock' | ||
jobs: | ||
cache: | ||
runs-on: | ||
group: bottlerocket | ||
labels: bottlerocket_ubuntu-latest_16-core | ||
continue-on-error: true | ||
steps: | ||
- run: | | ||
echo "OS_ARCH=`uname -m`" >> $GITHUB_ENV | ||
- uses: actions/checkout@v3 | ||
# Cache `cargo-make`, `cargo-cache`, `cargo-sweep` | ||
- uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.cargo | ||
key: ${{ hashFiles('.github/workflows/cache.yml') }}-${{ runner.os }}-${{ env.OS_ARCH }} | ||
# Cache first-party code dependencies | ||
- uses: actions/cache@v3 | ||
with: | ||
path: | | ||
.cargo | ||
key: ${{ hashFiles('.github/workflows/cache.yml') }}-${{ runner.os }}-${{ env.OS_ARCH }}-${{ hashFiles('sources/Cargo.lock') }} | ||
# Cache 'tools/' dependencies and build artifacts | ||
- uses: actions/cache@v3 | ||
with: | ||
path: | | ||
tools/bin | ||
tools/.crates.toml | ||
tools/.crates2.json | ||
tools/target | ||
key: ${{ hashFiles('.github/workflows/cache.yml') }}-${{ runner.os }}-${{ env.OS_ARCH }}-${{ hashFiles('tools/Cargo.lock') }} | ||
- run: rustup default 1.64.0 | ||
- run: cargo install --locked --version 0.36.0 cargo-make | ||
- run: cargo install --locked --version 0.8.3 --no-default-features --features ci-autoclean cargo-cache | ||
- run: cargo install --locked --version 0.6.2 cargo-sweep | ||
- run: | | ||
cargo sweep -i -r tools/ | ||
cargo sweep -t 7 -r tools/ | ||
- run: cargo make publish-setup-tools | ||
- run: cargo make publish-tools | ||
- run: cargo make build-tools | ||
# This cleans the cargo cache in ~/.cargo | ||
- run: cargo-cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters