Improve build cache expiration logic #721
Workflow file for this run
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
name: CI | |
on: | |
push: | |
# Avoid duplicate builds on PRs. | |
branches: | |
- main | |
pull_request: | |
permissions: | |
contents: read | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
lint: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Update Rust toolchain | |
run: rustup update | |
- name: Rust Cache | |
uses: Swatinem/[email protected] | |
- name: Clippy | |
run: cargo clippy --all-targets --locked -- --deny warnings | |
- name: rustfmt | |
run: cargo fmt -- --check | |
unit-test: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Update Rust toolchain | |
run: rustup update | |
- name: Rust Cache | |
uses: Swatinem/[email protected] | |
- name: Run unit tests | |
run: cargo test --locked | |
integration-test: | |
name: integration-tests ${{ matrix.builder }} / ${{ matrix.arch }} | |
runs-on: ${{ matrix.arch == 'arm64' && 'pub-hk-ubuntu-22.04-arm-large' || 'ubuntu-latest' }} | |
strategy: | |
matrix: | |
arch: ["amd64"] | |
builder: ["heroku/builder:20", "heroku/builder:22", "heroku/builder:24"] | |
include: | |
- arch: "arm64" | |
builder: "heroku/builder:24" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
# The beta ARM64 runners don't yet ship with the normal installed tools. | |
- name: Install Docker, Rust and development libs (ARM64 only) | |
if: matrix.arch == 'arm64' | |
run: | | |
sudo apt-get update --error-on=any | |
sudo apt-get install -y --no-install-recommends acl docker.io docker-buildx libc6-dev | |
sudo usermod -aG docker $USER | |
sudo setfacl --modify user:$USER:rw /var/run/docker.sock | |
curl -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal | |
echo "${HOME}/.cargo/bin" >> "${GITHUB_PATH}" | |
- name: Install musl-tools | |
run: sudo apt-get install musl-tools -y --no-install-recommends | |
- name: Update Rust toolchain | |
run: rustup update | |
- name: Install Rust linux-musl target | |
run: rustup target add ${{ matrix.arch == 'arm64' && 'aarch64-unknown-linux-musl' || 'x86_64-unknown-linux-musl' }} | |
- name: Rust Cache | |
uses: Swatinem/[email protected] | |
- name: Install Pack CLI | |
uses: buildpacks/github-actions/[email protected] | |
- name: Pull builder image | |
run: docker pull ${{ matrix.builder }} | |
- name: Run integration tests | |
env: | |
INTEGRATION_TEST_BUILDER: ${{ matrix.builder }} | |
# Runs only tests annotated with the `ignore` attribute (which in this repo, are the integration tests). | |
run: cargo test --locked -- --ignored --test-threads 16 |