-
Notifications
You must be signed in to change notification settings - Fork 223
180 lines (153 loc) · 6.77 KB
/
Copy pathpr.yaml
File metadata and controls
180 lines (153 loc) · 6.77 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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
# Copyright Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: PR
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
branches:
- main
- release-1.9
- release-1.1[0-9]
env:
TURBO_SCM_BASE: ${{ github.event.pull_request.base.sha }}
TURBO_SCM_HEAD: ${{ github.sha }}
concurrency:
group: ${{ github.workflow }}-${{ github.event.number || github.event.pull_request.head.ref }}
cancel-in-progress: true
jobs:
build:
name: Build with Node.js
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
fetch-depth: 0
persist-credentials: false
- name: Check Image and Relevant Changes
id: check-image
uses: ./.github/actions/check-image-and-changes
- name: Setup Node.js
if: ${{ steps.check-image.outputs.is_skipped != 'true' }}
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version-file: '.nvmrc'
registry-url: "https://registry.npmjs.org"
- name: Setup local Turbo cache
if: ${{ steps.check-image.outputs.is_skipped != 'true' }}
uses: dtinth/setup-github-actions-caching-for-turbo@cc723b4600e40a6b8815b65701d8614b91e2669e # v1.3.0
with:
cache-prefix: turbogha-pr-${{ github.event.number }}
- name: Use app-config.example.yaml
if: ${{ steps.check-image.outputs.is_skipped != 'true' }}
run: rm app-config.yaml && mv app-config.example.yaml app-config.yaml
- name: Install dependencies
if: ${{ steps.check-image.outputs.is_skipped != 'true' }}
uses: backstage/actions/yarn-install@2cd6978b476cbdc39fec48346f8b6ca13199dd6a # v0.7.8
with:
cache-prefix: ${{ runner.os }}-${{ hashFiles('.nvmrc') }}
- name: Build packages
if: ${{ steps.check-image.outputs.is_skipped != 'true' }}
run: yarn run build --continue --affected
test:
name: Test with Node.js
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
fetch-depth: 0
persist-credentials: false
- name: Check Image and Relevant Changes
id: check-image
uses: ./.github/actions/check-image-and-changes
- name: Setup Node.js
if: ${{ steps.check-image.outputs.is_skipped != 'true' }}
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version-file: '.nvmrc'
registry-url: "https://registry.npmjs.org"
- name: Setup local Turbo cache
if: ${{ steps.check-image.outputs.is_skipped != 'true' }}
uses: dtinth/setup-github-actions-caching-for-turbo@cc723b4600e40a6b8815b65701d8614b91e2669e # v1.3.0
with:
cache-prefix: turbogha-pr-${{ github.event.number }}
- name: Use app-config.example.yaml
if: ${{ steps.check-image.outputs.is_skipped != 'true' }}
run: rm app-config.yaml && mv app-config.example.yaml app-config.yaml
- name: Install dependencies
if: ${{ steps.check-image.outputs.is_skipped != 'true' }}
uses: backstage/actions/yarn-install@2cd6978b476cbdc39fec48346f8b6ca13199dd6a # v0.7.8
with:
cache-prefix: ${{ runner.os }}-${{ hashFiles('.nvmrc') }}
- name: Run prettier
if: ${{ steps.check-image.outputs.is_skipped != 'true' }}
run: yarn prettier:check --continue --affected
- name: Run lint
if: ${{ steps.check-image.outputs.is_skipped != 'true' }}
run: yarn run lint:check --continue --affected
- name: Run monorepo tools
if: ${{ steps.check-image.outputs.is_skipped != 'true' }}
run: yarn run monorepo:check
- name: Regenerate dockerfiles
if: ${{ steps.check-image.outputs.is_skipped != 'true' }}
run: |
yarn run build:dockerfile; if [[ $(git diff --name-only | grep Dockerfile || true) != "" ]]; then \
echo "ERROR: Workspace is dirty! Must run 'yarn build:dockerfile' and commit changes!"; exit 1; \
fi
- name: Install jest-junit reporter
if: ${{ steps.check-image.outputs.is_skipped != 'true' }}
run: |
npm install jest-junit@17.0.0 --ignore-scripts --prefix ${{ runner.temp }}/jest-junit
ln -s ${{ runner.temp }}/jest-junit/node_modules/jest-junit node_modules/jest-junit
mkdir -p ${{ runner.temp }}/test-results
- name: Run tests
if: ${{ steps.check-image.outputs.is_skipped != 'true' }}
id: tests
env:
JEST_JUNIT_OUTPUT_DIR: ${{ runner.temp }}/test-results
JEST_JUNIT_CLASSNAME: '{filepath}'
JEST_JUNIT_UNIQUE_OUTPUT_NAME: 'true'
run: yarn run test --continue --affected -- --reporters=default --reporters=jest-junit
- name: Upload coverage to Codecov
if: ${{ steps.check-image.outputs.is_skipped != 'true' && !cancelled() }}
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v6.0.2
with:
flags: rhdh
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false
- name: Upload test results to Codecov
if: ${{ steps.check-image.outputs.is_skipped != 'true' && !cancelled() && steps.tests.outcome != 'skipped' }}
uses: codecov/test-results-action@0fa95f0e1eeaafde2c782583b36b28ad0d8c77d3 # v1.2.1
with:
flags: rhdh
token: ${{ secrets.CODECOV_TOKEN }}
directory: ${{ runner.temp }}/test-results
fail_ci_if_error: false
- name: Install dynamic plugin dependencies
if: ${{ steps.check-image.outputs.is_skipped != 'true' }}
working-directory: dynamic-plugins
run: yarn install
- name: Test the dynamic plugin wrappers
if: ${{ steps.check-image.outputs.is_skipped != 'true' }}
working-directory: dynamic-plugins
run: yarn test --continue --affected
- name: Export the dynamic plugin wrappers
if: ${{ steps.check-image.outputs.is_skipped != 'true' }}
working-directory: dynamic-plugins
run: yarn export-dynamic --continue --affected