Skip to content

Commit

Permalink
Update ci.yml
Browse files Browse the repository at this point in the history
Iteration from ChatGPT for original script
  • Loading branch information
PrometheusFire-22 authored Nov 5, 2023
1 parent f557ddc commit b4d3e89
Showing 1 changed file with 33 additions and 13 deletions.
46 changes: 33 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
name: CI

on: [push]
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:

jobs:
test:
Expand All @@ -10,12 +17,11 @@ jobs:
postgres:
image: postgres:latest
env:
POSTGRES_DB: testdb
POSTGRES_USER: user
POSTGRES_PASSWORD: password
POSTGRES_DB: ${{ secrets.POSTGRES_DB }}
POSTGRES_USER: ${{ secrets.POSTGRES_USER }}
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }}
ports:
- 5432:5432
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
Expand All @@ -24,28 +30,42 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.8'

- name: Cache Python dependencies
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
pip install -r requirements.txt
- name: Run migrations
env:
POSTGRES_USER: user
POSTGRES_PASSWORD: password
POSTGRES_USER: ${{ secrets.POSTGRES_USER }}
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }}
POSTGRES_HOST: localhost
POSTGRES_PORT: 5432
POSTGRES_DB: testdb
POSTGRES_DB: ${{ secrets.POSTGRES_DB }}
run: |
# Run your migration scripts here
psql -h $POSTGRES_HOST -U $POSTGRES_USER -d $POSTGRES_DB -a -f path/to/your/migration_script.sql
- name: Run tests
env:
POSTGRES_USER: user
POSTGRES_PASSWORD: password
POSTGRES_USER: ${{ secrets.POSTGRES_USER }}
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }}
POSTGRES_HOST: localhost
POSTGRES_PORT: 5432
POSTGRES_DB: testdb
POSTGRES_DB: ${{ secrets.POSTGRES_DB }}
run: |
# Run your test scripts here
# Run your test scripts here, for example:
pytest

0 comments on commit b4d3e89

Please sign in to comment.