-
Notifications
You must be signed in to change notification settings - Fork 0
100 lines (84 loc) · 2.66 KB
/
build-deploy.yaml
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# ========================================
# Note: If you make changes to this CI/CD, please include someone from DevOps in the list of reviewers for the PR.
# ========================================
name: Build and Deploy Labs Analytics Server
on: push
jobs:
backend-check:
name: "Backend Check"
uses: pennlabs/shared-actions/.github/workflows/django.yaml@8785a7d7b9158d8d5705a0202f5695db2c0beb97
with:
projectName: LabsAnalytics
path: .
flake: true
black: true
pythonVersion: 3.11-buster
skipDjangoCheck: true
linting-check:
name: Linting Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Cache
uses: actions/cache@v2
with:
path: ~/.local/share/virtualenvs
key: v0-${{ hashFiles('./Pipfile.lock') }}
- name: Install Dependencies (pipenv)
shell: bash
continue-on-error: true
run: |-
cd .
pip install pipenv
pipenv install --dev
- name: Lint (flake8)
run: |-
cd .
pipenv run flake8 .
- name: Lint (black)
run: |-
cd .
pipenv run black --check .
container:
image: python:3.11-buster
env:
DATABASE_URL: postgres://postgres:postgres@postgres:5432/postgres
services:
postgres:
image: postgres:12
env:
POSTGRES_USER: postgres
POSTGRES_DB: postgres
POSTGRES_PASSWORD: postgres
options: "--health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5"
publish-backend:
uses: pennlabs/shared-actions/.github/workflows/[email protected]
with:
# Inputs
imageName: "labs-analytics-backend"
githubRef: ${{ github.ref }}
gitSha: ${{ github.sha }}
# Optional inputs
# Path to the docker context
path: .
# Path to the dockerfile (relative to `path` variable)
dockerfile: Dockerfile
# If enabled, will cache_from the latest version of the docker image.
cache: true
secrets:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
needs: linting-check
# Deploy
deploy:
name: "Deploy"
uses: pennlabs/shared-actions/.github/workflows/[email protected]
with:
githubRef: ${{ github.ref }}
gitSha: ${{ github.sha }}
secrets:
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }}
GH_AWS_ACCESS_KEY_ID: ${{ secrets.GH_AWS_ACCESS_KEY_ID }}
GH_AWS_SECRET_ACCESS_KEY: ${{ secrets.GH_AWS_SECRET_ACCESS_KEY }}
needs:
- publish-backend