-
Notifications
You must be signed in to change notification settings - Fork 1
145 lines (132 loc) · 4.14 KB
/
ci.yml
File metadata and controls
145 lines (132 loc) · 4.14 KB
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
name: CI
env:
# Branching
is-merge: ${{ github.event_name == 'push' && github.ref_name == 'master' }}
is-pull-request: ${{ github.event_name == 'pull_request' }}
# Node.js
NODE_OPTIONS: --max-old-space-size=6144
on:
push:
branches:
- master
pull_request: {}
concurrency:
# Group concurrency on workflow, then:
# - Is merge run? Group on branch name (`refs/heads/master`)
# - Is pull request? Group on pull request branch name, for example `feat/add-awesome-feature`
group: >-
${{ github.workflow }}-${{
github.event_name == 'push'
&& github.ref
|| github.head_ref
}}
# Run merge workflows in sequence to prevent parallel deployments and releases
# Cancel stale pull request runs in progress for the same branch
cancel-in-progress: ${{ github.event_name != 'push' }}
permissions:
# Required by nrwl/nx-set-shas
actions: read
contents: read
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Check out source code
uses: actions/checkout@v3
with:
# Required by nrwl/nx-set-shas
fetch-depth: 0
- name:
'Derive appropriate SHAs for base and head for `nx affected` commands'
uses: nrwl/nx-set-shas@v2
with:
main-branch-name: 'master'
- name: Set up dependencies
uses: ./.github/actions/setup-dependencies
- name: 'PR: Build application if affected by changes in feature branch'
if: env.is-pull-request == 'true'
run: yarn affected:build
- name: 'Merge: Build application'
if: env.is-merge == 'true'
run: yarn build
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Check out source code
uses: actions/checkout@v3
with:
# Required by nrwl/nx-set-shas
fetch-depth: 0
- name:
'Derive appropriate SHAs for base and head for `nx affected` commands'
uses: nrwl/nx-set-shas@v2
with:
main-branch-name: 'master'
- name: Set up dependencies
uses: ./.github/actions/setup-dependencies
- name: Lint Nx workspace
run: yarn nx workspace-lint
- name: 'PR: Lint workspace and affected projects'
if: env.is-pull-request == 'true'
run: yarn affected:lint
- name: 'Merge: Lint workspace and all projects'
if: env.is-merge == 'true'
run: yarn lint
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Check out source code
uses: actions/checkout@v3
with:
# Required by nrwl/nx-set-shas
fetch-depth: 0
- name:
'Derive appropriate SHAs for base and head for `nx affected` commands'
uses: nrwl/nx-set-shas@v2
with:
main-branch-name: 'master'
- name: Set up dependencies
uses: ./.github/actions/setup-dependencies
- name: 'PR: Test affected projects'
if: env.is-pull-request == 'true'
run: yarn test
- name: 'Merge: Test all projects'
if: env.is-merge == 'true'
run: yarn test
e2e:
name: End-to-end test
runs-on: ubuntu-latest
steps:
- name: Check out source code
uses: actions/checkout@v3
with:
# Required by nrwl/nx-set-shas
fetch-depth: 0
- name:
'Derive appropriate SHAs for base and head for `nx affected` commands'
uses: nrwl/nx-set-shas@v2
with:
main-branch-name: 'master'
# Runs its own setup or else Cypress Binary is missing?
- name: Set up PNPM
uses: pnpm/action-setup@v2
with:
version: 7
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc
- name: Install dependencies
run: pnpm install
shell: bash
- name:
'PR: End-to-end test application if affected by changes in feature
branch'
if: env.is-pull-request == 'true'
run: yarn affected:e2e --configuration=ci-production
- name: 'Merge: End-to-end test application'
if: env.is-merge == 'true'
run: yarn e2e --configuration=ci-production