Skip to content

update test/validate workflow #1

update test/validate workflow

update test/validate workflow #1

name: Test download script and validate sources
on:
push:
branches: [ main]
paths:
- '.github/workflows/test.yaml'
- 'requirements*.txt'
- 'download.py'
- 'test_download.py'
- 'source.schema.json'
- 'sources.json'
pull_request:
branches: [ main ]
paths:
- '.github/workflows/test.yaml'
- 'requirements*.txt'
- 'download.py'
- 'test_download.py'
- 'source.schema.json'
- 'sources.json'
env:
DATABASE_URL: "postgresql://postgres:postgres@postgres:5432/postgres"
jobs:
test:
runs-on: ubuntu-latest
name: test
container: ghcr.io/bcgov/harvest-restrictions:main
environment: production
services:
postgres:
image: postgis/postgis:16-3.4
env:
POSTGRES_PASSWORD: postgres
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
DEBIAN_FRONTEND: noninteractive
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: Install test dependencies
run: |
/venv/bin/python -m pip install -r requirements-dev.txt
- name: Run tests
run: |
/venv/bin/python -m pytest -v -rxXs
- name: Validate sources.json
run: |
/venv/bin/python download.py sources.json -t -v