-
Notifications
You must be signed in to change notification settings - Fork 3
65 lines (55 loc) · 2.24 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
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: ${{ github.ref == 'refs/heads/main' && 'backend-production' || 'backend-development' }}
environment_name: ${{ github.ref == 'refs/heads/main' && 'Backend-production-env' || 'Backend-development-env' }}
version_label: ${{ github.sha }}
use_existing_version_if_available: true
region: eu-central-1
deployment_package: deploy.zip