Skip to content

Build and test containers #116

Build and test containers

Build and test containers #116

Workflow file for this run

name: Build and test containers
on:
push:
pull_request:
branches:
- master
schedule:
# Every Sunday at 8:05 UTC
- cron: "5 8 * * 0"
concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [310, 311, 312]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Spin up container
run: |
sed -i "s/PYTHON_VERSION=.*/PYTHON_VERSION=${{ matrix.python-version }}/" '.env'
sed -i 's/PORT=.*/PORT=5002/' '.env'
echo "Building container for Python ${{ matrix.python-version }}."
cat
docker compose up -d
- name: Wait and check the health of the container
run: |
attempts=0
while [ $attempts -lt 5 ]; do
if curl http://localhost:5002; then
echo "Success!"
exit 0
fi
attempts=$((attempts+1))
sleep 1
done
echo "Failed after $attempts attempts"
exit 1