Merge pull request #461 from ropable/master #352
This file contains hidden or 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: 'Run unit tests' | |
| on: | |
| # Triggers the workflow on push or pull request events but only for the master branch | |
| push: | |
| branches: [master] | |
| pull_request: | |
| branches: [master] | |
| workflow_dispatch: | |
| jobs: | |
| run_tests: | |
| name: Run Django Tests | |
| runs-on: ubuntu-latest | |
| env: | |
| DATABASE_URL: postgis://postgres:postgres@localhost:5432/postgres | |
| permissions: | |
| contents: read | |
| services: | |
| postgres: | |
| image: postgis/postgis:15-3.4-alpine | |
| env: | |
| POSTGRES_USER: postgres | |
| POSTGRES_PASSWORD: postgres | |
| ports: | |
| - 5432:5432 | |
| options: --mount type=tmpfs,destination=/var/lib/postgresql/data --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | |
| steps: | |
| #---------------------------------------------- | |
| # Make use of the Step Security Harden Runner workflow to monitor the build process. | |
| #---------------------------------------------- | |
| - name: Harden the GitHub runner | |
| uses: step-security/harden-runner@v2.14.2 | |
| with: | |
| egress-policy: audit | |
| #---------------------------------------------- | |
| # Install GDAL into the environment | |
| #---------------------------------------------- | |
| - name: Install GDAL | |
| id: install-gdal | |
| run: | | |
| sudo apt-add-repository ppa:ubuntugis/ubuntugis-unstable | |
| sudo apt-get update | |
| sudo apt-get install gdal-bin libgdal-dev | |
| #---------------------------------------------- | |
| # Checkout repo | |
| #---------------------------------------------- | |
| - name: Check out repository | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| #---------------------------------------------- | |
| # Install & configure uv | |
| #---------------------------------------------- | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| python-version: '3.13' | |
| enable-cache: true | |
| #---------------------------------------------- | |
| # Install project dependencies | |
| #---------------------------------------------- | |
| - name: Install dependencies | |
| run: uv sync | |
| #---------------------------------------------- | |
| # Run unit tests | |
| #---------------------------------------------- | |
| - name: Run tests | |
| run: | | |
| uv run python manage.py collectstatic | |
| uv run python manage.py test --noinput --failfast --verbosity 0 |