-
Notifications
You must be signed in to change notification settings - Fork 35
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 #6 from bcressey/more-cache-fixes
try to improve caching behavior
- Loading branch information
Showing
3 changed files
with
36 additions
and
41 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,23 @@ | ||
name: "Node setup" | ||
description: "Performs setup for caching and other common needs." | ||
inputs: | ||
perform-cache-cleanup: | ||
description: "Whether to perform cache cleanup" | ||
required: false | ||
default: false | ||
type: boolean | ||
runs: | ||
using: "composite" | ||
steps: | ||
- run: | | ||
echo "OS_ARCH=`uname -m`" >> $GITHUB_ENV | ||
sudo apt -y install build-essential openssl libssl-dev pkg-config liblz4-tool | ||
shell: bash | ||
- uses: actions/cache@v4 | ||
# Cache `cargo-make`, `cargo-cache` | ||
- uses: actions/cache/restore@v4 | ||
# Restore most recent cache if available. | ||
with: | ||
path: | | ||
~/.cargo | ||
key: ${{ hashFiles('.github/workflows/cache.yml') }}-${{ runner.os }}-${{ env.OS_ARCH }} | ||
- uses: actions/cache@v4 | ||
# Cache Rust dependencies | ||
with: | ||
path: | | ||
.cargo | ||
key: ${{ hashFiles('.github/workflows/cache.yml') }}-${{ runner.os }}-${{ env.OS_ARCH }}-${{ hashFiles('sources/Cargo.lock') }} | ||
- uses: actions/cache@v4 | ||
# Cache Go dependencies | ||
with: | ||
path: | | ||
.gomodcache | ||
key: ${{ hashFiles('.github/workflows/cache.yml') }}-${{ runner.os }}-${{ env.OS_ARCH }}-${{ hashFiles('sources/**/go.sum') }} | ||
build/external-kits | ||
build/rpms | ||
build/state | ||
target | ||
key: ${{ hashFiles('.github/workflows/cache.yml') }}-${{ runner.os }}-${{ env.OS_ARCH }} | ||
- run: cargo install cargo-make | ||
shell: bash | ||
- if: ${{ inputs.perform-cache-cleanup }} | ||
run: cargo install --no-default-features --features ci-autoclean cargo-cache | ||
shell: bash |
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 |
---|---|---|
@@ -1,36 +1,44 @@ | ||
# This workflow caches crate dependencies, build tools, and external kits. | ||
# This workflow caches external dependencies, build tools, and the most recent artifacts. | ||
# The cache is only usable by workflows started from pull requests against the develop branch. | ||
name: CacheDepsAndTools | ||
name: CacheLatest | ||
on: | ||
push: | ||
branches: [develop] | ||
paths: | ||
- '.github/**' | ||
- 'sources/Cargo.lock' | ||
- 'sources/**/go.sum' | ||
- 'Twoliter.toml' | ||
- 'Twoliter.lock' | ||
- 'Makefile' | ||
jobs: | ||
cache: | ||
if: github.repository == 'bottlerocket-os/bottlerocket-core-kit' | ||
runs-on: | ||
group: bottlerocket | ||
labels: bottlerocket_ubuntu-latest_8-core | ||
continue-on-error: true | ||
labels: bottlerocket_ubuntu-latest_32-core | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Preflight step to set up the runner | ||
uses: ./.github/actions/setup-node | ||
with: | ||
perform-cache-cleanup: true | ||
# Install dependencies for twoliter and cargo-make. | ||
- run: | | ||
echo "OS_ARCH=`uname -m`" >> $GITHUB_ENV | ||
sudo apt -y install build-essential openssl libssl-dev pkg-config liblz4-tool | ||
shell: bash | ||
# Install cargo-make. | ||
- run: cargo install cargo-make | ||
shell: bash | ||
# This installs twoliter. | ||
- run: make prep | ||
# This fetches any external kit dependencies. | ||
- run: make fetch | ||
# This cleans the existing project local caches. | ||
- run: make twoliter purge-cache | ||
# This fetches Rust crate and Go module dependencies. | ||
- run: make twoliter fetch | ||
# This cleans the cargo cache in ~/.cargo | ||
- run: cargo-cache | ||
# This builds the current packages and kits. | ||
- run: make ARCH=x86_64 | ||
- run: make ARCH=aarch64 | ||
# This caches the reusable artifacts for future CI runs. | ||
- uses: actions/cache/save@v4 | ||
# Save Rust dependencies | ||
with: | ||
path: | | ||
~/.cargo | ||
.cargo | ||
.gomodcache | ||
build/external-kits | ||
build/rpms | ||
build/state | ||
target | ||
key: ${{ hashFiles('.github/workflows/cache.yml') }}-${{ runner.os }}-${{ env.OS_ARCH }} |
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