Skip to content

Commit 306a3a9

Browse files
authored
Break CI Github Action Into Smaller Jobs (#121)
* break ci into multiple jobs Signed-off-by: Jordan Dubrick <[email protected]> * remove .yml to .yaml for nx format check Signed-off-by: Jordan Dubrick <[email protected]> * split node and docker builds Signed-off-by: Jordan Dubrick <[email protected]> * pin version to commit hash for setup-node and nx-set-shas Signed-off-by: Jordan Dubrick <[email protected]> * add top level permission for ci job Signed-off-by: Jordan Dubrick <[email protected]> --------- Signed-off-by: Jordan Dubrick <[email protected]>
1 parent a0bc065 commit 306a3a9

File tree

2 files changed

+145
-71
lines changed

2 files changed

+145
-71
lines changed

.github/workflows/ci.yaml

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
# Copyright Red Hat
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: CI
16+
on:
17+
push:
18+
branches:
19+
- main
20+
pull_request:
21+
22+
permissions: read-all
23+
24+
concurrency:
25+
group: ${{ github.workflow }}-${{ github.event.number || github.ref }}
26+
cancel-in-progress: true
27+
28+
jobs:
29+
test-and-lint:
30+
name: Test and Lint
31+
runs-on: ubuntu-latest
32+
33+
env:
34+
NX_SKIP_NX_CACHE: true
35+
36+
steps:
37+
- name: Checkout
38+
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
39+
with:
40+
fetch-depth: 0
41+
42+
- uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 #v4.0.0
43+
with:
44+
node-version-file: 'package.json'
45+
46+
- name: Set SHA
47+
uses: nrwl/nx-set-shas@76907e7e5d3cd17ddb5e2b123389f054bffcdd03 #v4.0.0
48+
49+
- name: Install
50+
run: |
51+
yarn install --frozen-lockfile
52+
53+
- name: Lint
54+
run: |
55+
yarn nx format:check
56+
yarn nx affected --target=lint --parallel=3
57+
58+
- name: Test
59+
run: |
60+
yarn nx affected --target=test --parallel=3 --ci --code-coverage
61+
62+
node-build:
63+
name: Node Build
64+
runs-on: ubuntu-latest
65+
66+
env:
67+
NX_SKIP_NX_CACHE: true
68+
69+
steps:
70+
- name: Checkout
71+
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
72+
with:
73+
fetch-depth: 0
74+
75+
- uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 #v4.0.0
76+
with:
77+
node-version-file: 'package.json'
78+
79+
- name: Set SHA
80+
uses: nrwl/nx-set-shas@76907e7e5d3cd17ddb5e2b123389f054bffcdd03 #v4.0.0
81+
82+
- name: Install
83+
run: |
84+
yarn install --frozen-lockfile
85+
86+
- name: Build
87+
run: |
88+
yarn nx affected --target=build --parallel=3
89+
90+
docker-build:
91+
name: Docker Build
92+
runs-on: ubuntu-latest
93+
94+
env:
95+
NX_SKIP_NX_CACHE: true
96+
97+
steps:
98+
- name: Checkout
99+
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
100+
with:
101+
fetch-depth: 0
102+
103+
- uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 #v4.0.0
104+
with:
105+
node-version-file: 'package.json'
106+
107+
- name: Set SHA
108+
uses: nrwl/nx-set-shas@76907e7e5d3cd17ddb5e2b123389f054bffcdd03 #v4.0.0
109+
110+
- name: Install
111+
run: |
112+
yarn install --frozen-lockfile
113+
114+
- name: Docker Build
115+
run: |
116+
yarn nx affected --target=docker-build --parallel=3
117+
118+
e2e:
119+
name: E2E
120+
runs-on: ubuntu-latest
121+
122+
env:
123+
NX_SKIP_NX_CACHE: true
124+
125+
steps:
126+
- name: Checkout
127+
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
128+
with:
129+
fetch-depth: 0
130+
131+
- uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 #v4.0.0
132+
with:
133+
node-version-file: 'package.json'
134+
135+
- name: Set SHA
136+
uses: nrwl/nx-set-shas@76907e7e5d3cd17ddb5e2b123389f054bffcdd03 #v4.0.0
137+
138+
- name: Install
139+
run: |
140+
yarn install --frozen-lockfile
141+
142+
- name: E2E
143+
run: |
144+
# parallelization cannot be easily used here because of port conflicts
145+
yarn nx affected --target=e2e --configuration=production --parallel=1

.github/workflows/ci.yml

Lines changed: 0 additions & 71 deletions
This file was deleted.

0 commit comments

Comments
 (0)