flake-checker/.github/workflows/ci.yaml

136 lines
4.1 KiB
YAML
Raw Permalink Normal View History

name: Flake checker CI
2023-05-19 18:35:59 +03:00
on:
pull_request:
push:
branches: [main]
jobs:
2023-06-22 21:44:11 +03:00
checks:
name: Nix and Rust checks
2023-05-26 15:29:43 +03:00
runs-on: ubuntu-22.04
steps:
2024-05-16 17:33:45 +03:00
- uses: actions/checkout@v4
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
2023-06-22 21:44:11 +03:00
- name: Check flake.lock
uses: DeterminateSystems/flake-checker-action@main
2023-06-22 21:44:11 +03:00
with:
fail-mode: true
2023-05-26 15:29:43 +03:00
- name: Check Nix formatting
run: nix develop -c check-nixpkgs-fmt
- name: Check Rust formatting
run: nix develop -c check-rustfmt
2023-06-21 20:19:21 +03:00
- name: Clippy
run: nix develop -c cargo clippy
2023-05-26 15:29:43 +03:00
2023-06-21 20:08:25 +03:00
rust-tests:
name: Test Rust
runs-on: ubuntu-22.04
steps:
2024-05-16 17:33:45 +03:00
- uses: actions/checkout@v4
2023-06-21 20:08:25 +03:00
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
2023-06-21 20:08:25 +03:00
- name: cargo test
run: nix develop -c cargo test
2024-06-18 03:57:07 +03:00
check-flake-cel-condition:
name: Check flake.lock test (CEL condition)
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- name: Check flake.lock
run: |
nix develop -c \
cargo run -- \
2024-06-18 04:37:22 +03:00
--condition "supportedRefs.contains(gitRef) && numDaysOld < 30 && owner == 'NixOS'" \
2024-07-02 00:55:38 +03:00
./tests/flake.cel.0.lock
2024-06-18 03:57:07 +03:00
check-flake-dirty:
2023-05-24 00:35:05 +03:00
name: Check flake.lock test (dirty 😈)
2023-05-19 18:35:59 +03:00
runs-on: ubuntu-22.04
steps:
2024-05-16 17:33:45 +03:00
- uses: actions/checkout@v4
2023-05-19 18:35:59 +03:00
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- name: Check flake.lock
run: |
2023-06-21 20:08:25 +03:00
nix develop -c cargo run -- ./tests/flake.dirty.0.lock
2023-05-25 19:03:01 +03:00
check-flake-clean:
2023-05-24 00:35:05 +03:00
name: Check flake.lock test (clean 👼)
runs-on: ubuntu-22.04
steps:
2024-05-16 17:33:45 +03:00
- uses: actions/checkout@v4
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- name: Check flake.lock
run: |
2023-05-25 05:20:00 +03:00
nix develop -c cargo run
2023-06-13 19:32:57 +03:00
check-flake-dirty-fail-mode:
name: Check flake.lock test (dirty 😈 plus fail mode activated)
runs-on: ubuntu-22.04
if: false
2023-06-13 19:32:57 +03:00
steps:
2024-05-16 17:33:45 +03:00
- uses: actions/checkout@v4
2023-06-13 19:32:57 +03:00
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
2023-06-13 19:32:57 +03:00
- name: Check flake.lock
run: |
2023-06-21 20:08:25 +03:00
nix develop -c cargo run -- --fail-mode ./tests/flake.dirty.0.lock
2024-05-20 19:28:49 +03:00
2024-05-20 21:36:18 +03:00
build-artifacts:
name: Build artifacts
needs: checks
uses: ./.github/workflows/build.yaml
secrets: inherit
2024-05-20 19:28:49 +03:00
action-integration-test:
name: Integration test for flake-checker-action
needs: build-artifacts
runs-on: ${{ matrix.systems.runner }}
permissions:
contents: read
id-token: write
2024-05-20 21:19:57 +03:00
env:
2024-05-20 21:36:18 +03:00
ARTIFACT_KEY: flake-checker-${{ matrix.systems.system }}
2024-05-20 19:28:49 +03:00
strategy:
matrix:
systems:
- system: X64-Linux
runner: ubuntu-22.04
- system: ARM64-Linux
runner: namespace-profile-default-arm64
- system: X64-macOS
runner: macos-12
- system: ARM64-macOS
runner: macos-latest-xlarge
steps:
- uses: actions/checkout@v4
- name: Download flake-checker for ${{ matrix.systems.system }}
uses: actions/download-artifact@v4.1.7
2024-05-20 19:28:49 +03:00
with:
2024-05-20 21:36:18 +03:00
name: ${{ env.ARTIFACT_KEY }}
2024-05-20 23:41:48 +03:00
path: ${{ env.ARTIFACT_KEY }}
2024-05-20 22:41:43 +03:00
2024-05-20 23:33:42 +03:00
- name: chmod flake-checker executable on ${{ matrix.systems.system }}
run: |
2024-05-22 23:27:16 +03:00
chmod +x "${{ env.ARTIFACT_KEY }}/flake-checker"
2024-05-20 23:33:42 +03:00
2024-05-22 23:27:16 +03:00
file "${{ env.ARTIFACT_KEY }}/flake-checker"
2024-05-20 23:48:02 +03:00
- name: Test flake-checker-action@main on ${{ matrix.systems.runner }}
uses: DeterminateSystems/flake-checker-action@main
2024-05-20 19:28:49 +03:00
with:
2024-05-22 23:27:16 +03:00
source-binary: ${{ env.ARTIFACT_KEY }}/flake-checker