-
Notifications
You must be signed in to change notification settings - Fork 0
50 lines (40 loc) · 1.89 KB
/
Copy pathci.yml
File metadata and controls
50 lines (40 loc) · 1.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
name: ci
on:
push:
branches: [main]
pull_request:
jobs:
lint-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
# Every tool is pinned. Distribution packages move independently of this
# repository, and a linter that changes under CI turns an unrelated push
# into a red build: shellcheck in particular renames and renumbers its
# findings between releases, so a suppression comment that is correct
# locally is not necessarily the code CI reports.
- name: Install pinned shellcheck, shfmt and bats
run: |
set -euo pipefail
SHELLCHECK_VERSION=v0.11.0
SHFMT_VERSION=v3.13.1
BATS_VERSION=v1.12.0
curl -fsSL "https://github.com/koalaman/shellcheck/releases/download/${SHELLCHECK_VERSION}/shellcheck-${SHELLCHECK_VERSION}.linux.x86_64.tar.xz" \
| tar -xJ --strip-components=1 -C /tmp "shellcheck-${SHELLCHECK_VERSION}/shellcheck"
sudo install -m 0755 /tmp/shellcheck /usr/local/bin/shellcheck
sudo curl -fsSL -o /usr/local/bin/shfmt \
"https://github.com/mvdan/sh/releases/download/${SHFMT_VERSION}/shfmt_${SHFMT_VERSION}_linux_amd64"
sudo chmod +x /usr/local/bin/shfmt
git clone --depth 1 --branch "${BATS_VERSION}" https://github.com/bats-core/bats-core /tmp/bats-core
sudo /tmp/bats-core/install.sh /usr/local
shellcheck --version
shfmt --version
bats --version
# Kept in step with hooks/run-checks.sh, which runs the same three checks
# over the same files before a commit lands.
- name: shellcheck
run: shellcheck -x -s bash muster install.sh lib/*.sh drivers/*.sh docker/*.sh examples/*/*.sh
- name: shfmt (diff)
run: shfmt -d -i 2 -ci -bn muster install.sh lib drivers docker/*.sh examples/*/*.sh
- name: bats
run: bats test/