Use docker-compose for Github CI workflow #539
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: Test | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
unit-tests: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ['3.10'] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build using Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
pip3 install pdm | |
pdm self update | |
pdm install | |
- name: Run black | |
run: | | |
pdm run black --check --diff recap/ tests/ | |
- name: Run isort | |
run: | | |
pdm run isort recap/ tests/ --check-only --diff | |
- name: Run autoflake | |
run: | | |
pdm run autoflake --check-diff --remove-unused-variables --remove-all-unused-imports --recursive recap/ tests/ | |
- name: Run pylint | |
run: | | |
pdm run pylint --fail-under=7.0 recap/ tests/ | |
- name: Run pyright | |
run: | | |
pdm run pyright | |
- name: Test with pytest | |
run: | | |
pdm run unit | |
integration-tests: | |
runs-on: ubuntu-latest | |
needs: unit-tests | |
strategy: | |
matrix: | |
python-version: ['3.10'] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Docker Compose Up | |
uses: isbang/compose-action@v1.5.1 | |
with: | |
compose-file: tests/docker-compose.yml | |
- name: Build using Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
pip3 install pdm | |
pdm self update | |
pdm install | |
- name: Test with pytest | |
env: | |
RECAP_URLS: '["postgresql://postgres:password@localhost:5432/testdb"]' | |
run: | | |
pdm run integration | |
- name: Docker Compose Down | |
uses: isbang/compose-action@v1.5.1 | |
with: | |
compose-file: tests/docker-compose.yml | |
spec-tests: | |
runs-on: ubuntu-latest | |
needs: integration-tests | |
strategy: | |
matrix: | |
python-version: ['3.10'] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build using Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
pip3 install pdm | |
pdm self update | |
pdm install | |
- name: Test spec with pytest | |
run: | | |
pdm run spec |