Skip to content

Fix ci, rfs #273

Fix ci, rfs #273 #6

Workflow file for this run

name: Test Container
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:
strategy:
matrix:
python_version: ['39', '310', '311', '312']
port: [5002, 5003, 5004, 5005]
runs-on: ubuntu-latest
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Checkout Code
uses: actions/checkout@v2
- name: Spin up container
run: |
sed -i "s/PYTHON_VERSION=.*/PYTHON_VERSION=\${{ matrix.python_version }}/" .env
sed -i "s/PORT=.*/PORT=\${{ matrix.port }}/" .env
echo "Building container for Python ${{ matrix.python_version }} on port ${{ matrix.port }}."
docker compose up -d
- name: Wait and check the health of the container
run: |
attempts=0
while [ $attempts -lt 10 ]; do
if curl http://localhost:${{ matrix.port }}; then
echo "Success!"
exit 0
fi
attempts=$((attempts+1))
sleep 1
done
echo "Failed after $attempts attempts"
exit 1