Merge pull request #251 from alan-turing-institute/examples #456
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: "Unit tests" | |
on: | |
push: | |
branches: [main, develop, test-actions] | |
pull_request: | |
branches: [main, develop] | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.10", "3.11", "3.12"] | |
env: | |
DT_SQL_TESTHOST: "localhost" | |
DT_SQL_TESTUSER: "postgres" | |
DT_SQL_TESTPASS: "postgres" | |
DT_SQL_TESTDBNAME: "test_db" | |
DT_SQL_TESTPORT: "5432" | |
DT_DEFAULT_USER_PASS: "password" | |
DT_JWT_SECRET_KEY: "this is a very random secret key" | |
steps: | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
architecture: x64 | |
- uses: actions/checkout@v3 | |
- uses: harmon758/postgresql-action@v1 | |
with: | |
postgresql version: "11" | |
postgresql db: cropdb | |
postgresql user: postgres | |
postgresql password: postgres | |
- run: git submodule update --init --recursive | |
- run: pip install .[dev] | |
- run: | | |
export PYTHONPATH=$PYTHONPATH:$(pwd) | |
pytest --cov -vv | |
- name: Upload coverage reports to Codecov | |
run: | | |
curl -Os https://uploader.codecov.io/latest/linux/codecov | |
chmod +x codecov | |
./codecov -t ${CODECOV_TOKEN} |