Skip to content

Test against a pgstac database #102

Test against a pgstac database

Test against a pgstac database #102

Workflow file for this run

name: CICD
on:
push:
branches:
- 'main'
- 'dev'
- 'production'
pull_request:
types: [ opened, reopened, edited, synchronize ]
jobs:
test:
runs-on: ubuntu-latest
env:
AWS_DEFAULT_REGION: us-west-2
services:
pgstac:
image: ghcr.io/stac-utils/pgstac:v0.7.10
env:
POSTGRES_USER: username
POSTGRES_PASSWORD: password
POSTGRES_DB: postgis
PGUSER: username
PGPASSWORD: password
PGDATABASE: postgis
ports:
- 5432:5432
steps:
- uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.9
cache: "pip"
cache-dependency-path: |
requirements.txt
api/requirements.txt
- name: Install Dependencies
run: |
pip install \
--upgrade \
--upgrade-strategy eager \
-r requirements.txt \
-r api/requirements.txt
- name: Run Tests
run: |
pytest
- name: Run Linters
uses: wearerequired/lint-action@v2
with:
black: true
black_args: api cdk
flake8: true
flake8_args: api cdk --max-line-length=131
isort: true
isort_args: api cdk
gitflow-enforcer:
runs-on: ubuntu-latest
steps:
- name: Check branch
if: github.base_ref == 'main' && github.head_ref != 'dev' || github.base_ref == 'production' && github.head_ref != 'main'
run: |
echo "ERROR: You can only merge to main from dev and to production from main"
exit 1
deploy-to-dev:
needs: gitflow-enforcer
if: github.ref_name == 'dev'
concurrency: development
uses: "./.github/workflows/deploy.yml"
with:
environment: development
stage: "dev"
role-session-name: "veda-stac-ingestor-github-development-deployment"
aws-region: "us-west-2"
secrets: inherit
deploy-to-staging:
needs: gitflow-enforcer
if: github.ref_name == 'main'
concurrency: staging
uses: "./.github/workflows/deploy.yml"
with:
environment: staging
stage: "staging"
role-session-name: "veda-stac-ingestor-github-staging-deployment"
aws-region: "us-west-2"
secrets: inherit
deploy-to-production:
needs: gitflow-enforcer
if: github.ref_name == 'production'
concurrency: production
uses: "./.github/workflows/deploy.yml"
with:
environment: production
stage: "production"
role-session-name: "veda-stac-ingestor-github-production-deployment"
aws-region: "us-west-2"
secrets: inherit