masayag is testing out bloodinfo docker-compose π #44
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' | |