-
Notifications
You must be signed in to change notification settings - Fork 0
131 lines (104 loc) · 3.26 KB
/
develop.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
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
name: Develop
on:
push:
branches:
- develop
env:
DOCKER_BUILDKIT: 1
IMAGE_TAG: ${{ github.sha }}
REGISTRY_USERNAME: prereview
jobs:
build:
runs-on: ubuntu-20.04
steps:
- name: 'Checkout code'
uses: actions/checkout@v2
- name: 'Create Git LFS lockfile'
run: git lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id
- name: 'Set up Git LFS cache'
uses: actions/cache@v2
with:
path: .git/lfs
key: lfs-${{ hashFiles('.lfs-assets-id') }}
- name: 'Git LFS pull'
run: git lfs pull
- name: 'Build dev image'
run: make build
env:
TARGET: 'dev'
- name: 'Typecheck'
run: make typecheck
continue-on-error: true
- name: 'Lint'
run: make lint
- name: 'Test'
run: make test
- name: 'Format'
run: make format
continue-on-error: true
- name: 'Build image'
run: make build
env:
TARGET: 'prod'
- name: 'Smoke test'
run: make smoke-test
- name: 'Build integration test image'
run: make build
env:
TARGET: 'integration'
- name: 'Run integration tests'
id: integration-test
run: make integration-test
continue-on-error: true
env:
PREREVIEW_ORCID_CLIENT_ID: ${{ secrets.ORCID_SANDBOX_CLIENT_ID }}
PREREVIEW_ORCID_CLIENT_SECRET: ${{ secrets.ORCID_SANDBOX_CLIENT_SECRET }}
PREREVIEW_ZENODO_TOKEN: ${{ secrets.ZENODO_TOKEN }}
- name: 'Store integration test results'
if: ${{ failure() && steps.integration-test.outcome == 'failure' }}
uses: actions/upload-artifact@v2
with:
name: integration-tests-results
path: integration/results
- name: 'Check migrations'
run: |
make create-migration
git ls-files --others --exclude-standard -z | xargs --no-run-if-empty -0 -n 1 git --no-pager diff /dev/null
- name: 'Log in to registry'
uses: azure/docker-login@v1
with:
login-server: prereview.azurecr.io
username: ${{ env.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: 'Push image'
run: docker push prereview.azurecr.io/prereview:${{ env.IMAGE_TAG }}
deploy:
runs-on: ubuntu-20.04
needs: build
steps:
- name: 'Checkout code'
uses: actions/checkout@v2
- name: 'Log in to Azure'
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: 'Deploy app'
uses: azure/webapps-deploy@v2
with:
app-name: 'prereview-dev'
images: prereview.azurecr.io/prereview:${{ env.IMAGE_TAG }}
configuration-file: './deploy/docker-compose-dev.yml'
tag:
runs-on: ubuntu-20.04
needs: deploy
continue-on-error: true
steps:
- name: 'Tag as develop'
uses: tinact/[email protected]
with:
image_name: 'prereview'
image_old_tag: ${{ env.IMAGE_TAG }}
image_new_tag: 'develop'
registry: 'prereview.azurecr.io'
registry_username: ${{ env.REGISTRY_USERNAME }}
registry_password: ${{ secrets.REGISTRY_PASSWORD }}