-
Notifications
You must be signed in to change notification settings - Fork 0
124 lines (107 loc) · 3.26 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
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
name: Build support-reminders
on:
pull_request:
branches:
- main
push:
branches:
- main
jobs:
CI:
if: github.repository_owner == 'guardian'
# Required by actions-assume-aws-role
permissions:
id-token: write
contents: read
name: support-reminders build
runs-on: ubuntu-latest
services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- name: Env
run: env
- name: Dump GitHub context
id: github_context_step
run: echo $JSON
env:
JSON: ${{ toJSON(github) }}
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: './.nvmrc'
cache: 'yarn'
- name: Yarn
run: |
yarn clean
yarn install
yarn run build
- name: Run unit tests
run: yarn test --silent
env:
TEST_DB_URL: postgresql://localhost/postgres
TEST_DB_USER: postgres
TEST_DB_PASSWORD: postgres
- name: Copy files to Riff Raff package
if: >-
github.actor != 'dependabot[bot]'
&& github.event.pull_request.user.login != 'dependabot[bot]'
run: cp package.json riff-raff.yaml target
- name: Yarn install in package
if: >-
github.actor != 'dependabot[bot]'
&& github.event.pull_request.user.login != 'dependabot[bot]'
working-directory: ./target
run: yarn install --production
- name: Zip target directory contents (quietly)
if: >-
github.actor != 'dependabot[bot]'
&& github.event.pull_request.user.login != 'dependabot[bot]'
run: zip -qr ../support-reminders.zip ./*
working-directory: ./target
- name: Yarn (CDK)
working-directory: cdk
run: |
yarn install
yarn tsc
yarn lint
yarn test
- name: Yarn synth (CDK)
if: >-
github.actor != 'dependabot[bot]'
&& github.event.pull_request.user.login != 'dependabot[bot]'
working-directory: cdk
run: yarn synth
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
if: >-
github.actor != 'dependabot[bot]'
&& github.event.pull_request.user.login != 'dependabot[bot]'
with:
aws-region: eu-west-1
role-to-assume: ${{ secrets.GU_RIFF_RAFF_ROLE_ARN }}
- name: Upload to Riff-Raff
uses: guardian/actions-riff-raff@v2
if: >-
github.actor != 'dependabot[bot]'
&& github.event.pull_request.user.login != 'dependabot[bot]'
with:
app: support-reminders
configPath: ./riff-raff.yaml
contentDirectories: |
support-reminders-cloudformation:
- ./cdk/cdk.out/SupportReminders-CODE.template.json
- ./cdk/cdk.out/SupportReminders-PROD.template.json
support-reminders:
- ./support-reminders.zip