-
Notifications
You must be signed in to change notification settings - Fork 0
115 lines (108 loc) · 2.83 KB
/
Copy pathscripts.yml
File metadata and controls
115 lines (108 loc) · 2.83 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
name: Shell scripts
on:
push:
branches:
- main
- master
paths:
- "install"
- "setup"
- "profile/.bashrc_append"
- "profile/bashrc.d/**"
- "profile/*.sh"
- "utils/*.sh"
- "tmuxifiers/*.sh"
- "tests/**"
- "tests/check-function-syntax.sh"
- "tests/run-ci-checks.sh"
- ".github/workflows/scripts.yml"
pull_request:
branches:
- main
- master
paths:
- "install"
- "setup"
- "profile/.bashrc_append"
- "profile/bashrc.d/**"
- "profile/*.sh"
- "utils/*.sh"
- "tmuxifiers/*.sh"
- "tests/**"
- "tests/check-function-syntax.sh"
- "tests/run-ci-checks.sh"
- ".github/workflows/scripts.yml"
workflow_dispatch:
permissions:
contents: read
jobs:
syntax:
name: Bash syntax
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: bash -n
run: |
files=(
install
setup
profile/.bashrc_append
profile/bashrc.d/*.bash
profile/*.sh
utils/*.sh
tmuxifiers/*.sh
tests/bashrc-smoke.sh
tests/lib/assert.sh
)
bash -n "${files[@]}"
function-syntax:
name: Function syntax
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check function syntax convention
run: bash tests/check-function-syntax.sh
smoke:
name: Smoke tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run smoke tests
run: bash tests/bashrc-smoke.sh
shellcheck:
name: ShellCheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install shellcheck
run: sudo apt-get update && sudo apt-get install -y shellcheck
- name: Lint shell files
run: |
# Refactored files only; expand scope as install/setup/utils are cleaned up
files=(
profile/.bashrc_append
profile/bashrc.d/*.bash
tests/bashrc-smoke.sh
tests/lib/assert.sh
)
shellcheck -x "${files[@]}"
shfmt:
name: shfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install shfmt
run: |
SHFMT_VERSION="v3.10.0"
curl -sS -L "https://github.com/mvdan/sh/releases/download/${SHFMT_VERSION}/shfmt_${SHFMT_VERSION}_linux_amd64" -o /usr/local/bin/shfmt
chmod +x /usr/local/bin/shfmt
- name: Check formatting
run: |
# Refactored files only; expand scope as install/setup/utils are cleaned up
files=(
profile/.bashrc_append
profile/bashrc.d/*.bash
tests/bashrc-smoke.sh
tests/lib/assert.sh
)
shfmt -i 2 -d "${files[@]}"