Skip to content

Commit 3256299

Browse files
committed
Add GH action to run tests
1 parent 6ceb980 commit 3256299

File tree

1 file changed

+71
-0
lines changed

1 file changed

+71
-0
lines changed

.github/workflows/tests.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
workflow_dispatch: # Allow manual triggering
9+
10+
jobs:
11+
test:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v3
16+
with:
17+
fetch-depth: 0 # Fetch all history for git-related tests
18+
19+
- name: Set up environment
20+
run: |
21+
sudo apt-get update
22+
sudo apt-get install -y bc tap-tap
23+
24+
- name: Make scripts executable
25+
run: |
26+
chmod +x context
27+
chmod +x test/test_runner.sh
28+
chmod +x test/unit/test_*.sh
29+
30+
- name: Run tests
31+
run: |
32+
./test/test_runner.sh
33+
34+
- name: Run tests with TAP formatter (for nicer output)
35+
if: always() # Run even if the previous step failed
36+
run: |
37+
./test/test_runner.sh | tap-tap
38+
39+
lint:
40+
runs-on: ubuntu-latest
41+
42+
steps:
43+
- uses: actions/checkout@v3
44+
45+
- name: Shell script linting
46+
run: |
47+
sudo apt-get update
48+
sudo apt-get install -y shellcheck
49+
shellcheck context
50+
shellcheck test/test_runner.sh
51+
shellcheck test/test_utils.sh
52+
shellcheck test/unit/test_*.sh
53+
54+
compatibility:
55+
runs-on: ${{ matrix.os }}
56+
strategy:
57+
matrix:
58+
os: [ubuntu-latest, macos-latest]
59+
60+
steps:
61+
- uses: actions/checkout@v3
62+
63+
- name: Make scripts executable
64+
run: |
65+
chmod +x context
66+
chmod +x test/test_runner.sh
67+
chmod +x test/unit/test_*.sh
68+
69+
- name: Run tests on ${{ matrix.os }}
70+
run: |
71+
./test/test_runner.sh

0 commit comments

Comments
 (0)