Merge pull request #119 from DeterminateSystems/integration-test

Add integration test workflow
This commit is contained in:
Luc Perkins 2024-05-22 17:54:31 -03:00 committed by GitHub
commit 4f3671e534
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 73 additions and 53 deletions

View File

@ -3,9 +3,6 @@ name: Build flake-checker artifacts
on:
workflow_call:
workflow_dispatch:
pull_request:
push:
branches: [main]
jobs:
build-artifacts:
@ -13,21 +10,23 @@ jobs:
permissions:
id-token: "write"
contents: "read"
env:
ARTIFACT_KEY: flake-checker-${{ matrix.systems.system }}
strategy:
matrix:
systems:
- nix-system: aarch64-darwin
runner: macos-latest-xlarge
artifact: flake-checker-ARM64-macOS
system: ARM64-macOS
- nix-system: x86_64-darwin
runner: macos-12
artifact: flake-checker-X64-macOS
system: X64-macOS
- nix-system: aarch64-linux
runner: namespace-profile-default-arm64
artifact: flake-checker-X64-Linux
system: ARM64-Linux
- nix-system: x86_64-linux
runner: ubuntu-22.04
artifact: flake-checker-ARM64-Linux
system: X64-Linux
steps:
- name: git checkout
uses: actions/checkout@v4
@ -40,14 +39,19 @@ jobs:
with:
use-flakehub: true
- name: Build and cache dev shell for ${{ matrix.systems.nix-system }} on ${{ matrix.systems.runner }}
run: |
nix build -L ".#devShells.${{ matrix.systems.nix-system }}.default"
- name: Build package for ${{ matrix.systems.nix-system }}
run: |
nix build -L ".#packages.${{ matrix.systems.nix-system }}.default"
cp ./result/bin/flake-checker flake-checker
- name: Upload a Build Artifact
uses: actions/upload-artifact@v3.1.2
- name: Upload flake-checker executable for ${{ matrix.systems.system }}
uses: actions/upload-artifact@v4.3.3
with:
# Artifact name
name: ${{ matrix.systems.artifact }}
path: result/bin/flake-checker
name: ${{ env.ARTIFACT_KEY }}
path: flake-checker
retention-days: 1

View File

@ -72,3 +72,49 @@ jobs:
- name: Check flake.lock
run: |
nix develop -c cargo run -- --fail-mode ./tests/flake.dirty.0.lock
build-artifacts:
name: Build artifacts
needs: checks
uses: ./.github/workflows/build.yaml
secrets: inherit
action-integration-test:
name: Integration test for flake-checker-action
needs: build-artifacts
runs-on: ${{ matrix.systems.runner }}
permissions:
contents: read
id-token: write
env:
ARTIFACT_KEY: flake-checker-${{ matrix.systems.system }}
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
with:
name: ${{ env.ARTIFACT_KEY }}
path: ${{ env.ARTIFACT_KEY }}
- name: chmod flake-checker executable on ${{ matrix.systems.system }}
run: |
chmod +x "${{ env.ARTIFACT_KEY }}/flake-checker"
file "${{ env.ARTIFACT_KEY }}/flake-checker"
- name: Test flake-checker-action@main on ${{ matrix.systems.runner }}
uses: DeterminateSystems/flake-checker-action@main
with:
source-binary: ${{ env.ARTIFACT_KEY }}/flake-checker

View File

@ -1,30 +0,0 @@
name: Push dev shell to FlakeHub Cache
on:
push:
branches: [main]
jobs:
push-dev-shell-to-flakehub-cache:
runs-on: ${{ matrix.systems.runner }}
permissions:
id-token: "write"
contents: "read"
strategy:
matrix:
systems:
- nix-system: "aarch64-darwin"
runner: "macos-latest-xlarge"
- nix-system: "x86_64-darwin"
runner: "macos-12"
- nix-system: "x86_64-linux"
runner: "ubuntu-22.04"
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
with:
use-flakehub: true
- name: Build dev shell for ${{ matrix.systems.nix-system }} on ${{ matrix.systems.runner }}
run: |
nix build .#devShells.${{ matrix.systems.nix-system }}.default

View File

@ -31,28 +31,28 @@ jobs:
- name: Create the artifacts directory
run: rm -rf ./artifacts && mkdir ./artifacts
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4.1.7
with:
name: flake-checker-ARM64-macOS
path: cache-binary-ARM64-macOS
- name: Persist the cache binary
run: cp ./cache-binary-ARM64-macOS/flake-checker ./artifacts/flake-checker-ARM64-macOS
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4.1.7
with:
name: flake-checker-X64-macOS
path: cache-binary-X64-macOS
- name: Persist the cache binary
run: cp ./cache-binary-X64-macOS/flake-checker ./artifacts/flake-checker-X64-macOS
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4.1.7
with:
name: flake-checker-X64-Linux
path: cache-binary-X64-Linux
- name: Persist the cache binary
run: cp ./cache-binary-X64-Linux/flake-checker ./artifacts/flake-checker-X64-Linux
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4.1.7
with:
name: flake-checker-ARM64-Linux
path: cache-binary-ARM64-Linux

View File

@ -35,28 +35,28 @@ jobs:
- name: Create the artifacts directory
run: rm -rf ./artifacts && mkdir ./artifacts
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4.1.7
with:
name: flake-checker-ARM64-macOS
path: cache-binary-ARM64-macOS
- name: Persist the cache binary
run: cp ./cache-binary-ARM64-macOS/flake-checker ./artifacts/flake-checker-ARM64-macOS
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4.1.7
with:
name: flake-checker-X64-macOS
path: cache-binary-X64-macOS
- name: Persist the cache binary
run: cp ./cache-binary-X64-macOS/flake-checker ./artifacts/flake-checker-X64-macOS
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4.1.7
with:
name: flake-checker-X64-Linux
path: cache-binary-X64-Linux
- name: Persist the cache binary
run: cp ./cache-binary-X64-Linux/flake-checker ./artifacts/flake-checker-X64-Linux
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4.1.7
with:
name: flake-checker-ARM64-Linux
path: cache-binary-ARM64-Linux

View File

@ -24,28 +24,28 @@ jobs:
- name: Create the artifacts directory
run: rm -rf ./artifacts && mkdir ./artifacts
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4.1.7
with:
name: flake-checker-ARM64-macOS
path: cache-binary-ARM64-macOS
- name: Persist the cache binary
run: cp ./cache-binary-ARM64-macOS/flake-checker ./artifacts/flake-checker-ARM64-macOS
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4.1.7
with:
name: flake-checker-X64-macOS
path: cache-binary-X64-macOS
- name: Persist the cache binary
run: cp ./cache-binary-X64-macOS/flake-checker ./artifacts/flake-checker-X64-macOS
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4.1.7
with:
name: flake-checker-X64-Linux
path: cache-binary-X64-Linux
- name: Persist the cache binary
run: cp ./cache-binary-X64-Linux/flake-checker ./artifacts/flake-checker-X64-Linux
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4.1.7
with:
name: flake-checker-ARM64-Linux
path: cache-binary-ARM64-Linux