Skip to content

Merge pull request #159 from wri/raise-cogify-timeout #882

Merge pull request #159 from wri/raise-cogify-timeout

Merge pull request #159 from wri/raise-cogify-timeout #882

name: Run tests and apply terraform changes for current branch
on: [push]
jobs:
build:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v1
- name: Set up Python 3.10
uses: actions/setup-python@v1
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
./scripts/setup
- name: Lint with flake8
run: |
pip install flake8
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Install CodeClimate Coverage Reporter
run: |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
chmod +x ./cc-test-reporter
- name: Test with pytest
env:
ENV: test
AWS_ACCESS_KEY_ID: test
AWS_SECRET_ACCESS_KEY: test # pragma: allowlist secret
AWS_DEFAULT_REGION: ${{ secrets.aws_region_dev }}
LOCALSTACK_API_KEY: ${{ secrets.localstack_api_key }}
DUMP_TO_STDOUT: true
run: |
./scripts/test
- name: Deploy production
if: success() && contains(github.ref, 'master')
env:
ENV: production
AWS_ACCESS_KEY_ID: ${{ secrets.aws_key_production }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.aws_secret_production }}
AWS_REGION: ${{ secrets.aws_region_production }}
run: |
./scripts/infra plan -w ${{ github.ref }}
./scripts/infra apply
- name: Deploy staging
if: success() && contains(github.ref, 'develop')
env:
ENV: staging
AWS_ACCESS_KEY_ID: ${{ secrets.aws_key_staging }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.aws_secret_staging }}
AWS_REGION: ${{ secrets.aws_region_staging }}
run: |
./scripts/infra plan -w ${{ github.ref }}
./scripts/infra apply
- name: Deploy dev
if: success() && (! contains(github.ref, 'develop')) && (! contains(github.ref, 'master'))
env:
ENV: dev
AWS_ACCESS_KEY_ID: ${{ secrets.aws_key_dev }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.aws_secret_dev }}
AWS_REGION: ${{ secrets.aws_region_dev }}
run: |
./scripts/infra plan -w ${{ github.ref }}
./scripts/infra apply