Update dependency opis/closure to v4 (#268) #383
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test shell | |
on: | |
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: | |
strategy: | |
matrix: | |
os: | |
- ubuntu-latest | |
- ubuntu-20.04 | |
- ubuntu-22.04 | |
- macos-13 | |
- macos-14 | |
- macos-15 | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Install current Bash on macOS | |
if: startsWith(matrix.os, 'macos-') | |
run: brew install bash | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Setup sh-checker | |
uses: luizm/action-sh-checker@v0.9.0 | |
if: matrix.os == 'ubuntu-latest' | |
env: | |
SHFMT_OPTS: -i 2 -ci -s -d | |
continue-on-error: ${{ vars.CI_LINT_IGNORE_FAILURE == '1' }} | |
- name: Install dependencies | |
run: npm ci | |
working-directory: tests/bats | |
- name: Install Kcov | |
run: wget https://github.com/SimonKagstrom/kcov/releases/download/v42/kcov-amd64.tar.gz && tar -xf kcov-amd64.tar.gz && sudo mv ./usr/local/bin/kcov /usr/local/bin/kcov && kcov --version | |
if: matrix.os == 'ubuntu-latest' | |
- name: Run Tests and Code Coverage on Ubuntu | |
if: matrix.os == 'ubuntu-latest' | |
run: kcov --include-pattern=.sh,.bash --bash-parse-files-in-dir=. --exclude-pattern=vendor,node_modules,.coverage-html,docs,tests "$(pwd)"/.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@v4 | |
with: | |
name: ${{github.job}}-code-coverage-report | |
include-hidden-files: true | |
path: ./.coverage-html | |
if-no-files-found: error | |
- name: Upload coverage report to Codecov | |
uses: codecov/codecov-action@v5 | |
if: ${{ env.CODECOV_TOKEN != '' && matrix.os == 'ubuntu-latest' }} | |
with: | |
directory: ./.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@v3 | |
timeout-minutes: 5 |