[pre-commit.ci] auto fixes from pre-commit.com hooks #198
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: Workflow to run code style checkers and tests | |
on: [push] | |
env: | |
PYTHON_VERSION: "3.10" | |
POETRY_VERSION: "1.1.13" | |
OS: ubuntu-latest | |
jobs: | |
code-style: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Prepare python environment | |
# Use the location in the repository (without action.yml) | |
uses: ./.github/actions/prepare-environment | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
poetry-version: ${{ env.POETRY_VERSION }} | |
- name: Reactivate poetry environment | |
run: | | |
poetry env use ${{ env.PYTHON_VERSION }} | |
- name: Run formatters | |
uses: pre-commit/action@v3.0.0 | |
with: | |
extra_args: --all-files | |
test: | |
runs-on: ubuntu-latest | |
# https://gist.github.com/jefftriplett/d35e120ef9884bcff61c5ade0740f52d | |
services: | |
postgres: | |
image: postgres | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres # pragma: allowlist secret | |
POSTGRES_DB: postgres | |
ports: [ '5432:5432' ] | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Prepare python environment | |
# Use the location in the repository (without action.yml) | |
uses: ./.github/actions/prepare-environment | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
poetry-version: ${{ env.POETRY_VERSION }} | |
- name: Reactivate poetry environment | |
run: | | |
poetry env use ${{ env.PYTHON_VERSION }} | |
- name: Run tests and generates coverage report | |
env: | |
# The hostname used to communicate with the PostgreSQL service container | |
POSTGRES_HOST: postgres | |
# The default PostgreSQL port | |
POSTGRES_PORT: 5432 | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres # pragma: allowlist secret | |
POSTGRES_DB: postgres | |
run: | | |
make test | |
pwd && ls | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
fail_ci_if_error: true # optional (default = false) | |
verbose: true # optional (default = false) | |
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos |