From 63b6a6c507e4e93f186f98146a0969b8c4548733 Mon Sep 17 00:00:00 2001 From: d4x1 <1507509064@qq.com> Date: Sat, 23 Mar 2024 15:46:14 +0800 Subject: [PATCH] add postgres db --- .github/workflows/demo.yaml | 2 +- .github/workflows/python-app.yml | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/.github/workflows/demo.yaml b/.github/workflows/demo.yaml index 15a61d6..a461c2c 100644 --- a/.github/workflows/demo.yaml +++ b/.github/workflows/demo.yaml @@ -1,6 +1,6 @@ name: GitHub Actions Demo run-name: ${{ github.actor }} is testing out GitHub Actions 🚀 -on: [push] +on: [] jobs: Explore-GitHub-Actions: runs-on: ubuntu-latest diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index 2e796e9..0aa6a0d 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -10,6 +10,27 @@ on: jobs: My-Job-Name: runs-on: ubuntu-latest + + services: + # Label used to access the service container + postgres: + # Docker Hub image + image: postgres:15.6 + # Provide the password for postgres + env: + POSTGRES_DB: ace_the_exam + POSTGRES_USER: acetheexam + POSTGRES_PASSWORD: acetheexam + # Set health checks to wait until postgres has started +# options: >- +# --health-cmd pg_isready +# --health-interval 10s +# --health-timeout 5s +# --health-retries 5 +# ports: +# # Maps tcp port 5432 on service container to the host +# - 5432:5432 + steps: - uses: actions/checkout@v4 @@ -29,6 +50,8 @@ jobs: pip install -r requirements.txt - name: Test with pytest + env: + E2E_DB_URL: postgres://acetheexam:acetheexam@db:5432/ace_the_exam run: | python manage.py test python manage.py check