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: on:
push: push:
@ -6,6 +6,7 @@ on:
jobs: jobs:
release-please: release-please:
name: Make release
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions: 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: on:
push: push:
branches: [main]
paths: paths:
- "modules/home-manager/**" - "modules/home-manager/**"
- "modules/nixos/**" - "modules/nixos/**"
workflow_dispatch: workflow_dispatch:
jobs: jobs:
update-docs: update:
name: Run update
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions: permissions:
contents: write contents: write
strategy: # we only want this running on our repo
max-parallel: 1 if: github.repository == 'Stonks3141/ctp-nix'
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'
steps: steps:
- uses: actions/checkout@v4 - 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 - name: Get short revision
id: rev id: rev
run: run:
echo "rev=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT" echo "rev=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"
- name: Build doc - name: Build & update docs
run: | run: |
nix build ./dev#${{ matrix.package }}-doc for module in "nixos" "home-manager"; do
nix build -L --show-trace ./dev#"$module"-doc
- name: Update doc cat result > docs/"$module"-options.md
run: cat result > docs/${{ matrix.package }}-options.md rm result
done
- name: Commit changes - name: Commit changes
uses: EndBug/add-and-commit@v9 run: |
with: if ! git diff --color=always --exit-code; then
default_author: github_actions git commit -am "docs: update for ${{ steps.rev.outputs.rev }}"
message: "docs: update docs for ${{ steps.rev.outputs.rev }}" git push
fi

View file

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