configuration.nix/.github/workflows/check.yml

70 lines
2.1 KiB
YAML
Raw Normal View History

2024-01-14 17:59:46 +01:00
name: Check flake
on:
push:
branches: [main]
path:
- ./**.nix
- ./flake.lock
2024-01-14 17:59:46 +01:00
pull_request:
# scheduled runs are run on my own infrastructure
# schedule:
# - cron: 5 4 * * 5 # At 04:05 on Friday.
2024-01-14 17:59:46 +01:00
jobs:
check:
2024-07-29 09:52:42 +02:00
runs-on: ubuntu-latest
container:
image: ghcr.io/lix-project/lix:latest
2024-01-14 17:59:46 +01:00
steps:
2024-02-02 15:13:08 +01:00
- uses: actions/checkout@v4
2024-07-29 09:52:42 +02:00
- name: Enable flakes
run: echo 'experimental-features = nix-command flakes' >> ~/.config/nix/nix.conf
- uses: DeterminateSystems/magic-nix-cache-action@v7
2024-01-14 17:59:46 +01:00
- name: Run `nix flake check`
2024-05-20 14:14:11 +02:00
run: |
2024-07-29 09:52:42 +02:00
nix flake check --verbose --keep-going
2024-05-20 14:14:11 +02:00
nix run nixpkgs#statix -- check .
2024-01-14 17:59:46 +01:00
lockfile:
2024-07-29 09:52:42 +02:00
runs-on: ubuntu-latest
container:
image: ghcr.io/lix-project/lix:latest
2024-01-14 17:59:46 +01:00
needs: check
if: ${{ github.event_name == 'schedule' }} # only run when scheduled
steps:
2024-02-02 15:13:08 +01:00
- uses: actions/checkout@v4
2024-07-29 09:52:42 +02:00
- name: Enable flakes
run: echo 'experimental-features = nix-command flakes' >> ~/.config/nix/nix.conf
- uses: DeterminateSystems/update-flake-lock@v23
2024-01-14 17:59:46 +01:00
- name: Run `nix flake check`
2024-07-29 09:52:42 +02:00
run: nix flake check --verbose --keep-going
build-documentation:
runs-on: ubuntu-latest
2024-07-29 09:52:42 +02:00
container:
image: ghcr.io/lix-project/lix:latest
if: ${{ github.event_name != 'schedule' }} # only run when not scheduled
steps:
2024-07-29 09:52:42 +02:00
- uses: actions/checkout@v4
- name: Enable flakes
run: echo 'experimental-features = nix-command flakes' >> ~/.config/nix/nix.conf
- uses: DeterminateSystems/magic-nix-cache-action@v7
- name: Build documentation
run: nix build .#docs --print-build-logs
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./result
deploy:
runs-on: ubuntu-latest
needs: build-documentation
2024-02-18 17:04:46 +01:00
if: ${{ github.event_name == 'push' }} # only run on main branch
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
2024-03-09 00:05:05 +01:00
uses: actions/deploy-pages@v4