Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ on:
branches:
- main

concurrency:
# A retry of an older commit gets its own group.
group: build-${{ github.run_attempt == '1' && github.ref || github.run_id }}
cancel-in-progress: true

jobs:
build-verify:
name: "Build & Verify on ${{ matrix.os }}"
Expand Down
16 changes: 3 additions & 13 deletions .github/workflows/static_analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,18 @@ on:

jobs:
shellcheck:
name: ShellCheck
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-latest
- macos-latest
name: ShellCheck (ubuntu-latest)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install ShellCheck
env:
GH_TOKEN: ${{ github.token }}
run: |
os=$(uname -s | tr '[:upper:]' '[:lower:]')
arch=$(uname -m)
case "$arch" in arm64) arch=aarch64 ;; esac
version=v0.11.0
archive="shellcheck-${version}.${os}.${arch}.tar.xz"
archive="shellcheck-${version}.linux.$(uname -m).tar.xz"
gh release download "$version" --repo koalaman/shellcheck \
--pattern "$archive" --dir "$RUNNER_TEMP"
tar -xf "$RUNNER_TEMP/$archive" -C "$RUNNER_TEMP"
Expand Down
69 changes: 22 additions & 47 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ env:
BASHUNIT_NO_NETWORK: 'true'

concurrency:
group: tests-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
# A retry of an older commit gets its own group.
group: tests-${{ github.workflow }}-${{ github.run_attempt == '1' && github.ref || github.run_id }}
cancel-in-progress: true

jobs:
ubuntu:
Expand Down Expand Up @@ -117,25 +118,9 @@ jobs:
run: make test

macos:
name: "macOS - ${{ matrix.name }}"
name: macOS tests
runs-on: macos-latest
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
include:
- name: "functional"
test_path: "tests/functional/*_test.sh"
- name: "unit 1/5"
test_path: "--shard 1/5 tests/unit"
- name: "unit 2/5"
test_path: "--shard 2/5 tests/unit"
- name: "unit 3/5"
test_path: "--shard 3/5 tests/unit"
- name: "unit 4/5"
test_path: "--shard 4/5 tests/unit"
- name: "unit 5/5"
test_path: "--shard 5/5 tests/unit"
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -146,34 +131,24 @@ jobs:
run: cp .env.example .env

- name: Run Tests
run: ./bashunit --parallel --jobs 4 ${{ matrix.test_path }}

macos-acceptance:
name: "macOS - acceptance"
if: github.event_name == 'push'
runs-on: macos-latest
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
include:
- name: "1/3"
test_path: "--shard 1/3 tests/acceptance"
- name: "2/3"
test_path: "--shard 2/3 tests/acceptance"
- name: "3/3"
test_path: "--shard 3/3 tests/acceptance"
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Setup Config
run: cp .env.example .env
shell: bash
run: |
failed=0
run_shards() {
local path=$1 count=$2 shard
for ((shard = 1; shard <= count; shard++)); do
echo "::group::$path shard $shard/$count"
./bashunit --parallel --jobs 4 --shard "$shard/$count" "$path" || failed=1
echo "::endgroup::"
done
}

- name: "Run acceptance shard ${{ matrix.name }}"
run: ./bashunit --parallel --jobs 4 ${{ matrix.test_path }}
./bashunit --parallel --jobs 4 tests/functional/*_test.sh || failed=1
run_shards tests/unit 5
if [ "$GITHUB_EVENT_NAME" = push ]; then
run_shards tests/acceptance 3
fi
exit "$failed"

windows:
name: "Windows - ${{ matrix.name }}"
Expand Down
6 changes: 2 additions & 4 deletions tests/unit/project/ci_test_paths_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,8 @@ function ci_test_paths() {
# in this file green, and this file exists because CI path rot has shipped
# twice already (#960, and the coverage.yml case documented below).
#
# The floors sit under the current counts -- 18 `test_path:` keys, and 3
# distinct `tests/` references once the workflows are deduplicated (fewer than
# it looks, because most jobs share the same paths). They catch an extractor
# returning nothing, which is what rot looks like.
# The Windows matrix has nine test_path entries. The other extractor also
# reads paths from shell steps, including the macOS shards.
function test_the_extractors_still_find_the_paths_they_parse() {
assert_greater_than 8 "$(cd "$ROOT_DIR" && ci_test_paths | wc -l)"
assert_greater_than 1 "$(cd "$ROOT_DIR" && ci_referenced_test_paths | wc -l)"
Expand Down
Loading