-
Notifications
You must be signed in to change notification settings - Fork 9
112 lines (94 loc) · 3.68 KB
/
pars-upload-branch.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
101
102
103
104
105
106
107
108
109
110
111
112
name: pars-upload-branch
on:
pull_request:
branches:
- "master"
paths:
- medicines/pars-upload/**
- .github/workflows/pars-upload-branch.yaml
env:
NEXT_PUBLIC_DISABLE_AUTH: true
PARS_UPLOAD_URL: "https://doc-index-updater-dev.test.mhra.gov.uk/pars"
# above is for cypress, below is for next.js
NEXT_PUBLIC_PARS_UPLOAD_URL: "https://doc-index-updater-dev.test.mhra.gov.uk/pars"
DEV_PARS_APP_ID: 26f95b21-63b2-475f-8a35-d39cea4cfd61
jobs:
build:
name: Build, test and check pars-upload
runs-on: ubuntu-latest
steps:
- name: Clone repo
uses: actions/checkout@v2
- name: Setup node.js
uses: actions/setup-node@v1
with:
node-version: "14.17"
# Based on https://github.com/actions/cache/blob/master/examples.md#node---yarn
- name: Get yarn cache path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v1
name: Cache yarn dependencies
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('medicines/pars-upload/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
# See: https://github.com/zeit/next.js/blob/master/errors/no-cache.md
- uses: actions/cache@v1
name: Cache Next.js cache folder
with:
path: medicines/pars-upload/.next/cache
key: ${{ runner.os }}-next-js-${{ hashFiles('medicines/pars-upload/yarn.lock') }}
restore-keys: |
${{ runner.os }}-next-js-
- name: Install modules
working-directory: medicines/pars-upload
run: yarn install --frozen-lockfile
- name: Build
working-directory: medicines/pars-upload
run: yarn build
- name: Run tests with coverage
working-directory: medicines/pars-upload
run: yarn test:ci
- name: Lint
working-directory: medicines/pars-upload
run: yarn lint
- name: Accessibility check
working-directory: medicines/pars-upload
run: yarn a11y
- name: Run cypress end-to-end tests
working-directory: medicines/pars-upload
run: make e2e
- name: Upload cypress screenshots
uses: actions/upload-artifact@v1
if: failure()
with:
name: medicines-cypress-screenshots
path: medicines/pars-upload/cypress/screenshots
- name: Upload cypress videos
uses: actions/upload-artifact@v1
if: always()
with:
name: medicines-cypress-videos
path: medicines/pars-upload/cypress/videos
- name: DEV - Create .env file
working-directory: medicines/pars-upload
run: |
{
echo "NEXT_PUBLIC_CLIENT_ID=$DEV_PARS_APP_ID"
echo "NEXT_PUBLIC_AUTHORITY_URL=https://login.microsoftonline.com/e527ea5c-6258-4cd2-a27f-8bd237ec4c26"
echo "NEXT_PUBLIC_DISABLE_AUTH=\"$NEXT_PUBLIC_DISABLE_AUTH\""
echo "NEXT_PUBLIC_PARS_UPLOAD_URL=\"$NEXT_PUBLIC_PARS_UPLOAD_URL\""
echo "PARS_UPLOAD_URL=\"$PARS_UPLOAD_URL\""
} > .env
- name: DEV - Build static site
working-directory: medicines/pars-upload
run: yarn export
- name: DEV - Deploy pars upload website to static site in azure storage
# master causes this step to fail so pointing to last working commit until fixed
uses: lauchacarro/Azure-Storage-Action@92250565adefe3844ab7e135cb570ca354f0ac18
with:
enabled-static-website: true
folder: medicines/pars-upload/out
connection-string: ${{ secrets.AZURE_STORAGE_PARS_WEB_CONNECTION_STRING_DEV }}