name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
name: "Build Package"
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@main
with:
extra-conf: |
system-features = nixos-test benchmark big-parallel kvm
- name: Setup Magic Nix Cache
uses: DeterminateSystems/magic-nix-cache-action@main
- name: Build sshbind package
run: nix build -L --show-trace
- name: Build static checks (pre-build for integration tests)
run: |
# Determine the system based on OS
if [ "${{ matrix.os }}" = "ubuntu-latest" ]; then
SYSTEM="x86_64-linux"
else
SYSTEM="aarch64-darwin"
fi
# Build common dependencies that integration tests need
nix build .#checks.$SYSTEM.sshbind -L --show-trace
nix build .#checks.$SYSTEM.sshbind-clippy -L --show-trace
nix build .#checks.$SYSTEM.sshbind-fmt -L --show-trace
static-checks:
name: "${{ matrix.check }} on ${{ matrix.os }}"
runs-on: ${{ matrix.os }}
needs: build
strategy:
matrix:
os: [ubuntu-latest]
check: [sshbind-audit, sshbind-deny, sshbind-doc, pre-commit-check]
fail-fast: false
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@main
- name: Setup Magic Nix Cache
uses: DeterminateSystems/magic-nix-cache-action@main
- name: Run Check - ${{ matrix.check }}
run: |
# Determine the system based on OS
if [ "${{ matrix.os }}" = "ubuntu-latest" ]; then
SYSTEM="x86_64-linux"
else
SYSTEM="aarch64-darwin"
fi
echo "Running check on system: $SYSTEM"
nix build .#checks.$SYSTEM.${{ matrix.check }} -L --show-trace
nixos-integration-tests:
name: "NixOS Integration Test - ${{ matrix.test }} on ${{ matrix.os }}"
runs-on: ${{ matrix.os }}
needs: build
strategy:
matrix:
os: [ubuntu-latest]
test: [simple, cli, performance]
fail-fast: false
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@main
with:
extra-conf: |
system-features = nixos-test benchmark big-parallel kvm
- name: Setup Magic Nix Cache
uses: DeterminateSystems/magic-nix-cache-action@main
- name: Run NixOS Integration Test - ${{ matrix.test }}
run: |
# Determine the system based on OS
if [ "${{ matrix.os }}" = "ubuntu-latest" ]; then
SYSTEM="x86_64-linux"
else
SYSTEM="aarch64-darwin"
fi
echo "Running test on system: $SYSTEM"
# The binary should already be cached from the build job
nix build .#checks.$SYSTEM.${{ matrix.test }} -L --show-trace
flake-check:
name: "Flake Check"
runs-on: ${{ matrix.os }}
needs: [build, static-checks, nixos-integration-tests]
strategy:
matrix:
os: [ubuntu-latest]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@main
with:
extra-conf: |
system-features = nixos-test benchmark big-parallel kvm
- name: Setup Magic Nix Cache
uses: DeterminateSystems/magic-nix-cache-action@main
- name: Run flake check (should use cached builds)
run: nix flake check -L --show-trace