forked from sstephenson/bats
-
Notifications
You must be signed in to change notification settings - Fork 3
209 lines (195 loc) · 6.89 KB
/
tests.yml
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
name: Tests
# Controls when the action will run.
on: [push, pull_request, workflow_dispatch]
jobs:
changelog:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Check that PR is mentioned in Changelog
run: |
if ! ./.github/workflows/check_pr_label.sh "${{github.event.pull_request.number}}" "no changelog"; then
grep "#${{github.event.pull_request.number}}" docs/CHANGELOG.md
fi
if: ${{github.event.pull_request}}
shellcheck:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Run shellcheck
run: |
sudo apt-get update -y
sudo apt-get install shellcheck
./shellcheck.sh
linux:
strategy:
matrix:
os: ['ubuntu-20.04', 'ubuntu-22.04']
env_vars:
- ''
# allow for some parallelity without GNU parallel, since it is not installed by default
- 'BATS_NO_PARALLELIZE_ACROSS_FILES=1 BATS_NUMBER_OF_PARALLEL_JOBS=2'
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Run test on OS ${{ matrix.os }}
shell: 'script -q -e -c "bash {0}"' # work around tty issues
env:
TERM: linux # fix tput for tty issue work around
run: |
bash --version
bash -c "time ${{ matrix.env_vars }} bin/bats --print-output-on-failure --formatter tap test"
unset_variables:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Check unset variables
shell: 'script -q -e -c "bash {0}"' # work around tty issues
env:
TERM: linux # fix tput for tty issue work around
BASH_ENV: ${GITHUB_WORKSPACE}/.github/workflows/set_nounset.bash
run: bin/bats test --print-output-on-failure
npm_on_linux:
strategy:
matrix:
os: ['ubuntu-20.04', 'ubuntu-22.04']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- name: Run test on OS ${{ matrix.os }}
shell: 'script -q -e -c "bash {0}"' # work around tty issues
env:
TERM: linux # fix tput for tty issue work around
run: |
npm pack ./
sudo npm install -g ./bats-*.tgz
bats test
windows:
runs-on: windows-2019
steps:
- uses: actions/checkout@v2
- run: |
bash --version
bash -c "time bin/bats --print-output-on-failure --formatter tap test"
npm_on_windows:
strategy:
matrix:
os: ['windows-2019']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- run: npm pack ./
- run: npm install -g (get-item .\bats-*.tgz).FullName
- run: bats -T --print-output-on-failure test
macos:
strategy:
matrix:
os: ['macos-11', 'macos-12']
env_vars:
- ''
# allow for some parallelity without GNU parallel, since it is not installed by default
- 'BATS_NO_PARALLELIZE_ACROSS_FILES=1 BATS_NUMBER_OF_PARALLEL_JOBS=2'
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Install unbuffer via expect
run: brew install expect
- name: Run test on OS ${{ matrix.os }}
shell: 'unbuffer bash {0}' # work around tty issues
env:
TERM: linux # fix tput for tty issue work around
run: |
bash --version
bash -c "time ${{ matrix.env_vars }} bin/bats --print-output-on-failure --formatter tap test"
npm_on_macos:
strategy:
matrix:
os: ['macos-11', 'macos-12']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- name: Install unbuffer via expect
run: brew install expect
- name: Run test on OS ${{ matrix.os }}
shell: 'unbuffer bash {0}' # work around tty issues
env:
TERM: linux # fix tput for tty issue work around
run: |
npm pack ./
# somehow there is already an installed bats version around
npm install --force -g ./bats-*.tgz
bats --print-output-on-failure test
bash-version:
strategy:
matrix:
version: ['3.2', '4.0', '4.1', '4.2', '4.3', '4.4', '4', '5.0', '5.1', '5', 'latest']
env_vars:
- ''
# also test running (recursively!) in parallel
- '-e BATS_NUMBER_OF_PARALLEL_JOBS=2'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run test on bash version ${{ matrix.version }}
shell: 'script -q -e -c "bash {0}"' # work around tty issues
run: |
set -e
docker build --build-arg bashver="${{ matrix.version }}" --tag "bats/bats:bash-${{ matrix.version }}" .
docker run -it "bash:${{ matrix.version }}" --version
time docker run -it ${{ matrix.env_vars }} "bats/bats:bash-${{ matrix.version }}" --print-output-on-failure --tap /opt/bats/test
alpine:
runs-on: ubuntu-latest
container: alpine:latest
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: apk add bash ncurses util-linux
- name: Run test on bash version ${{ matrix.version }}
shell: 'script -q -e -c "bash {0}"' # work around tty issues
env:
TERM: linux # fix tput for tty issue work around
run:
time ./bin/bats --print-output-on-failure test/
freebsd:
runs-on: macos-12
strategy:
matrix:
packages:
- flock
- ""
steps:
- uses: actions/checkout@v2
- uses: vmactions/freebsd-vm@v0
with:
prepare: pkg install -y bash parallel ${{ matrix.packages }}
run: |
time ./bin/bats --print-output-on-failure test/
find_broken_symlinks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# list symlinks that are broken and force non-zero exit if there are any
- run: "! find . -xtype l | grep ."
rpm:
runs-on: ubuntu-latest
container: almalinux:8
steps:
- uses: actions/checkout@v2
- run: dnf install -y rpm-build rpmdevtools
- name: Build and install RPM and dependencies
run: |
rpmdev-setuptree
version=$(rpmspec -q --qf '%{version}' contrib/rpm/bats.spec)
tar --transform "s,^,bats-core-${version}/," -cf /github/home/rpmbuild/SOURCES/v${version}.tar.gz ./
rpmbuild -v -bb ./contrib/rpm/bats.spec
ls -al /github/home/rpmbuild/RPMS/noarch/
dnf install -y /github/home/rpmbuild/RPMS/noarch/bats-*.rpm
dnf -y install procps-ng # avoid timeout failure
- name: Run tests
shell: 'script -q -e -c "bash {0}"' # work around tty issues
env:
TERM: linux # fix tput for tty issue work around
run: bats --print-output-on-failure --filter-tags !dep:install_sh test/