-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (51 loc) · 1.7 KB
/
Copy pathtests.yml
File metadata and controls
60 lines (51 loc) · 1.7 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
name: Tests
on:
push:
branches:
- main
pull_request:
jobs:
validate:
name: Validate (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- macos-latest
- ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install validation tools (macOS)
if: runner.os == 'macOS'
run: |
brew install bash bats-core shellcheck
echo "$(brew --prefix bash)/bin" >> "$GITHUB_PATH"
- name: Install validation tools (Linux)
if: runner.os == 'Linux'
run: sudo apt-get install -y bats shellcheck
- name: Validate repository
run: ./tests/validate.sh
- name: Smoke supported runner Bash
run: |
bash -c '
source "$1"
check_bash_version
' bash "$PWD/lib/bash/std/lib_std.sh"
# Hosted runners do not provide Bash 4.2 directly. The BATS suite covers
# the lower-bound comparison logic; this macOS smoke exercises the known
# unsupported system Bash 3.2 path when it is available.
- name: Smoke unsupported macOS system Bash
if: runner.os == 'macOS'
run: |
if ! /bin/bash -c '((BASH_VERSINFO[0] < 4 || (BASH_VERSINFO[0] == 4 && BASH_VERSINFO[1] < 2)))'; then
echo "/bin/bash is supported on this runner; skipping unsupported-Bash smoke."
exit 0
fi
set +e
output="$(/bin/bash -c 'source "$1"' bash "$PWD/lib/bash/std/lib_std.sh" 2>&1)"
status=$?
set -e
test "$status" -ne 0
grep -F "requires Bash 4.2 or higher" <<<"$output"
! grep -F "syntax error" <<<"$output"