-
Notifications
You must be signed in to change notification settings - Fork 0
101 lines (91 loc) · 2.67 KB
/
unit-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
---
name: unit-tests
on: [push, pull_request]
jobs:
unit-tests:
defaults:
run:
shell: sh
strategy:
fail-fast: false
matrix:
os:
- ubuntu
awk:
- busybox-awk # BusyBox
- gawk
- mawk
include:
- { os: macos, awk: awk } # "Apple" awk
- { os: macos, awk: nawk }
runs-on: ${{ matrix.os }}-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Prepare system
id: prepare-system
env:
MATRIX_OS: ${{ matrix.os }}
MATRIX_AWK: ${{ matrix.awk }}
run: |
echo '::group::Install dependencies'
set -x
case ${MATRIX_OS%%-*}
in
(macos)
brew install colordiff ;;
(ubuntu)
sudo apt-get install colordiff ;;
esac
case ${MATRIX_OS%%-*}-${MATRIX_AWK}
in
(macos-awk)
echo "AWK=$(command -v awk)" >>"${GITHUB_ENV:?}"
;;
(macos-nawk)
brew install awk
echo "AWK=$(command -v awk)" >>"${GITHUB_ENV:?}"
;;
(ubuntu-gawk|ubuntu-mawk)
sudo apt-get -y install "${MATRIX_AWK}"
echo "AWK=$(command -v "${MATRIX_AWK}")" >>"${GITHUB_ENV:?}"
;;
(ubuntu-busybox-awk)
sudo apt-get -y install busybox
mkdir -p ~/.local/bin
printf >~/.local/bin/busybox-awk "#!/bin/sh\\nexec %s awk \"\$@\"\\n" "$(command -v busybox)"
chmod +x ~/.local/bin/busybox-awk
echo "AWK=$(cd ~ && pwd -P)/.local/bin/busybox-awk" >>"${GITHUB_ENV:?}"
;;
(*)
esac
echo '::endgroup::'
- name: Information
env:
MATRIX_OS: ${{ matrix.os }}
MATRIX_AWK: ${{ matrix.awk }}
AWK: ${{ env.AWK }}
run: |
echo '::group::Software versions'
printf 'Kernel:\n'
uname -a
printf '\nPATH:\n%s\n' "${PATH}"
printf '\nShell: %s\n' "${SHELL-?}"
printf '\nAWK (%s):\n' "${AWK:-?}"
case ${MATRIX_OS%%-*}-${MATRIX_AWK}
in
(macos-awk|macos-nawk|*-gawk)
"${AWK:?}" --version ;;
(*-mawk)
"${AWK:?}" -W version ;;
(*-busybox-awk)
busybox --version | sed -n -e '/^\$/q' -e 'p' ;;
(*)
printf '%s\n' ? ;;
esac
echo '::endgroup::'
- name: Run unit tests
run: |
make AWK='${{ env.AWK }}' test