fix pipeline #43
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: Web App CI Workflow | |
on: [push] | |
jobs: | |
run_tests: | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:16 | |
env: | |
POSTGRES_HOST_AUTH_METHOD: trust | |
ports: | |
- 5433:5432 | |
options: >- | |
--health-cmd "pg_isready -U postgres" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up Python 3.11 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
- name: Install Poetry | |
run: | | |
curl -sSL https://install.python-poetry.org | python3 - | |
echo "$HOME/.local/bin" >> $GITHUB_PATH | |
- name: Install dependencies for Web_App | |
working-directory: ./apps/web_app | |
run: | | |
echo "PATH=$HOME/.local/bin:$PATH" >> $GITHUB_ENV | |
poetry lock --no-update | |
poetry install | |
- name: Prepare Environment File | |
working-directory: ./apps/web_app | |
run: | | |
cp .env.dev .env | |
sed -i 's/DB_HOST=db/DB_HOST=127.0.0.1/' .env | |
sed -i 's/DB_PORT=5432/DB_PORT=5433/' .env | |
- name: Wait for Database to be Ready | |
run: | | |
for i in {1..30}; do | |
pg_isready -h 127.0.0.1 -p 5433 -U postgres && break || sleep 2; | |
done | |
- name: Create Test Database | |
run: | | |
PGPASSWORD=postgres psql -h 127.0.0.1 -p 5433 -U postgres -c "CREATE DATABASE web_app;" | |
- name: Run Tests for Web_App | |
working-directory: ./apps/web_app | |
run: poetry run pytest --junitxml=results.xml | |
- name: Upload Test Results | |
uses: actions/upload-artifact@v3 | |
with: | |
name: test-results | |
path: ./apps/web_app/results.xml |