mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-03-30 18:01:52 +00:00
ci: consolidate 'check' type workflows into one
This commit is contained in:
parent
df1b3f7968
commit
7a78edac81
6 changed files with 128 additions and 141 deletions
56
.github/workflows/check-docs.yml
vendored
56
.github/workflows/check-docs.yml
vendored
|
@ -1,56 +0,0 @@
|
|||
name: "Validate flake & check documentation"
|
||||
on:
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- docs/**
|
||||
jobs:
|
||||
flake-docs-check:
|
||||
name: Validate Flake Documentation
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
package:
|
||||
- docs
|
||||
- docs-html
|
||||
- docs-manpages
|
||||
- docs-json
|
||||
steps:
|
||||
- name: Install Nix
|
||||
uses: DeterminateSystems/nix-installer-action@main
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set default git branch (to reduce log spam)
|
||||
run: git config --global init.defaultBranch main
|
||||
|
||||
- name: Build documentation packages
|
||||
run: nix build .#${{ matrix.package }} --print-build-logs
|
||||
|
||||
- name: Get current date
|
||||
id: get-date
|
||||
# output format: 2023-12-22-120000
|
||||
run: echo "date=$(date +'%Y-%m-%d-%H%M%S')" >> ${GITHUB_OUTPUT}
|
||||
|
||||
- name: Upload doc artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: "${{ matrix.package }}"
|
||||
path: result/share/doc/nvf
|
||||
|
||||
flake-docs-linkcheck:
|
||||
name: Validate hyperlinks in documentation sources
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Install Nix
|
||||
uses: DeterminateSystems/nix-installer-action@main
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Build documentation packages
|
||||
run: nix build .#docs-linkcheck -Lv
|
127
.github/workflows/check.yml
vendored
127
.github/workflows/check.yml
vendored
|
@ -1,4 +1,6 @@
|
|||
name: "Validate flake & check formatting"
|
||||
name: "Treewide Checks"
|
||||
permissions: read-all
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
|
@ -6,13 +8,13 @@ on:
|
|||
branches:
|
||||
- main
|
||||
paths-ignore:
|
||||
- .github/**
|
||||
- assets/**
|
||||
- .gitignore
|
||||
|
||||
jobs:
|
||||
nix-flake-check:
|
||||
name: Validate Flake
|
||||
name: "Validate flake"
|
||||
runs-on: ubuntu-latest
|
||||
if: "!contains(github.event.pull_request.title, '[skip ci]')"
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
@ -24,8 +26,9 @@ jobs:
|
|||
run: nix flake check
|
||||
|
||||
format-with-alejandra:
|
||||
name: Formatting via Alejandra
|
||||
name: "Check formatting"
|
||||
runs-on: ubuntu-latest
|
||||
if: "!contains(github.event.pull_request.title, '[skip ci]')"
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
@ -33,4 +36,116 @@ jobs:
|
|||
- name: Install Nix
|
||||
uses: DeterminateSystems/nix-installer-action@main
|
||||
|
||||
- run: nix run nixpkgs#alejandra -- -c .
|
||||
- name: Check formatting via Alejandra
|
||||
run: nix run nixpkgs#alejandra -- -c .
|
||||
|
||||
check-typos:
|
||||
name: "Check source tree for typos"
|
||||
runs-on: ubuntu-latest
|
||||
if: "!contains(github.event.pull_request.title, '[skip ci]')"
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Check for typos
|
||||
uses: crate-ci/typos@master
|
||||
with:
|
||||
config: .github/typos.toml
|
||||
|
||||
- if: ${{ failure() }}
|
||||
shell: bash
|
||||
run: |
|
||||
echo "::error:: Current codebase contains typos that were caught by the CI!"
|
||||
echo "If those typos were intentional, please add them to the ignored regexes in .github/typos.toml"
|
||||
echo "[skip ci] label may be added to the PR title if this is a one-time issue and is safe to ignore"
|
||||
exit 1
|
||||
|
||||
flake-docs-check:
|
||||
name: "Validate documentation builds"
|
||||
runs-on: ubuntu-latest
|
||||
if: "!contains(github.event.pull_request.title, '[skip ci]')"
|
||||
strategy:
|
||||
matrix:
|
||||
package:
|
||||
- docs
|
||||
- docs-html
|
||||
- docs-manpages
|
||||
- docs-json
|
||||
steps:
|
||||
- name: Install Nix
|
||||
uses: DeterminateSystems/nix-installer-action@main
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set default git branch (to reduce log spam)
|
||||
run: git config --global init.defaultBranch main
|
||||
|
||||
- name: Build documentation packages
|
||||
run: nix build .#${{ matrix.package }} --print-build-logs
|
||||
|
||||
- name: Get current date
|
||||
id: get-date
|
||||
# output format: 2023-12-22-120000
|
||||
run: echo "date=$(date +'%Y-%m-%d-%H%M%S')" >> ${GITHUB_OUTPUT}
|
||||
|
||||
- name: Upload doc artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: "${{ matrix.package }}"
|
||||
path: result/share/doc/nvf
|
||||
|
||||
flake-docs-linkcheck:
|
||||
name: "Validate hyperlinks in documentation sources"
|
||||
runs-on: ubuntu-latest
|
||||
if: "!contains(github.event.pull_request.title, '[skip ci]')"
|
||||
steps:
|
||||
- name: Install Nix
|
||||
uses: DeterminateSystems/nix-installer-action@main
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Build linkcheck package
|
||||
run: nix build .#docs-linkcheck -Lv
|
||||
|
||||
check-editorconfig:
|
||||
name: "Validate Editorconfig conformance"
|
||||
runs-on: ubuntu-latest
|
||||
if: "!contains(github.event.pull_request.title, '[skip ci]')"
|
||||
steps:
|
||||
- name: Get list of changed files from PR
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
gh api \
|
||||
repos/${{ github.repository }}/pulls/${{github.event.number}}/files --paginate \
|
||||
| jq '.[] | select(.status != "removed") | .filename' \
|
||||
> "$HOME/changed_files"
|
||||
|
||||
- name: Print list of changed files
|
||||
run: |
|
||||
cat "$HOME/changed_files"
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: refs/pull/${{ github.event.pull_request.number }}/merge
|
||||
|
||||
- name: Install Nix
|
||||
uses: DeterminateSystems/nix-installer-action@main
|
||||
|
||||
- name: Checking EditorConfig
|
||||
shell: bash
|
||||
run: |
|
||||
cat "$HOME/changed_files" | nix-shell -p editorconfig-checker.out \
|
||||
--run 'xargs -r editorconfig-checker -disable-indentation -exclude flake.lock --verbose'
|
||||
echo -n "Check status: $?"
|
||||
|
||||
- if: ${{ failure() }}
|
||||
shell: bash
|
||||
run: |
|
||||
echo "::error:: Current formatting does not fit convention provided by .editorconfig located in the project root."
|
||||
echo "Please make sure your editor properly integrates editorconfig, Neovim does so by default."
|
||||
echo "See https://editorconfig.org/#download on how to integrate Editorconfig to your editor."
|
||||
exit 1
|
||||
|
|
6
.github/workflows/cleanup.yml
vendored
6
.github/workflows/cleanup.yml
vendored
|
@ -1,9 +1,13 @@
|
|||
name: Cleanup
|
||||
name: Delete Stale Branches
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: "0 4 1 * *" # 4AM on 1st of every month
|
||||
- cron: "0 4 15 * *" # 4AM on the 15th of every month
|
||||
|
||||
jobs:
|
||||
branches:
|
||||
name: Cleanup old branches
|
||||
|
|
4
.github/workflows/docs-preview.yml
vendored
4
.github/workflows/docs-preview.yml
vendored
|
@ -9,7 +9,7 @@ on:
|
|||
- "modules/**"
|
||||
- "docs/**"
|
||||
|
||||
# Defining permissions here passes it to all workflows.
|
||||
# Defining permissions here passes it to all jobs.
|
||||
# https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/controlling-permissions-for-github_token
|
||||
permissions:
|
||||
contents: write
|
||||
|
@ -34,7 +34,7 @@ jobs:
|
|||
run: git config --global init.defaultBranch main
|
||||
|
||||
- name: Build documentation packages
|
||||
run: nix build .#docs-html --print-build-logs
|
||||
run: nix build .#docs-html --print-build-logs || exit 1
|
||||
|
||||
- name: Deploy to GitHub Pages preview
|
||||
run: |
|
||||
|
|
46
.github/workflows/editorconfig.yml
vendored
46
.github/workflows/editorconfig.yml
vendored
|
@ -1,46 +0,0 @@
|
|||
name: "Check validity of .editorconfig"
|
||||
|
||||
permissions: read-all
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
check-editorconfig:
|
||||
runs-on: ubuntu-latest
|
||||
if: "!contains(github.event.pull_request.title, '[skip ci]')"
|
||||
steps:
|
||||
- name: Get list of changed files from PR
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
gh api \
|
||||
repos/notashelf/nvf/pulls/${{github.event.number}}/files --paginate \
|
||||
| jq '.[] | select(.status != "removed") | .filename' \
|
||||
> "$HOME/changed_files"
|
||||
|
||||
- name: Print list of changed files
|
||||
run: |
|
||||
cat "$HOME/changed_files"
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: refs/pull/${{ github.event.pull_request.number }}/merge
|
||||
|
||||
- name: Install Nix
|
||||
uses: DeterminateSystems/nix-installer-action@main
|
||||
|
||||
- name: Checking EditorConfig
|
||||
shell: bash
|
||||
run: |
|
||||
cat "$HOME/changed_files" | nix-shell -p editorconfig-checker.out --run 'xargs -r editorconfig-checker -disable-indentation -exclude flake.lock --verbose'
|
||||
echo -n "Check status: $?"
|
||||
|
||||
- name: Fail Gracefully
|
||||
if: ${{ failure() }}
|
||||
shell: bash
|
||||
run: |
|
||||
echo "::error:: Current formatting does not fit convention provided by .editorconfig located in the project root."
|
||||
echo "Please make sure your editor properly integrates editorconfig. See https://editorconfig.org/#download for more."
|
||||
exit 1
|
30
.github/workflows/typos.yml
vendored
30
.github/workflows/typos.yml
vendored
|
@ -1,30 +0,0 @@
|
|||
name: "Check for typos in the source tree"
|
||||
|
||||
permissions: read-all
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
|
||||
jobs:
|
||||
check-typos:
|
||||
runs-on: ubuntu-latest
|
||||
if: "!contains(github.event.pull_request.title, '[skip ci]')"
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Check for typos
|
||||
uses: crate-ci/typos@master
|
||||
with:
|
||||
config: .github/typos.toml
|
||||
|
||||
- name: Fail Gracefully
|
||||
if: ${{ failure() }}
|
||||
shell: bash
|
||||
run: |
|
||||
echo "::error:: Current codebase contains typos that were caught by the CI!"
|
||||
echo "If those typos were intentional, please add them to the ignored regexes in .github/typos.toml"
|
||||
echo "[skip ci] label may be used if this is a one-time issue"
|
||||
exit 1
|
Loading…
Add table
Reference in a new issue