Skip to content

Commit 5346004

Browse files
committed
Adds all tests to github actions
1 parent c86161b commit 5346004

File tree

2 files changed

+44
-10
lines changed

2 files changed

+44
-10
lines changed

.github/workflows/simple-test.yml

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ on:
77
branches: [ main, master, v* ]
88

99
jobs:
10-
test:
10+
# Simple multi-platform test
11+
simple-test:
1112
strategy:
1213
matrix:
1314
os: [ubuntu-latest, macos-latest, windows-latest]
@@ -58,4 +59,30 @@ jobs:
5859
if: runner.os == 'Windows'
5960
shell: msys2 {0}
6061
run: bash test/simple.test.sh
62+
63+
# Comprehensive Docker-based tests (all cross-platform targets)
64+
docker-tests:
65+
runs-on: ubuntu-latest
66+
timeout-minutes: 120 # Docker tests can take a while
67+
68+
steps:
69+
- name: Checkout code
70+
uses: actions/checkout@v4
71+
72+
- name: Set up Docker Buildx
73+
uses: docker/setup-buildx-action@v3
74+
75+
- name: Enable Docker experimental features
76+
run: |
77+
set -e
78+
echo '{"experimental": true}' | sudo tee /etc/docker/daemon.json
79+
sudo systemctl restart docker
80+
# Verify Docker is working after restart
81+
docker --version
82+
docker info > /dev/null
83+
84+
- name: Run comprehensive test suite
85+
run: |
86+
cd test
87+
bash all.test.sh
6188

test/all.test.sh

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ echo "========================"
1010

1111
# Get the directory where this script is located
1212
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
13-
cd "$SCRIPT_DIR"
13+
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
14+
cd "$PROJECT_ROOT"
1415

1516
# Initialize counters
1617
passed=0
@@ -19,14 +20,20 @@ total_tests=0
1920

2021
echo "Searching for test files ending with '.test.sh'..."
2122

22-
# Use find with proper handling and avoid command injection
23-
while IFS= read -r -d '' test_file; do
24-
# Skip this script itself
25-
if [[ "$(basename "$test_file")" == "all.test.sh" ]]; then
23+
# Find and run test files using a simple compatible approach
24+
for test_file in test/*.test.sh; do
25+
26+
# Skip if no files match the pattern
27+
if [[ ! -f "$test_file" ]]; then
28+
continue
29+
fi
30+
31+
# Skip this script itself to prevent infinite recursion
32+
if [[ "$(basename "$test_file")" == "$(basename "${BASH_SOURCE[0]}")" ]]; then
2633
continue
2734
fi
2835

29-
((total_tests++))
36+
total_tests=$((total_tests + 1))
3037

3138
echo "Running: $test_file"
3239
echo "----------------------------------------"
@@ -41,14 +48,14 @@ while IFS= read -r -d '' test_file; do
4148
# while keeping tests isolated from each other and the main script
4249
if ( source "$test_file" ); then
4350
echo "✓ PASSED: $test_file"
44-
((passed++))
51+
passed=$((passed + 1))
4552
else
4653
echo "✗ FAILED: $test_file"
47-
((failed++))
54+
failed=$((failed + 1))
4855
fi
4956
echo ""
5057

51-
done < <(find . -maxdepth 1 -name '*.test.sh' -type f -print0)
58+
done
5259

5360
if [[ "$total_tests" -eq 0 ]]; then
5461
echo "No test files found ending with '.test.sh'"

0 commit comments

Comments
 (0)