Skip to content

Make rustup and cargo state persistent across icedragon invocations #83

Make rustup and cargo state persistent across icedragon invocations

Make rustup and cargo state persistent across icedragon invocations #83

Workflow file for this run

name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
schedule:
- cron: 00 4 * * *
env:
CARGO_TERM_COLOR: always
jobs:
lint-stable:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rust-src
- name: Run clippy
run: cargo clippy --all-targets --workspace -- --deny warnings
lint-nightly:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly
components: rustfmt, rust-src
- name: Check formatting
run: cargo fmt --all -- --check
build-container-image:
runs-on: ubuntu-latest
strategy:
fail-fast: false
name: container ${{ matrix.type }} ${{ matrix.target }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Pull the base image and the image we're trying to build, to trigger
# a build only if neccessary:
#
# * If there is a newer base image.
# * If `Dockerfile` was modified.
- name: Pull the Gentoo image
run: docker pull docker.io/gentoo/stage3:musl-llvm
- name: Pull the icedragon image
if: github.ref == 'refs/heads/main'
run: docker pull ghcr.io/${{ github.repository }}:latest
- name: Pull the icedragon image
if: github.ref != 'refs/heads/main'
run: docker pull ghcr.io/${{ github.repository }}:${{ github.head_ref }}
- name: Build container image
if: github.ref == 'refs/heads/main'
run: |
cargo run build-container-image \
--tag ghcr.io/${{ github.repository }}:latest \
--push
- name: Build container image
if: github.ref != 'refs/heads/main'
run: |
cargo run build-container-image \
--tag ghcr.io/${{ github.repository }}:${{ github.head_ref }} \
--push
test:
runs-on: ubuntu-latest
needs: build-container-image
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
# Integration tests perform cross builds of different projects. Run each
# of them separately, so each build can utilize all the cores. Gather
# their output for easier debugging of failed CI builds.
- run: cargo test -- --nocapture --test-threads=1
if: github.ref == 'refs/heads/main'
- run: cargo test -- --nocapture --test-threads=1
if: github.ref != 'refs/heads/main'
env:
ICEDRAGON_CONTAINER_IMAGE: ghcr.io/${{ github.repository }}:${{ github.head_ref }}