Skip to content

Commit 73f3e5f

Browse files
authored
Merge pull request #64 from attogram/feat/ci-test-workflow
feat: Set up GitHub workflow to run tests on PRs
2 parents c354435 + 2e75d66 commit 73f3e5f

File tree

6 files changed

+288
-139
lines changed

6 files changed

+288
-139
lines changed

.github/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# GitHub Workflows
2+
3+
This directory contains the GitHub Actions workflows for this project.
4+
5+
## Workflows
6+
7+
- **`create.release.for.tag.yml`**: This workflow automates the process of creating a new GitHub release whenever a new tag is pushed to the repository. It generates release notes based on the commit history since the last tag.
8+
9+
- **`run-tests.yml`**: This workflow runs the project's test suite on every pull request to the `main` branch. This ensures that all changes are verified before being merged.

.github/workflows/run-tests.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Run Tests
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
8+
jobs:
9+
test:
10+
name: Run test suite
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@v4
16+
17+
- name: Install dependencies
18+
run: sudo apt-get update && sudo apt-get install -y bc
19+
20+
- name: Run tests
21+
run: |
22+
chmod +x jury/render-the-verdict.sh
23+
./jury/render-the-verdict.sh

jury/render-the-verdict.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,11 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
55
# Run the setup script.
66
"${SCRIPT_DIR}/assemble-the-jury.sh"
77

8+
# cd into the jury directory to run the tests.
9+
cd "${SCRIPT_DIR}" || exit 1
10+
811
# Run the bats tests with pretty output.
9-
"${SCRIPT_DIR}/test_libs/bats-core-1.12.0/bin/bats" --pretty "${SCRIPT_DIR}" > "${SCRIPT_DIR}/verdict.txt"
12+
"test_libs/bats-core-1.12.0/bin/bats" --pretty . > "verdict.txt"
1013

1114
# Run the bats tests with TAP output.
12-
"${SCRIPT_DIR}/test_libs/bats-core-1.12.0/bin/bats" --tap "${SCRIPT_DIR}" > "${SCRIPT_DIR}/verdict.tap"
15+
"test_libs/bats-core-1.12.0/bin/bats" --tap . > "verdict.tap"

jury/verdict.tap

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
1..54
2+
not ok 1 alpha: should be executable
3+
# (from function `assert' in file ./test_libs/bats-assert-2.2.0/src/assert.bash, line 40,
4+
# in test file ./alpha.bats, line 9)
5+
# `assert [ -x "$SCRIPT" ]' failed
6+
#
7+
# -- assertion failed --
8+
# expression : [ -x gallery/alpha/alpha.sh ]
9+
# --
10+
#
11+
ok 2 alpha: runs without errors for 1 second
12+
ok 3 beta screensaver runs
13+
not ok 4 bouncing: should be executable
14+
# (from function `assert' in file ./test_libs/bats-assert-2.2.0/src/assert.bash, line 40,
15+
# in test file ./bouncing.bats, line 9)
16+
# `assert [ -x "$SCRIPT" ]' failed
17+
#
18+
# -- assertion failed --
19+
# expression : [ -x gallery/bouncing/bouncing.sh ]
20+
# --
21+
#
22+
not ok 5 bouncing: runs without errors for 1 second
23+
# (from function `assert_success' in file ./test_libs/bats-assert-2.2.0/src/assert_success.bash, line 45,
24+
# in test file ./bouncing.bats, line 14)
25+
# `assert_success' failed
26+
#
27+
# -- command failed --
28+
# status : 127
29+
# output : timeout: failed to run command ‘gallery/bouncing/bouncing.sh’: No such file or directory
30+
# --
31+
#
32+
not ok 6 cutesaver: main script should be executable
33+
# (from function `assert' in file ./test_libs/bats-assert-2.2.0/src/assert.bash, line 40,
34+
# in test file ./cutesaver.bats, line 9)
35+
# `assert [ -x "$SCRIPT" ]' failed
36+
#
37+
# -- assertion failed --
38+
# expression : [ -x gallery/cutesaver/cutesaver.sh ]
39+
# --
40+
#
41+
not ok 7 cutesaver: runs without errors for 1 second
42+
# (from function `assert_success' in file ./test_libs/bats-assert-2.2.0/src/assert_success.bash, line 45,
43+
# in test file ./cutesaver.bats, line 14)
44+
# `assert_success' failed
45+
#
46+
# -- command failed --
47+
# status : 127
48+
# output : timeout: failed to run command ‘gallery/cutesaver/cutesaver.sh’: No such file or directory
49+
# --
50+
#
51+
not ok 8 fireworks: should be executable
52+
# (from function `assert' in file ./test_libs/bats-assert-2.2.0/src/assert.bash, line 40,
53+
# in test file ./fireworks.bats, line 9)
54+
# `assert [ -x "$SCRIPT" ]' failed
55+
#
56+
# -- assertion failed --
57+
# expression : [ -x gallery/fireworks/fireworks.sh ]
58+
# --
59+
#
60+
not ok 9 fireworks: runs without errors for 1 second
61+
# (from function `assert_success' in file ./test_libs/bats-assert-2.2.0/src/assert_success.bash, line 45,
62+
# in test file ./fireworks.bats, line 14)
63+
# `assert_success' failed
64+
#
65+
# -- command failed --
66+
# status : 127
67+
# output : timeout: failed to run command ‘gallery/fireworks/fireworks.sh’: No such file or directory
68+
# --
69+
#
70+
ok 10 library-of-voices: can be sourced
71+
ok 11 library-of-voices: lov_detect_engine function exists
72+
ok 12 library-of-voices: lov_say function exists
73+
ok 13 library-of-voices: lov_kill_speech function exists
74+
not ok 14 library-of-voices: lov_detect_engine sets a TTS engine
75+
# (from function `assert' in file ./test_libs/bats-assert-2.2.0/src/assert.bash, line 40,
76+
# in test file ./library-of-voices.bats, line 34)
77+
# `assert [ -n "$LOV_TTS_ENGINE" ]' failed
78+
#
79+
# -- assertion failed --
80+
# expression : [ -n ]
81+
# --
82+
#
83+
not ok 15 matrix: should be executable
84+
# (from function `assert' in file ./test_libs/bats-assert-2.2.0/src/assert.bash, line 40,
85+
# in test file ./matrix.bats, line 9)
86+
# `assert [ -x "$SCRIPT" ]' failed
87+
#
88+
# -- assertion failed --
89+
# expression : [ -x gallery/matrix/matrix.sh ]
90+
# --
91+
#
92+
not ok 16 matrix: runs without errors for 1 second
93+
# (from function `assert_success' in file ./test_libs/bats-assert-2.2.0/src/assert_success.bash, line 45,
94+
# in test file ./matrix.bats, line 14)
95+
# `assert_success' failed
96+
#
97+
# -- command failed --
98+
# status : 127
99+
# output : timeout: failed to run command ‘gallery/matrix/matrix.sh’: No such file or directory
100+
# --
101+
#
102+
not ok 17 pipes: should be executable
103+
# (from function `assert' in file ./test_libs/bats-assert-2.2.0/src/assert.bash, line 40,
104+
# in test file ./pipes.bats, line 9)
105+
# `assert [ -x "$SCRIPT" ]' failed
106+
#
107+
# -- assertion failed --
108+
# expression : [ -x gallery/pipes/pipes.sh ]
109+
# --
110+
#
111+
not ok 18 pipes: runs without errors for 1 second
112+
# (from function `assert_success' in file ./test_libs/bats-assert-2.2.0/src/assert_success.bash, line 45,
113+
# in test file ./pipes.bats, line 14)
114+
# `assert_success' failed
115+
#
116+
# -- command failed --
117+
# status : 127
118+
# output : timeout: failed to run command ‘gallery/pipes/pipes.sh’: No such file or directory
119+
# --
120+
#
121+
not ok 19 rain: should be executable
122+
# (from function `assert' in file ./test_libs/bats-assert-2.2.0/src/assert.bash, line 40,
123+
# in test file ./rain.bats, line 9)
124+
# `assert [ -x "$SCRIPT" ]' failed
125+
#
126+
# -- assertion failed --
127+
# expression : [ -x gallery/rain/rain.sh ]
128+
# --
129+
#
130+
not ok 20 rain: runs without errors for 1 second
131+
# (from function `assert_success' in file ./test_libs/bats-assert-2.2.0/src/assert_success.bash, line 45,
132+
# in test file ./rain.bats, line 14)
133+
# `assert_success' failed
134+
#
135+
# -- command failed --
136+
# status : 127
137+
# output : timeout: failed to run command ‘gallery/rain/rain.sh’: No such file or directory
138+
# --
139+
#
140+
not ok 21 smile-for-the-camera: exits if asciinema is not found
141+
# (from function `setup' in test file ./smile-for-the-camera.bats, line 5)
142+
# `chmod +x "$SCRIPT"' failed
143+
not ok 24 teardown_file failed
144+
# (from function `source' in file ./smile-for-the-camera.bats, line 39,
145+
# from function `bats_run_setup_file' in file test_libs/bats-core-1.12.0/libexec/bats-core/bats-exec-file, line 99,
146+
# from function `main' in test file test_libs/bats-core-1.12.0/libexec/bats-core/bats-exec-file, line 382)
147+
# `bats_run_setup_file' failed
148+
# bats warning: Executed 22 instead of expected 54 tests

0 commit comments

Comments
 (0)