-
Notifications
You must be signed in to change notification settings - Fork 1
30 lines (28 loc) · 1.03 KB
/
on_push.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
name: Build and test application on push
run-name: ${{ github.actor }} is testing out bloodinfo docker-compose 🚀
on: [push]
jobs:
build-and-test:
runs-on: ubuntu-latest
env:
POSTGRES_USER: mada
POSTGRES_PASSWORD: mada
POSTGRES_DB: bloodinfo
steps:
# need checkout before using docker-compose-action
- uses: actions/checkout@v3
- uses: adambirds/[email protected]
with:
compose-file: "docker-compose.yml"
down-flags: "--volumes --remove-orphans --rmi local"
test-container: "blood-info"
test-command: >
/bin/sh -c '
result=$(wget -q -O- --no-check-certificate https://localhost:8443/stations | jq ". | length");
if [ -n "$result" ] && [ "$result" -ne 0 ]; then
echo "Test passed: Result is not empty and not zero.";
exit 0; # Test passed
else
echo "Test failed: Result is empty or zero.";
exit 1; # Test failed
fi'