CI: Try running tests in containers #1196 #818
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
name: Automated tests | |
on: | |
push: | |
branches: | |
- 'v*' | |
- 'development' | |
- 'work-in-progress/*' # Future TODO: Remove me | |
- 'feature/ci-tests-in-docker' # Future TODO: Remove me | |
pull_request: | |
branches-ignore: | |
- 'dependabot/' | |
jobs: | |
# The most verbose and complete job. | |
main_test: | |
name: 'Python ${{ matrix.python-version }}' | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 # Don't run forever when stale | |
strategy: | |
matrix: | |
python-version: | |
- '3.11' # @TODO: Bump me to 3.12 later | |
env: | |
# Do not log verbosely | |
DSMRREADER_LOGLEVEL: ERROR | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build docker image(s) for TESTS | |
run: | | |
ln -s provisioning/container/compose.test.yml compose.yml | |
docker-compose build | |
- name: Check flake8 | |
run: | | |
cd $GITHUB_WORKSPACE/src/ | |
poetry run flake8 | |
- name: Run SQLite tests | |
run: docker compose run -e DJANGO_DATABASE_ENGINE=django.db.backends.sqlite3 -it tests-dsmr-app poetry run pytest --cov --cov-report=html | |
- name: Run PostgreSQL tests | |
run: docker compose run -it tests-dsmr-app poetry run pytest --cov --cov-report=html |