-
Notifications
You must be signed in to change notification settings - Fork 7.1k
239 lines (223 loc) · 7.42 KB
/
Copy pathchecks.yml
File metadata and controls
239 lines (223 loc) · 7.42 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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0
name: Checks
on:
merge_group:
types: [checks_requested]
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: false
jobs:
build_images:
name: Build images
permissions: # required by the reusable workflow
contents: read # required by the component-build-images reusable workflow
packages: write # required to push built images to GHCR
uses: ./.github/workflows/component-build-images.yml
with:
push: ${{ github.event_name == 'push' }}
force_build: ${{ github.event_name == 'push' }}
# Use a non-release tag for PR builds; tags are not pushed when push=false.
version: ${{ github.event_name == 'push' && 'main' || 'dev' }}
secrets:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
markdownlint:
name: Markdown lint
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Install dependencies
run: npm ci
- name: Run markdownlint
run: make markdownlint
yamllint:
name: YAML lint
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: '3.x'
- name: Install yamllint
run: make install-yamllint
- name: Run yamllint
run: yamllint . -f github --strict
misspell:
name: Misspell
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Run misspell
run: make misspell
checklinks:
name: lychee
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Restore lychee cache
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
id: cache-restore
with:
path: .lycheecache
key: ${{ runner.os }}-lychee-${{ hashFiles('.lychee.toml') }}
restore-keys: |
${{ runner.os }}-lychee-
- name: Run lychee
uses: lycheeverse/lychee-action@e7477775783ea5526144ba13e8db5eec57747ce8 # v2.9.0
with:
args: --config .lychee.toml --cache --max-cache-age 3d --cache-exclude-status 300..=599 .
fail: true
- name: Save lychee cache
if: always()
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: .lycheecache
key: ${{ steps.cache-restore.outputs.cache-primary-key }}
sanity:
name: Sanity check
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Run sanitycheck.py
run: python3 ./internal/tools/sanitycheck.py
checklicense:
name: Check license
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Run checklicense
run: make checklicense
weaver-check:
name: Weaver check
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Run Weaver registry check
env:
GITHUB_WORKSPACE_PATH: ${{ github.workspace }}
run: |
# Reuse the Dependabot-tracked weaver pin from the telemetry-docs Dockerfile so this
# check never drifts from the version used to actually generate the docs.
WEAVER_IMAGE=$(grep -oP '(?<=^FROM )\S*otel/weaver\S*' src/telemetry-docs/Dockerfile)
docker run --rm \
--mount "type=bind,source=${GITHUB_WORKSPACE_PATH}/telemetry-schema,target=/home/weaver/source,readonly" \
"${WEAVER_IMAGE}" \
registry check -r source
cart-unit-tests:
name: Cart unit tests
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Start Valkey
run: |
VALKEY_IMAGE=$(grep -oP '(?<=^VALKEY_IMAGE=)\S*' .env)
docker run -d --rm --name valkey -p 6379:6379 "${VALKEY_IMAGE}"
for i in {1..30}; do
if docker exec valkey valkey-cli ping 2>/dev/null | grep -q PONG; then
break
fi
sleep 1
done
- name: Set up .NET
uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0
with:
dotnet-version: '10.0.x'
- name: Run cart unit tests
working-directory: src/cart
env:
VALKEY_ADDR: localhost:6379
run: dotnet test tests/cart.tests.csproj
check-react-native-changes:
name: Check React Native changes
runs-on: ubuntu-latest
outputs:
should_build: ${{ steps.filter.outputs.react_native }}
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Check React Native paths
uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d # v4.0.3
id: filter
with:
filters: |
react_native:
- 'src/react-native-app/**'
- 'Makefile'
- '.github/workflows/checks.yml'
- '.github/workflows/react-native-build.yml'
react-native-build:
needs: check-react-native-changes
if: needs.check-react-native-changes.outputs.should_build == 'true'
uses: ./.github/workflows/react-native-build.yml
codeql-analysis:
name: CodeQL analysis
permissions:
actions: read # required to scan GitHub Actions workflows
contents: read # required to checkout the repository
security-events: write # required to upload CodeQL SARIF to code scanning
uses: ./.github/workflows/codeql-analysis.yml
build-test:
name: build-test
needs: [
build_images,
markdownlint,
yamllint,
misspell,
checklinks,
sanity,
checklicense,
weaver-check,
cart-unit-tests,
react-native-build,
codeql-analysis
]
if: always() && !cancelled()
runs-on: ubuntu-latest
steps:
- name: Report CI status
shell: bash
env:
CI_SUCCESS: ${{ !contains(needs.*.result, 'failure') }}
run: |
if [ "${CI_SUCCESS}" == "true" ]
then
echo 'Build complete ✓'
else
echo 'Build failed ✗'
exit 1
fi