Skip to content

Commit ac5fd28

Browse files
committed
Added CI and linting workflow
1 parent b01ef5f commit ac5fd28

File tree

6 files changed

+111
-0
lines changed

6 files changed

+111
-0
lines changed

.github/workflows/ci.yaml

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
---
2+
3+
name: "bashplate CI"
4+
5+
6+
on:
7+
push:
8+
paths:
9+
- "**.sh"
10+
- ".github/workflows/ci.yaml"
11+
- ".pre-commit-config.yaml"
12+
pull_request:
13+
paths:
14+
- "**.sh"
15+
- ".github/workflows/ci.yaml"
16+
- ".pre-commit-config.yaml"
17+
workflow_dispatch:
18+
19+
20+
jobs:
21+
test:
22+
name: "Run pre-commit tests"
23+
runs-on: ubuntu-latest
24+
steps:
25+
- name: "Checkout configuration"
26+
uses: actions/checkout@v3
27+
28+
- name: "Setup Python"
29+
uses: actions/setup-python@v4
30+
with:
31+
cache: 'pip'
32+
33+
- name: "Install Python tools"
34+
run: |
35+
pip install -r requirements.txt
36+
37+
- name: "Cache pre-commit environment"
38+
uses: actions/cache@v3
39+
with:
40+
path: ~/.cache/pre-commit
41+
key: pre-commit-3|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}
42+
43+
- name: "Run pre-commit tests"
44+
shell: bash
45+
run: |
46+
pre-commit run --show-diff-on-failure --color=always

.github/workflows/yamllint.yaml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
3+
name: "YAML Lint"
4+
5+
6+
on:
7+
push:
8+
paths:
9+
- "**.yaml"
10+
pull_request:
11+
paths:
12+
- "**.yaml"
13+
workflow_dispatch:
14+
15+
16+
jobs:
17+
lint:
18+
name: "Run yamllint"
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: "Checkout configuration"
22+
uses: actions/checkout@v3
23+
24+
- name: "Run yamllint"
25+
uses: ibiqlik/action-yamllint@v3

.pre-commit-config.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ repos:
1313
- "--fix=lf"
1414
- id: trailing-whitespace
1515

16+
- repo: https://github.com/adrienverge/yamllint.git
17+
rev: v1.29.0
18+
hooks:
19+
- id: yamllint
20+
1621
- repo: https://github.com/codespell-project/codespell
1722
rev: v2.2.4
1823
hooks:

.python-version

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.11

.yamllint

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
3+
extends: default
4+
5+
rules:
6+
braces:
7+
forbid: non-empty
8+
brackets:
9+
forbid: non-empty
10+
comments:
11+
require-starting-space: true
12+
ignore-shebangs: true
13+
comments-indentation: disable
14+
document-start:
15+
present: true
16+
empty-lines:
17+
max: 2
18+
indentation:
19+
spaces: 2
20+
key-duplicates: {}
21+
line-length:
22+
max: 120
23+
new-line-at-end-of-file: enable
24+
new-lines:
25+
type: unix
26+
trailing-spaces: {}
27+
truthy:
28+
allowed-values:
29+
- 'true'
30+
- 'false'
31+
- 'ON'
32+
- 'OFF'
33+
check-keys: false

requirements.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pre-commit

0 commit comments

Comments
 (0)