Add typecheck
and tests
build steps
#1287
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 | |
lint_and_format: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/workflows/python_and_pip | |
- name: Run ruff linter | |
run: ruff check . | |
- name: Run ruff format checker | |
run: ruff format --check | |
typecheck: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/workflows/python_and_pip | |
- name: Type check | |
run: mypy --config mypy.ini styleguide_example/ | |
tests: | |
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 | |
- uses: ./.github/workflows/python_and_pip | |
- name: Run tests | |
run: pytest | |
deploy_to_heroku: | |
runs-on: ubuntu-latest | |
needs: [lint_and_format, typecheck, tests] | |
# The project is currently not hosted anywhere | |
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 |