Module Tests #83
Workflow file for this run
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
# taking as reference: https://github.com/actions/starter-workflows/blob/main/ci/python-package.yml | |
name: Module Tests | |
on: [push, merge_group] | |
env: | |
PG_USER: test_user | |
PGPASSWORD: password | |
PG_DATABASE: test_database | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.10", "3.11"] | |
services: | |
postgres: | |
image: postgres:14.1-alpine | |
ports: | |
- 5432:5432 | |
env: | |
POSTGRES_USER: ${{ env.PG_USER }} | |
POSTGRES_PASSWORD: ${{ env.PGPASSWORD }} | |
POSTGRES_DB: ${{ env.PG_DATABASE }} | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Check psql mounting point | |
run: | | |
psql -h localhost -U ${{ env.PG_USER }} -d ${{ env.PG_DATABASE }} -a -f psql/init_test_db.sql | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v3 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install flake8 | |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
- name: Lint with flake8 | |
run: | | |
# stop the build if there are Python syntax errors or undefined names | |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | |
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | |
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | |
- name: Test with unittest | |
run: | | |
python -m unittest tests/test_module.py | |