Skip to content

Clean up dev environment and update database dependencies (#56) #14

Clean up dev environment and update database dependencies (#56)

Clean up dev environment and update database dependencies (#56) #14

Workflow file for this run

name: Test and deploy
on:
workflow_dispatch: {}
pull_request: {}
push:
branches:
- master
jobs:
test:
runs-on: ubuntu-latest
env:
DJANGO_SECRET_KEY: reallysupersecret
DJANGO_SETTINGS_MODULE: mbm.settings
DB_HOST: localhost
DB_USERNAME: postgres
DB_PASSWORD: postgres
services:
postgres:
image: postgres:11
env:
POSTGRES_DB: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
POSTGRES_PORT: 5432
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Install dependencies
run: |
sudo apt-get update && sudo apt-get install -y --no-install-recommends gdal-bin
pip install --upgrade pip
pip install --upgrade -r app/requirements.txt
- name: Run tests
run: |
cp -R tests app/tests
cd app && pytest
deploy:
needs: test
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
environment: Dev
env:
AWS_REGION: us-east-2
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v3
- uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: ${{ secrets.IAMROLE_GITHUB }}
role-session-name: GitHub-Action-Role
aws-region: ${{ env.AWS_REGION }}
- run: |
echo "Deploying branch ${{ env.GITHUB_REF }} to ${{ github.event.inputs.environment }}"
commit_hash=`git rev-parse HEAD`
aws deploy create-deployment --application-name mellow-bike-map --deployment-group-name production --github-location repository=$GITHUB_REPOSITORY,commitId=$commit_hash --ignore-application-stop-failures