Tests #58
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: Tests | |
on: | |
pull_request: ~ | |
push: | |
branches: [ main ] | |
# Allow job to be triggered manually. | |
workflow_dispatch: | |
# Run job each night. | |
schedule: | |
- cron: '0 3 * * *' | |
# Cancel in-progress jobs when pushing to the same branch. | |
concurrency: | |
cancel-in-progress: true | |
group: ${{ github.workflow }}-${{ github.ref }} | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup python | |
uses: actions/setup-python@v4 | |
with: | |
architecture: x64 | |
python-version: '3.10' | |
- name: Lint by pre-commit | |
run: | | |
pip install pre-commit | |
pre-commit run --all-files | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
max-parallel: 4 | |
matrix: | |
python-version: [3.7, 3.8, 3.9, '3.10', '3.11'] | |
services: | |
postgresql: | |
image: postgres:16 | |
ports: | |
- 5432:5432 | |
env: | |
POSTGRES_HOST_AUTH_METHOD: trust | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
architecture: x64 | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
pip install '.[test]' | |
- name: Run tests | |
run: | | |
pytest | |
packaging: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup python | |
uses: actions/setup-python@v4 | |
with: | |
architecture: x64 | |
python-version: '3.10' | |
- name: Build | |
run: | | |
pip install flit | |
flit build | |
ls -l dist | |
documentation: | |
runs-on: ubuntu-latest | |
services: | |
postgresql: | |
image: postgres:16 | |
ports: | |
- 5432:5432 | |
env: | |
POSTGRES_HOST_AUTH_METHOD: trust | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup python | |
uses: actions/setup-python@v4 | |
with: | |
architecture: x64 | |
python-version: '3.10' | |
- name: Build | |
run: | | |
pip install '.[docs]' | |
make -C docs html |