mirror of
https://github.com/ipetkov/crane.git
synced 2024-11-27 12:36:51 +03:00
107 lines
3.2 KiB
YAML
107 lines
3.2 KiB
YAML
name: "Run test suite"
|
|
on:
|
|
pull_request:
|
|
types: [opened, synchronize, reopened]
|
|
push:
|
|
branches:
|
|
- 'master'
|
|
- 'ci*' # Allow testing CI fixes without opening a PR
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
tests-pass:
|
|
name: all systems go
|
|
runs-on: ubuntu-latest
|
|
if: ${{ always() && contains(needs.*.result, 'failure') }}
|
|
steps:
|
|
- run: exit 1
|
|
needs:
|
|
- check-dead-code
|
|
- check-fmt
|
|
- examples
|
|
- tests
|
|
|
|
tests:
|
|
strategy:
|
|
# Allow other jobs to finish building and cache properly before bailing
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
# Latest and greatest release of Nix
|
|
- install_url: https://nixos.org/nix/install
|
|
# The 22.11 branch ships with Nix 2.11.1
|
|
- install_url: https://releases.nixos.org/nix/nix-2.11.1/install
|
|
nixpkgs-override: "--override-input nixpkgs github:NixOS/nixpkgs/release-22.11"
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: cachix/install-nix-action@v20
|
|
with:
|
|
install_url: ${{ matrix.install_url }}
|
|
- uses: cachix/cachix-action@v12
|
|
with:
|
|
name: crane
|
|
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
|
|
- name: flake checks
|
|
run: nix flake check --keep-going --print-build-logs ${{ matrix.nixpkgs-override }}
|
|
- name: extra tests
|
|
run: nix develop ${{ matrix.nixpkgs-override }} --command ./extra-tests/test.sh
|
|
|
|
examples:
|
|
strategy:
|
|
# Allow other jobs to finish building and cache properly before bailing
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- os: ubuntu-latest
|
|
# Latest and greatest release of Nix
|
|
install_url: https://nixos.org/nix/install
|
|
- os: ubuntu-latest
|
|
# The 22.11 branch ships with Nix 2.11.1
|
|
install_url: https://releases.nixos.org/nix/nix-2.11.1/install
|
|
nixpkgs-override: "--override-input nixpkgs github:NixOS/nixpkgs/release-22.11"
|
|
- os: macos-12
|
|
# Latest and greatest release of Nix
|
|
install_url: https://nixos.org/nix/install
|
|
nixpkgs-override: "--override-input nixpkgs github:NixOS/nixpkgs/nixpkgs-22.11-darwin"
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: cachix/install-nix-action@v20
|
|
with:
|
|
install_url: ${{ matrix.install_url }}
|
|
- uses: cachix/cachix-action@v12
|
|
with:
|
|
name: crane
|
|
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
|
|
- name: validate examples
|
|
run: |
|
|
for f in $(find examples -maxdepth 1 -mindepth 1 -type d); do
|
|
pushd "${f}"
|
|
echo "validating ${f}"
|
|
nix flake check --print-build-logs --override-input crane ../.. ${{ matrix.nixpkgs-override }}
|
|
popd
|
|
done
|
|
|
|
check-dead-code:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: cachix/install-nix-action@v20
|
|
- uses: cachix/cachix-action@v12
|
|
with:
|
|
name: deadnix
|
|
- name: check for dead code
|
|
run: nix run github:astro/deadnix -- .
|
|
|
|
check-fmt:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: cachix/install-nix-action@v20
|
|
- name: check formatting
|
|
run: nix fmt -- --check .
|