-
Notifications
You must be signed in to change notification settings - Fork 114
84 lines (73 loc) · 2.04 KB
/
test_and_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
name: Test 🧪 and deploy 🚀
on:
push:
branches:
- "*"
pull_request:
branches: ["master"]
jobs:
test:
runs-on: ubuntu-latest
env:
HKNWEB_MODE: dev
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.9"
- uses: snok/install-poetry@v1
with:
version: 1.6.1
virtualenvs-create: true
virtualenvs-in-project: true
- uses: actions/cache@v3
with:
path: .venv
key: venv-${{ hashFiles('poetry.lock') }}
- run: poetry install --no-interaction --no-root
- name: Run formatting check
run: poetry run black . --check
- name: Run unit tests
run: |
poetry run coverage run
poetry run coverage report
- name: Deploy
run: |
poetry run fab deploy
- name: Run end-to-end tests
run: |
poetry run curl -f localhost:8000
deploy:
needs: test
runs-on: ubuntu-latest
# if: success() && github.ref == 'refs/heads/master'
environment:
name: Production
url: https://dev-hkn.eecs.berkeley.edu/
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.9"
- uses: snok/install-poetry@v1
with:
version: 1.6.1
virtualenvs-create: true
virtualenvs-in-project: true
- uses: actions/cache@v3
with:
path: .venv
key: venv-${{ hashFiles('poetry.lock') }}
- run: poetry install --no-interaction --no-root
- name: Unseal secrets
uses: jrmcdonald/[email protected]
with:
bb_actions_subcommand: "postdeploy"
env:
BLACKBOX_PUBKEY: ${{ secrets.BLACKBOX_PUBLIC_KEY }}
BLACKBOX_PRIVKEY: ${{ secrets.BLACKBOX_PRIVATE_KEY }}
- name: Deploy
run: |
poetry run fab deploy --revision ${{ github.sha }}
env:
HKNWEB_MODE: ${{ vars.HKNWEB_MODE }}