From 22db10c4ee971b2db612abb70870b080b339dc5e Mon Sep 17 00:00:00 2001 From: Simon Norris Date: Tue, 6 Aug 2024 11:28:22 -0700 Subject: [PATCH] separate test and validate workflows --- ...t-and-validate.yaml => test-download.yaml} | 10 ++-- .github/workflows/validate.yaml | 48 +++++++++++++++++++ 2 files changed, 51 insertions(+), 7 deletions(-) rename .github/workflows/{test-and-validate.yaml => test-download.yaml} (87%) create mode 100644 .github/workflows/validate.yaml diff --git a/.github/workflows/test-and-validate.yaml b/.github/workflows/test-download.yaml similarity index 87% rename from .github/workflows/test-and-validate.yaml rename to .github/workflows/test-download.yaml index 8659927..869a99a 100644 --- a/.github/workflows/test-and-validate.yaml +++ b/.github/workflows/test-download.yaml @@ -1,23 +1,19 @@ -name: Test and validate +name: Test download script on: push: branches: [ main] paths: - - '.github/workflows/test-and-validate.yaml' + - '.github/workflows/test-download.yaml' - 'requirements*.txt' - 'download.py' - 'test_download.py' - - 'source.schema.json' - - 'sources.json' pull_request: branches: [ main ] paths: - - '.github/workflows/test-and-validate.yaml' + - '.github/workflows/test-download.yaml' - 'requirements*.txt' - 'download.py' - 'test_download.py' - - 'source.schema.json' - - 'sources.json' env: DATABASE_URL: "postgresql://postgres:postgres@postgres:5432/postgres" AWS_ENDPOINT_URL: "https://nrs.objectstore.gov.bc.ca" diff --git a/.github/workflows/validate.yaml b/.github/workflows/validate.yaml new file mode 100644 index 0000000..7d51ebf --- /dev/null +++ b/.github/workflows/validate.yaml @@ -0,0 +1,48 @@ +name: Validate data sources +on: + push: + branches: [ main] + paths: + - '.github/workflows/validate.yaml' + - 'sources.json' + - 'source.schema.json' + pull_request: + branches: [ main ] + paths: + - '.github/workflows/validate.yaml' + - 'sources.json' + - 'source.schema.json' +env: + DATABASE_URL: "postgresql://postgres:postgres@postgres:5432/postgres" + AWS_ENDPOINT_URL: "https://nrs.objectstore.gov.bc.ca" + AWS_S3_ENDPOINT: "nrs.objectstore.gov.bc.ca" + AWS_VIRTUAL_HOSTING: "FALSE" + AWS_EC2_METADATA_DISABLED: "true" + CPL_VSISTDIN_BUFFER_LIMIT: -1 + OBJECTSTORE_BUCKET: ${{ secrets.OBJECTSTORE_BUCKET }} + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} +jobs: + validate: + 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 + steps: + - uses: actions/checkout@v4 + - name: Validate sources.json + run: | + /venv/bin/python download.py sources.json -t -v \ No newline at end of file