Skip to content

Commit

Permalink
feat: Initial support for GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
joolean committed Feb 23, 2024
1 parent 477dbce commit f3ed6f6
Showing 1 changed file with 91 additions and 0 deletions.
91 changes: 91 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: CI

on: [push]

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry
poetry install
- name: Lint with flake8
run: poetry run flake8
- name: Lint with isort
run: poetry run isort -c .

checkmigrations:
name: Check Migrations
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry awscli
poetry install
- name: Run makemigrations --check
run: poetry run python makemigrations.py --check

test:
name: Test
runs-on: ubuntu-latest

services:
postgres:
image: postgres:12
env:
POSTGRES_DB: test_djpaypal
POSTGRES_HOST_AUTH_METHOD: trust
POSTGRES_USER: postgres
ports:
- 5432/tcp
# needed because the postgres container does not provide a healthcheck
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v1
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry
poetry install
- name: Run pytest
env:
PGPORT: ${{ job.services.postgres.ports['5432'] }}
run: poetry run pytest --ds tests.settings

release:
name: Release
needs: [checkmigrations, lint, test]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry
- name: Build
run: poetry build
- name: Deploy
run: poetry deploy

0 comments on commit f3ed6f6

Please sign in to comment.