Skip to content

chore(docs): migrate to bashunit.com (#715) #30

chore(docs): migrate to bashunit.com (#715)

chore(docs): migrate to bashunit.com (#715) #30

Workflow file for this run

name: Test action
on:
pull_request:
paths:
- 'action.yml'
- 'install.sh'
- '.github/workflows/test-action.yml'
push:
branches:
- main
concurrency:
group: test-action-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
permissions:
contents: read
jobs:
test-action:
name: "Install via action - ${{ matrix.os }}"
runs-on: ${{ matrix.os }}
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- name: Install bashunit via the action
id: bashunit
uses: ./
with:
version: latest
directory: vendor/bashunit
- name: Verify the binary is installed and runnable
env:
BASHUNIT_PATH: ${{ steps.bashunit.outputs.path }}
BASHUNIT_INSTALLED_VERSION: ${{ steps.bashunit.outputs.version }}
run: |
set -euo pipefail
test -x "$BASHUNIT_PATH"
test -n "$BASHUNIT_INSTALLED_VERSION"
# add-to-path defaults to true, so "bashunit" resolves on PATH
bashunit --version
run-via-args:
name: "Run via args input"
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- name: Write a passing and a failing sample test
run: |
mkdir -p sample_tests
printf 'function test_passes() { assert_same "1" "1"; }\n' > sample_tests/pass_test.sh
printf 'function test_fails() { assert_same "1" "2"; }\n' > sample_tests/fail_test.sh
- name: Run only the passing test via args (step should pass)
uses: ./
with:
directory: vendor/bashunit
args: sample_tests/pass_test.sh
- name: Run the failing test via args (expected to fail the step)
id: failing
continue-on-error: true
uses: ./
with:
directory: vendor/bashunit
add-to-path: 'false'
args: sample_tests/fail_test.sh
- name: Assert the failing run actually executed and failed
env:
OUTCOME: ${{ steps.failing.outcome }}
run: |
set -euo pipefail
# If args were ignored (install-only), the step would have succeeded.
test "$OUTCOME" = "failure"