CI #84
This file contains hidden or 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: | |
- 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 }} | |
- 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 }} |