-
Notifications
You must be signed in to change notification settings - Fork 1
147 lines (133 loc) · 4.95 KB
/
build.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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
name: Run full build
on:
push:
branches: [main]
env:
CI: true
NODE_ENV: production
DB_URI: ${{ secrets.DB_URI }}
AZURE_STORAGE_ACCOUNT: ${{ secrets.AZURE_STORAGE_ACCOUNT }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
jobs:
initial-setup:
name: "Initial setup"
uses: engagementlab/el-next/.github/workflows/init.yml@main
run-build:
needs: initial-setup
name: "Make build"
# Do not run on automated commits (interpretation of TravisCI feature)
if: "!contains(github.event.head_commit.message, 'skip ci') && github.actor != 'dependabot[bot]'"
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.16]
steps:
- name: Setup node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Download artifacts from initial-setup job
uses: actions/download-artifact@v3
with:
name: ${{ format('artifact-repo-{0}', github.run_id) }}
- name: Install global packages
run: npm install -g yarn pm2 @preconstruct/cli
- name: Install local monorepo packages and run preconstruct
run: yarn
- name: Make production build
working-directory: apps/elab
env:
GRAPHQL_APP: elab
NODE_TLS_REJECT_UNAUTHORIZED: '0'
run: |
yarn add typescript @types/node
yarn
yarn build
- name: Generate build notes and summary from user
if: ${{ github.event_name == 'repository_dispatch' && github.event.client_payload.note != 'null' }}
run: echo "(Build commit [${{ steps.commit.outputs.commit_sha }}](https://github.com/$GITHUB_REPOSITORY/commit/${{ steps.commit.outputs.commit_long_sha }}))" >> $GITHUB_STEP_SUMMARY"
- name: Install packages
working-directory: apps/elab
run: npm i -g pa11y-ci http-server pm2 && npm i
- name: Serve build
working-directory: apps/elab/out
run: pm2 start `which http-server` --name server
- name: Output all build paths to .pa11yci config and run a11y tests
id: pa11y
run: |
node outputRoutes.mjs --app elab
pa11y-ci
- name: Run Lighthouse
id: lhci
uses: foo-software/lighthouse-check-action@master
with:
fooApiToken: ${{ secrets.FOO_API_KEY }}
configFile: 'lhconfig.json'
- name: Send success Slack notification
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && success() && steps.lhci.outcome == 'success' }}
uses: slackapi/slack-github-action@v1.23.0
with:
payload: |
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": ":goggles: The latest *test* build of our web apps succeeded. _(Build #${{ github.run_number }})_"
}
}
]
}
# Build has failed due to a11y check(s) not successful
- name: Send Slack notification w/ a11y warning
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && failure() && (steps.lhci.outcome == 'failure' || steps.pa11y.outcome == 'failure') }}
uses: slackapi/slack-github-action@v1.23.0
with:
payload: |
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": ":goggles: The latest *test* build of our web apps succeeded with warnings. _(Build #${{ github.run_number }})_"
}
},
{
"type": "context",
"elements": [
{
"type": "mrkdwn",
"text": ":pushpin: Some accessibility issues exist."
}
]
}
]
}
- name: Send failed Slack notification
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && failure() && steps.lhci.outcome == 'success' }}
uses: slackapi/slack-github-action@v1.23.0
with:
payload: |
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": ":woozy_face: The latest *test* build of our web apps failed. _(Build #${{ github.run_number }})_"
}
},
{
"type": "context",
"elements": [
{
"type": "mrkdwn",
"text": "(Production deploys will probably fail right now)"
}
]
}
]
}