-
Notifications
You must be signed in to change notification settings - Fork 410
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #405 from bats-core/martin-schulze-vireso-patch-1
Add Github Actions for tests
- Loading branch information
Showing
11 changed files
with
214 additions
and
130 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
name: Tests | ||
|
||
# Controls when the action will run. | ||
on: [push, pull_request, workflow_dispatch] | ||
|
||
jobs: | ||
shellcheck: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Run shellcheck | ||
run: | | ||
sudo apt-get update -y | ||
sudo apt-get install shellcheck | ||
./shellcheck.sh | ||
linux: | ||
strategy: | ||
matrix: | ||
os: ['ubuntu-20.04', 'ubuntu-18.04', 'ubuntu-16.04'] | ||
env_vars: | ||
- '' | ||
# allow for some parallelity without GNU parallel, since it is not installed by default | ||
- 'BATS_NO_PARALLELIZE_ACROSS_FILES=1 BATS_NUMBER_OF_PARALLEL_JOBS=2' | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Run test on OS ${{ matrix.os }} | ||
shell: 'script -q -e -c "bash {0}"' # work around tty issues | ||
env: | ||
TERM: linux # fix tput for tty issue work around | ||
run: | | ||
bash --version | ||
bash -c "time ${{ matrix.env_vars }} bin/bats --formatter tap test" | ||
windows: | ||
strategy: | ||
matrix: | ||
os: ['windows-2019'] | ||
env_vars: | ||
- '' | ||
# allow for some parallelity without GNU parallel, since it is not installed by default | ||
- 'BATS_NO_PARALLELIZE_ACROSS_FILES=1 BATS_NUMBER_OF_PARALLEL_JOBS=2' | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Run test on OS ${{ matrix.os }} | ||
run: | | ||
bash --version | ||
bash -c "time ${{ matrix.env_vars }} bin/bats --formatter tap test" | ||
macos: | ||
strategy: | ||
matrix: | ||
os: ['macos-10.15'] | ||
env_vars: | ||
- '' | ||
# allow for some parallelity without GNU parallel, since it is not installed by default | ||
- 'BATS_NO_PARALLELIZE_ACROSS_FILES=1 BATS_NUMBER_OF_PARALLEL_JOBS=2' | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Install unbuffer via expect | ||
run: brew install expect | ||
- name: Run test on OS ${{ matrix.os }} | ||
shell: 'unbuffer bash {0}' # work around tty issues | ||
env: | ||
TERM: linux # fix tput for tty issue work around | ||
run: | | ||
bash --version | ||
bash -c "time ${{ matrix.env_vars }} bin/bats --formatter tap test" | ||
bash-version: | ||
strategy: | ||
matrix: | ||
version: ['3.2', '4.0', '4.1', '4.2', '4.3', '4.4', '4', '5.0', '5.1', '5', 'latest'] | ||
env_vars: | ||
- '' | ||
# also test running (recursively!) in parallel | ||
- '-e BATS_NUMBER_OF_PARALLEL_JOBS=2' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Run test on bash version ${{ matrix.version }} | ||
shell: 'script -q -e -c "bash {0}"' # work around tty issues | ||
run: | | ||
set -e | ||
docker build --build-arg bashver="${{ matrix.version }}" --tag "bats/bats:bash-${{ matrix.version }}" . | ||
docker run -it "bash:${{ matrix.version }}" --version | ||
time docker run -it ${{ matrix.env_vars }} "bats/bats:bash-${{ matrix.version }}" --tap /opt/bats/test | ||
This file was deleted.
Oops, something went wrong.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# block until at least <barrier-size> processes of this barrier group entered the barrier | ||
# once this happened, all latecomers will go through immediately! | ||
# WARNING: a barrier group consists of all processes with the same barrier name *and* size! | ||
single-use-barrier() { # <barrier-name> <barrier-size> [<timeout-in-seconds> [<sleep-cycle-time>]] | ||
local barrier_name="$1" | ||
local barrier_size="$2" | ||
local timeout_in_seconds="${3:-0}" | ||
local sleep_cycle_time="${3:-1}" | ||
# use name and size to distinguish between invocations | ||
# this will block inconsistent sizes on the same name! | ||
local BARRIER_SUFFIX=${barrier_name//\//_}-$barrier_size | ||
local BARRIER_FILE="$BATS_RUN_TMPDIR/barrier-$BARRIER_SUFFIX" | ||
# mark our entry for all others | ||
echo "in-$$" >> "$BARRIER_FILE" | ||
local start="$SECONDS" | ||
# wait for others to enter | ||
while [[ $(wc -l <"$BARRIER_FILE" ) -lt $barrier_size ]]; do | ||
if [[ $timeout_in_seconds -ne 0 && $(( SECONDS - start )) -gt $timeout_in_seconds ]]; then | ||
mv "$BARRIER_FILE" "$BARRIER_FILE-timeout" | ||
printf "ERROR: single-use-barrier %s timed out\n" "$BARRIER_SUFFIX" >&2 | ||
return 1 | ||
fi | ||
sleep "$sleep_cycle_time" | ||
done | ||
# mark our exit | ||
echo "out-$$" >> "$BARRIER_FILE" | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,20 @@ | ||
@test "slow test 1" { | ||
sleep 3s | ||
} | ||
|
||
@test "slow test 2" { | ||
sleep 3s | ||
} | ||
|
||
@test "slow test 3" { | ||
sleep 3s | ||
} | ||
|
||
@test "slow test 4" { | ||
sleep 3s | ||
setup() { | ||
load 'helper' | ||
echo "start $BATS_TEST_NAME $BATS_TEST_FILENAME" >> "$FILE_MARKER" | ||
} | ||
|
||
@test "slow test 5" { | ||
sleep 3s | ||
teardown() { | ||
echo "stop $BATS_TEST_NAME $BATS_TEST_FILENAME" >> "$FILE_MARKER" | ||
} | ||
|
||
@test "slow test 6" { | ||
sleep 3s | ||
} | ||
|
||
@test "slow test 7" { | ||
sleep 3s | ||
} | ||
|
||
@test "slow test 8" { | ||
sleep 3s | ||
@test "slow test 1" { | ||
single-use-barrier "parallel" $PARALLELITY | ||
} | ||
|
||
@test "slow test 9" { | ||
sleep 3s | ||
@test "slow test 2" { | ||
single-use-barrier "parallel" $PARALLELITY | ||
} | ||
|
||
@test "slow test 10" { | ||
sleep 3s | ||
} | ||
@test "slow test 3" { | ||
single-use-barrier "parallel" $PARALLELITY | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../helper.bash |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../helper.bash |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ setup() { | |
} | ||
|
||
@test "skip in setup" { | ||
true | ||
false | ||
} | ||
|
||
@test "skip in setup and test" { | ||
|
Oops, something went wrong.