This repository has been archived by the owner on Jan 11, 2024. It is now read-only.
FM-186: Fix rust-toolchain action version #440
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: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- '**' | |
env: | |
CARGO_INCREMENTAL: '0' | |
SCCACHE_CACHE_SIZE: 10G | |
CC: "sccache clang" | |
CXX: "sccache clang++" | |
PROFILE: "ci" | |
jobs: | |
# Check code formatting; anything that doesn't require compilation. | |
pre-compile-checks: | |
name: Pre-compile checks | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the project | |
uses: actions/checkout@v3 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: nightly | |
components: rustfmt | |
- name: Check code formatting | |
run: make check-fmt | |
- name: Check license headers | |
run: make license | |
# Test matrix, running tasks from the Makefile. | |
tests: | |
needs: [pre-compile-checks] | |
name: ${{ matrix.make.name }} (${{ matrix.os }}, ${{ matrix.rust }}) | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest] | |
rust: [stable, nightly] | |
make: | |
- name: Lint | |
task: lint | |
- name: Test | |
task: test | |
- name: End-to-End | |
task: e2e | |
exclude: | |
- rust: stable | |
make: | |
name: Lint | |
- rust: nightly | |
make: | |
name: End-to-end | |
env: | |
RUST_BACKTRACE: full | |
RUSTFLAGS: -Dwarnings | |
steps: | |
- name: Check out the project | |
uses: actions/checkout@v3 | |
- name: Install Tools | |
uses: ./.github/actions/install-tools | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
rust: ${{ matrix.rust }} | |
- name: Setup Cache | |
uses: ./.github/actions/setup-cache | |
timeout-minutes: 5 | |
continue-on-error: true | |
with: | |
# Caching everything separately, in case they don't ask for the same things to be compiled. | |
cache-key: ${{ matrix.make.name }}-${{ matrix.os }}-${{ matrix.rust }}-${{ hashFiles('**/Cargo.lock', 'rust-toolchain', 'rust-toolchain.toml') }} | |
# Not sure why we should ever update a cache that has the hash of the lock file in it. | |
# In Forest it only contains the rust-toolchain, so it makes sense to update because dependencies could have changed. | |
cache-update: false | |
- name: ${{ matrix.make.name }} | |
run: make ${{ matrix.make.task }} | |
# Publish Docker image on the main branch | |
publish: | |
name: Publish artifacts | |
needs: [tests] | |
if: github.ref == 'refs/heads/main' | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
contents: read | |
steps: | |
- name: Check out the project | |
uses: actions/checkout@v3 | |
- name: Install Tools | |
uses: ./.github/actions/install-tools | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
rust: stable | |
- name: Setup Cache | |
uses: ./.github/actions/setup-cache | |
timeout-minutes: 5 | |
continue-on-error: true | |
with: | |
# Very likely that the Cargo.lock file will change between PRs, | |
# but since this only runs on the main branch we can update a single cache. | |
cache-key: publish-${{ hashFiles('rust-toolchain', 'rust-toolchain.toml') }} | |
cache-update: true | |
- name: Docker Build | |
run: make docker-build | |
- name: Docker Push | |
uses: ./.github/actions/docker-push | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
repo-owner: ${{ github.repository_owner }} | |
image-name: ${{ github.event.repository.name }} |