Skip to content

Commit

Permalink
treewide: add and apply yamllint pre-commit hook
Browse files Browse the repository at this point in the history
Link: danth#519
(cherry picked from commit d3bdbf0)
  • Loading branch information
trueNAHO committed Jan 4, 2025
1 parent 29c452a commit a81bf6a
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 8 deletions.
12 changes: 8 additions & 4 deletions .github/workflows/backport.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Derived from https://github.com/NixOS/nixpkgs/blob/2ab6f6d61630889491f86396b27a76ffb6fbc7bb/.github/workflows/backport.yml

---
# Derived from
# https://github.com/NixOS/nixpkgs/blob/2ab6f6d61630889491f86396b27a76ffb6fbc7bb/.github/workflows/backport.yml
name: Backport

on:
on: # yamllint disable-line rule:truthy
pull_request_target:
types: [closed, labeled]

Expand All @@ -16,7 +17,10 @@ jobs:
(
github.repository_owner == 'danth' &&
github.event.pull_request.merged == true &&
(github.event_name != 'labeled' || startsWith('backport', github.event.label.name))
(
github.event_name != 'labeled' ||
startsWith('backport', github.event.label.name)
)
)
steps:
Expand Down
59 changes: 56 additions & 3 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
name: Check

on:
on: # yamllint disable-line rule:truthy
push:

permissions:
Expand All @@ -16,7 +17,46 @@ jobs:

- id: get-derivations
run: |
nix flake show github:${{ github.repository }}/${{ github.event.pull_request.head.sha || github.sha }} --json | jq -rc 'to_entries | map(.key as $type | select($type == "checks" or $type == "packages") | .value | to_entries | map(.key as $arch | select($arch == "x86_64-linux" or $arch == "x86_64-darwin") | .value | to_entries | map({type: $type, arch: $arch, os: (if $arch == "x86_64-linux" then "ubuntu-24.04" else "macos-14" end), key: .key})) | flatten) | flatten | "derivations=\(.)"' >> $GITHUB_OUTPUT
nix flake show --json \
github:${{
github.repository
}}/${{
github.event.pull_request.head.sha || github.sha
}} |
jq --compact-output --raw-output '
to_entries |
map(
.key as $type |
select($type == "checks" or $type == "packages") |
.value |
to_entries |
map(
.key as $arch |
select($arch == "x86_64-linux" or $arch == "x86_64-darwin") |
.value |
to_entries |
map(
{
arch: $arch,
key: .key,
os: (
if $arch == "x86_64-linux" then
"ubuntu-24.04"
else
"macos-14"
end
),
type: $type,
}
)
) |
flatten
) |
flatten |
"derivations=\(.)"
' >> $GITHUB_OUTPUT
outputs:
derivations: ${{ steps.get-derivations.outputs.derivations }}
Expand All @@ -35,4 +75,17 @@ jobs:
steps:
- uses: DeterminateSystems/nix-installer-action@v16
- uses: DeterminateSystems/magic-nix-cache-action@v8
- run: nix -L check github:${{ github.repository }}/${{ github.event.pull_request.head.sha || github.sha }}#${{ matrix.check.type }}.${{ matrix.check.arch }}.${{ matrix.check.key }} --no-update-lock-file

- run: |
nix build --no-update-lock-file --print-build-logs \
github:${{
github.repository
}}/${{
github.event.pull_request.head.sha || github.sha
}}#${{
matrix.check.type
}}.${{
matrix.check.arch
}}.${{
matrix.check.key
}}
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
name: Docs

on:
on: # yamllint disable-line rule:truthy
push:
branches:
- master
Expand Down
1 change: 1 addition & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@
deadnix.enable = true;
statix.enable = true;
typos.enable = true;
yamllint.enable = true;
};

src = ./.;
Expand Down

0 comments on commit a81bf6a

Please sign in to comment.