ci: cleanup all workflows (#71)

* ci: merge test-vm and format workflows

* ci: don't use matrix for doc gen

* ci: use inputs from dev flake
This commit is contained in:
seth 2024-01-11 16:47:25 -05:00 committed by GitHub
parent 3de3278dc3
commit aeb0dcbf6a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 81 additions and 80 deletions

51
.github/workflows/ci.yml vendored Normal file
View file

@ -0,0 +1,51 @@
name: CI
on:
push:
branches: [main]
paths:
- '**.lock'
- '**.nix'
pull_request:
workflow_dispatch:
jobs:
format:
name: Check formatting
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- name: Install Nix
uses: cachix/install-nix-action@v24
- name: Run formatter
run: |
nix run --inputs-from ./dev nixpkgs#nixpkgs-fmt -- .
- name: Check for changes
run: git diff --color=always --exit-code
vm:
name: Test Modules
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- name: Install Nix
uses: cachix/install-nix-action@v24
- name: Setup cache
uses: DeterminateSystems/magic-nix-cache-action@v2
- name: Run VM
run: |
nix build -L --show-trace ./dev#checks.x86_64-linux.module-vm-test

View file

@ -1,24 +0,0 @@
name: Format
on:
push:
branches: [main]
pull_request:
jobs:
format-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v24
- name: Run formatter
run: |
pushd dev/
nix fmt
popd
- name: Check for changes
run: git diff --color=always --exit-code

View file

@ -1,4 +1,4 @@
name: release
name: Release
on:
push:
@ -6,6 +6,7 @@ on:
jobs:
release-please:
name: Make release
runs-on: ubuntu-latest
permissions:

View file

@ -1,35 +0,0 @@
name: Test modules
on:
push:
paths:
- '_sources/**'
- 'modules/**'
- 'test.nix'
- 'flake.*'
- 'dev/flake.*'
pull_request:
paths:
- '_sources/**'
- 'modules/**'
- 'test.nix'
- 'flake.*'
- 'dev/flake.*'
workflow_dispatch:
jobs:
run-vm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v24
with:
extra_nix_config: "system-features = benchmark big-parallel kvm nixos-test uid-range"
- uses: DeterminateSystems/magic-nix-cache-action@main
- name: Run VM
run: |
nix build -Lv ./dev#checks.x86_64-linux.module-vm-test

View file

@ -2,44 +2,50 @@ name: Update docs
on:
push:
branches: [main]
paths:
- "modules/home-manager/**"
- "modules/nixos/**"
workflow_dispatch:
jobs:
update-docs:
update:
name: Run update
runs-on: ubuntu-latest
permissions:
contents: write
strategy:
max-parallel: 1
matrix:
package: ["nixos", "home-manager"]
# we only want this running on our repo, on the `main` branch
if: github.repository == 'Stonks3141/ctp-nix' && github.ref_name == 'main'
# we only want this running on our repo
if: github.repository == 'Stonks3141/ctp-nix'
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v24
- name: Install Nix
uses: cachix/install-nix-action@v24
- name: Set Git user info
run: |
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
- name: Get short revision
id: rev
run:
echo "rev=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"
- name: Build doc
- name: Build & update docs
run: |
nix build ./dev#${{ matrix.package }}-doc
- name: Update doc
run: cat result > docs/${{ matrix.package }}-options.md
for module in "nixos" "home-manager"; do
nix build -L --show-trace ./dev#"$module"-doc
cat result > docs/"$module"-options.md
rm result
done
- name: Commit changes
uses: EndBug/add-and-commit@v9
with:
default_author: github_actions
message: "docs: update docs for ${{ steps.rev.outputs.rev }}"
run: |
if ! git diff --color=always --exit-code; then
git commit -am "docs: update for ${{ steps.rev.outputs.rev }}"
git push
fi

View file

@ -13,7 +13,9 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v24
- name: Install Nix
uses: cachix/install-nix-action@v24
- name: Set Git user info
run: |
@ -41,7 +43,7 @@ jobs:
- name: Update upstream sources
run: |
nix run --inputs-from . nixpkgs#nvfetcher
nix run --inputs-from ./dev nixpkgs#nvfetcher
if ! git diff --color=always --exit-code; then
git commit -am "chore: update nvfetcher sources"