Skip to content

Commit

Permalink
ci: cleanup all workflows (#71)
Browse files Browse the repository at this point in the history
* ci: merge test-vm and format workflows

* ci: don't use matrix for doc gen

* ci: use inputs from dev flake
  • Loading branch information
getchoo authored Jan 11, 2024
1 parent 3de3278 commit aeb0dcb
Show file tree
Hide file tree
Showing 6 changed files with 81 additions and 80 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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
24 changes: 0 additions & 24 deletions .github/workflows/format.yml

This file was deleted.

3 changes: 2 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
name: release
name: Release

on:
push:
branches: [main]

jobs:
release-please:
name: Make release
runs-on: ubuntu-latest

permissions:
Expand Down
35 changes: 0 additions & 35 deletions .github/workflows/test-vm.yml

This file was deleted.

42 changes: 24 additions & 18 deletions .github/workflows/update-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 4 additions & 2 deletions .github/workflows/update-lock.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit aeb0dcb

Please sign in to comment.