-
Notifications
You must be signed in to change notification settings - Fork 3
118 lines (103 loc) 路 3.68 KB
/
Copy pathtest-shell.yml
File metadata and controls
118 lines (103 loc) 路 3.68 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
116
117
118
name: Test shell
on:
# yamllint disable-line #;< SCHEDULE
schedule:
- cron: '23 4 * * *'
# yamllint disable-line #;> SCHEDULE
push:
branches:
- main
pull_request:
branches:
- main
- 'feature/**'
workflow_dispatch:
inputs:
enable_terminal:
type: boolean
description: 'Enable terminal session.'
required: false
default: false
env:
BATS_LIB_PATH: "./node_modules"
jobs:
test-shell:
name: Shell (${{ matrix.os }})
strategy:
matrix:
os:
- ubuntu-latest
- ubuntu-22.04
- ubuntu-24.04
- macos-14
- macos-15
runs-on: ${{ matrix.os }}
permissions:
contents: read
steps:
- name: Install current Bash on macOS
if: startsWith(matrix.os, 'macos-')
run: brew install bash
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
persist-credentials: false
- name: Setup Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7
with:
node-version: 24
- name: Setup sh-checker
uses: luizm/action-sh-checker@883217215b11c1fabbf00eb1a9a041f62d74c744 # v0.10.0
if: matrix.os == 'ubuntu-latest'
env:
SHFMT_OPTS: -i 2 -ci -s -d
continue-on-error: ${{ vars.CI_LINT_IGNORE_FAILURE == '1' }}
#;< META
with:
sh_checker_exclude: '.scaffold'
#;> META
- name: Install dependencies
run: npm ci
working-directory: tests/bats
- name: Install Kcov
run: |
KCOV_VERSION=v43 && \
sudo apt update && sudo apt install -y git cmake g++ libcurl4-openssl-dev zlib1g-dev libdw-dev libiberty-dev binutils-dev && \
git clone https://github.com/SimonKagstrom/kcov.git && \
cd kcov && git checkout ${KCOV_VERSION} && mkdir build && cd build && \
cmake .. && make && sudo make install && \
kcov --version
if: matrix.os == 'ubuntu-latest'
- name: Run Tests and Code Coverage on Ubuntu
if: matrix.os == 'ubuntu-latest'
run: |
mkdir -p "$(pwd)"/.logs/.coverage-html
kcov --include-pattern=.sh,.bash --bash-parse-files-in-dir=. --exclude-pattern=vendor,node_modules,.logs,docs,tests "$(pwd)"/.logs/.coverage-html ./tests/bats/node_modules/.bin/bats tests/bats
shell: bash
continue-on-error: ${{ vars.CI_TEST_IGNORE_FAILURE == '1' }}
- name: Upload coverage report as an artifact
if: matrix.os == 'ubuntu-latest'
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: ${{github.job}}-code-coverage-report
include-hidden-files: true
path: .logs/.coverage-html
if-no-files-found: error
- name: Upload coverage report to Codecov
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7
if: ${{ env.CODECOV_TOKEN != '' && matrix.os == 'ubuntu-latest' }}
with:
directory: .logs/.coverage-html
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Run Tests on other OSes
if: matrix.os != 'ubuntu-latest'
run: ./tests/bats/node_modules/.bin/bats tests/bats
shell: bash
continue-on-error: ${{ vars.CI_TEST_IGNORE_FAILURE == '1' }}
- name: Setup tmate session
if: ${{ !cancelled() && github.event.inputs.enable_terminal }}
uses: mxschmitt/action-tmate@35b54afac29c97fb54faba5b513f8fbd1882f113 # v3
timeout-minutes: 30