Skip to content

Commit 3fab8e7

Browse files
classabbyampthe-maldridge
authored andcommitted
.github/workflows: add workflows for linting nomad and terraform formatting
1 parent 6dce82f commit 3fab8e7

File tree

2 files changed

+86
-0
lines changed

2 files changed

+86
-0
lines changed

.github/workflows/nomad-lint.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Lint Nomad files
2+
on:
3+
workflow_dispatch:
4+
pull_request:
5+
branches:
6+
- master
7+
paths:
8+
- services/nomad/**.nomad
9+
push:
10+
branches:
11+
- master
12+
paths:
13+
- services/nomad/**.nomad
14+
15+
concurrency:
16+
group: ${{ github.workflow }}-${{ github.ref }}
17+
cancel-in-progress: true
18+
19+
jobs:
20+
lint:
21+
name: Lint Nomad files
22+
runs-on: ubuntu-latest
23+
container:
24+
image: ghcr.io/void-linux/void-glibc
25+
steps:
26+
- name: Prepare container
27+
run: |
28+
xbps-install -Syu xbps && xbps-install -y void-repo-nonfree && \
29+
xbps-install -Syu && xbps-install -y nomad bash git
30+
31+
- name: Checkout repo
32+
uses: classabbyamp/treeless-checkout-action@v1
33+
34+
- name: Run Lints
35+
run: |
36+
rv=0
37+
printf "\033[1m=> Checking formatting of nomad files\033[0m\n"
38+
nomad fmt -check -recursive services/nomad || rv=1
39+
if [ "$rv" -ne 0 ]; then
40+
printf "\033[1m=> Some nomad files need formatting! Run 'nomad fmt' on the listed files. \033[0m\n"
41+
fi
42+
exit "$rv"
43+
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Lint Terraform files
2+
on:
3+
workflow_dispatch:
4+
pull_request:
5+
branches:
6+
- master
7+
paths:
8+
- terraform/**.tf
9+
push:
10+
branches:
11+
- master
12+
paths:
13+
- terraform/**.tf
14+
15+
concurrency:
16+
group: ${{ github.workflow }}-${{ github.ref }}
17+
cancel-in-progress: true
18+
19+
jobs:
20+
lint:
21+
name: Lint Terraform files
22+
runs-on: ubuntu-latest
23+
container:
24+
image: ghcr.io/void-linux/void-glibc
25+
steps:
26+
- name: Prepare container
27+
run: |
28+
xbps-install -Syu xbps && xbps-install -y void-repo-nonfree && \
29+
xbps-install -Syu && xbps-install -y terraform bash git
30+
31+
- name: Checkout repo
32+
uses: classabbyamp/treeless-checkout-action@v1
33+
34+
- name: Run Lints
35+
run: |
36+
rv=0
37+
printf "\033[1m=> Checking formatting of terraform files\033[0m\n"
38+
terraform fmt -check -recursive terraform || rv=1
39+
if [ "$rv" -ne 0 ]; then
40+
printf "\033[1m=> Some terraform files need formatting! Run 'terraform fmt' on the listed files. \033[0m\n"
41+
fi
42+
exit "$rv"
43+

0 commit comments

Comments
 (0)