Fix/test dockerization #156
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 and Checks" | |
on: | |
push: | |
branches: [master, develop] | |
pull_request: | |
branches: [master, develop] | |
workflow_dispatch: | |
jobs: | |
tests: | |
strategy: | |
matrix: | |
python: ["3.10"] #3.10 | |
runs-on: ubuntu-22.04 #ubuntu:jammy-20231004 | |
# container: "python:${{matrix.python}}-slim-buster" | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Update apt-get sources | |
run: sudo apt-get update | |
- name: Install PostgreSQL, PostGIS and GDAL | |
run: > | |
sudo apt-get install -y | |
gdal-bin | |
python3-gdal | |
postgis | |
postgresql | |
postgresql-client | |
postgresql-postgis | |
libpq-dev | |
build-essential | |
- name: Start PostgreSQL server | |
run: sudo /etc/init.d/postgresql start | |
- name: Allow runner to create PostgreSQL databases | |
run: sudo su - postgres -c "createuser --createdb runner" | |
- name: Create PostGIS extension | |
run: > | |
sudo su - postgres | |
-c "psql template1 -c 'create extension postgis'" | |
- name: Install Tox and tox-gh-actions | |
run: pip install tox tox-gh-actions | |
- name: Test with Tox | |
run: tox | |
- name: Upload coverage data to codecov.io | |
uses: codecov/codecov-action@v3 | |
test-dockerization: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Docker | |
uses: docker/setup-buildx-action@v1 | |
- name: Build Docker image of the app | |
run: docker compose build | |
- name: Copy default configuration as active | |
run: cp -n local_settings.py.tpl_dev local_settings.py | |
- name: Start the services with docker compose up | |
run: docker compose up -d | |
- name: Run pytest in the app container | |
run: USE_DOCKER=1 ./run-pytest -vvv | |
checks: | |
strategy: | |
matrix: | |
toxenv: [style, requirements, sanitizer] | |
runs-on: ubuntu-22.04 #ubuntu:jammy-20231004 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Python | |
uses: actions/[email protected] | |
with: | |
python-version: "3.10" #3.10 | |
- name: Install GDAL | |
run: sudo apt-get update && sudo apt-get install -y gdal-bin | |
if: ${{ matrix.toxenv == 'sanitizer' }} | |
- name: Install Tox and tox-gh-actions | |
run: pip install tox tox-gh-actions | |
- name: Run the check with Tox | |
run: tox | |
env: | |
TOXENV: ${{matrix.toxenv}} |