lsls #1273
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: Django application | |
on: [push] | |
jobs: | |
docker_build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build docker | |
run: docker compose build | |
- name: Run ruff | |
run: docker compose run django ruff check styleguide_example/ | |
- name: Run mypy | |
run: docker compose run django mypy --config mypy.ini styleguide_example/ | |
- name: Run tests | |
run: docker compose run django py.test | |
build: | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:latest | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_DB: github_actions | |
ports: | |
- 5432:5432 | |
# 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@v4 | |
- run: ls | |
- uses: ./.github/workflows/python_and_pip/action.yml" | |
with: | |
python-version: 3.12.4 | |
- name: Run ruff | |
run: ruff check . | |
- name: Type check | |
run: mypy --config mypy.ini styleguide_example/ | |
- name: Run tests | |
run: pytest | |
deploy_to_heroku: | |
runs-on: ubuntu-latest | |
needs: build | |
# The project is currently hosted on render.com | |
if: false | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: "0" | |
- name: Deploy to Heroku | |
env: | |
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }} | |
HEROKU_APP_NAME: "hacksoft-styleguide-example" | |
run: git push --force https://heroku:[email protected]/$HEROKU_APP_NAME.git origin/master:master |