File tree Expand file tree Collapse file tree 2 files changed +54
-0
lines changed
Expand file tree Collapse file tree 2 files changed +54
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Run Tests
2+
3+ on :
4+ pull_request :
5+ types : [opened, synchronize]
6+
7+ jobs :
8+ backend-test :
9+ name : Run Backend Tests
10+ runs-on : ubuntu-latest
11+ steps :
12+ - name : Checkout code
13+ uses : actions/checkout@v4
14+
15+ - name : Run Test Script
16+ run : |
17+ ./scripts/test-runner.sh
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ # This script will run the test using docker compose!
4+ # It will poll for the jury-testing container status until it has exited.
5+ # Then it will read the container logs to see if any tests have failed.
6+ # Logs will be printed to the console.
7+ # Finally, it will exit and kill the docker compose containers
8+
9+ # Start docker containers and wait a second (just for fun)
10+ # docker compose -f docker-compose.test.yml up -d
11+ # sleep 1
12+
13+ echo " Running tests..."
14+
15+ timeout=0 # Max timeout set to 60 seconds, may need to change if longer tests!
16+ while [ " $timeout " -lt 60 ]; do
17+ if [ " $( docker inspect --format ' {{.State.Status}}' jury-testing) " = " exited" ]; then
18+ break
19+ fi
20+ sleep 1
21+ done
22+
23+ # Get logs and get rid of containers
24+ logs=$( docker logs jury-testing)
25+ # docker compose -f docker-compose.test.yml down
26+
27+ # If no failed lines, exit with success
28+ failed=$( echo " $logs " | grep " failed" )
29+ if [[ -z " $failed " ]]; then
30+ echo " Success :)"
31+ exit 0
32+ fi
33+
34+ # Otherwise, exit with failure
35+ printf " $logs "
36+ printf " \n\n###################################\n##### THERE ARE TEST FAILURES #####\n###################################\n"
37+ exit 1
You can’t perform that action at this time.
0 commit comments