Skip to content

Feature/impl factory pattern repos #423

Feature/impl factory pattern repos

Feature/impl factory pattern repos #423

Workflow file for this run

on:
push:
branches: [main, development]
pull_request:
branches: [main]
jobs:
ci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install Poetry
run: curl -sSL https://install.python-poetry.org | python -
- run: poetry install
- name: Lint
run: poetry run python -m black --check .
- name: SonarCloud Analysis
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- name: Tests
env:
DATABASE_HOST: ${{ secrets.DATABASE_HOST}}
DATABASE_USER: ${{ secrets.DATABASE_USER}}
DATABASE_PASSWORD: ${{ secrets.DATABASE_PASSWORD}}
DATABASE_NAME: ${{ secrets.DATABASE_NAME}}
POLITRACK_API_URL: ${{ secrets.POLITRACK_API_URL}}
POLITRACK_USERNAME: ${{ secrets.POLITRACK_USERNAME}}
POLITRACK_SECRET_PASSWORD: ${{ secrets.POLITRACK_SECRET_PASSWORD}}
REDIS_HOST: ${{ secrets.REDIS_HOST}}
# Exempt tests/e2e because tests/api uses production database to test whereas tests/e2e uses localhost == avoid conflicts
run: poetry run pytest -m "not e2e"
cd:
runs-on: ubuntu-latest
needs: [ci]
if: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/development') }}
steps:
- name: Checkout source code
uses: actions/checkout@v2
- name: Generate deployment package
run: zip -r deploy.zip . -x '*.git*'
- name: Deploy to EB
uses: einaregilsson/beanstalk-deploy@v18
with:
aws_access_key: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
application_name: Face-The-Facts Backend
environment_name: ${{ github.ref == 'refs/heads/main' && 'Face-The-Facts-Backend-Main' || 'Face-The-FactsBackend-Development' }}
version_label: ${{ github.sha }}
use_existing_version_if_available: true
region: eu-central-1
deployment_package: deploy.zip