Skip to content

Commit a0dcb0e

Browse files
authored
Update build-dev.yml
1 parent 4c9c562 commit a0dcb0e

File tree

1 file changed

+63
-29
lines changed

1 file changed

+63
-29
lines changed

.github/workflows/build-dev.yml

+63-29
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,78 @@
1-
name: Build Dev
1+
name: Dev build
22

33
on:
44
workflow_dispatch:
55
inputs:
6-
username:
7-
description: "GitHub username to check"
8-
required: true
9-
type: string
10-
org:
11-
description: "GitHub organization name"
12-
required: true
6+
submodule_path_regex:
7+
description:
8+
Regex of submodule paths to updated to HEAD before building.
9+
default: content-modules
1310
type: string
1411

1512
jobs:
16-
test-membership:
13+
build-and-test:
14+
name: BUILD and CHECK LINKS
1715
runs-on: ubuntu-latest
18-
1916
steps:
20-
- name: Install GitHub CLI
21-
run: sudo apt-get install gh -y
17+
- uses: actions/checkout@v4
2218

23-
- name: Check if user is a member of the org
24-
id: check-membership
19+
- name: Create NPM cache-hash input file
2520
run: |
26-
USERNAME="${{ inputs.username }}"
27-
ORG="${{ inputs.org }}"
28-
STATUS=$(gh api "orgs/$ORG/members/$USERNAME" --silent && echo "true" || echo "false")
29-
30-
if [[ "$STATUS" == "true" ]]; then
31-
echo "MEMBER_FOUND=true" >> $GITHUB_ENV
32-
else
33-
echo "MEMBER_FOUND=false" >> $GITHUB_ENV
34-
fi
21+
mkdir -p tmp
22+
jq '{devDependencies, dependencies, engines, gitHubActionCacheKey}' package.json > tmp/package-ci.json
23+
24+
- name: Create and use reduced-dependencies package.json
25+
run: |
26+
jq 'del(.dependencies, .optionalDependencies)' \
27+
package.json > tmp/package-min.json
28+
cp tmp/package-min.json package.json
29+
30+
- uses: actions/setup-node@v4
31+
with:
32+
node-version-file: .nvmrc
33+
cache: npm
34+
cache-dependency-path: tmp/package-ci.json
35+
36+
- run: npm install --omit=optional
37+
38+
- run: npm run log:test-and-fix
3539
env:
36-
GH_TOKEN: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }}
40+
CMD_SKIP: i18n|registry
41+
GET: no # For details, see: https://opentelemetry.io/docs/contributing/development/#submodule-changes
42+
PIN_SKIP: ${{ inputs.submodule_path_regex }}
43+
44+
- uses: actions/upload-artifact@v4
45+
with:
46+
name: build-log-etc
47+
path: |
48+
tmp/build-log.txt
49+
tmp/package*.json
50+
static/refcache.json
3751
38-
- name: Comment on the check result
52+
check-refcache:
53+
name: REFCACHE updates?
54+
needs: build-and-test
55+
runs-on: ubuntu-latest
56+
steps:
57+
- uses: actions/checkout@v4
58+
- uses: actions/download-artifact@v4
59+
with: { name: build-log-etc }
60+
- name: Fail when refcache contains entries with HTTP status 4XX
3961
run: |
40-
if [[ "$MEMBER_FOUND" == "true" ]]; then
41-
echo "✅ $USERNAME is a member of the $ORG organization."
42-
else
43-
echo "❌ $USERNAME is NOT a member of the $ORG organization."
62+
if grep -B 1 -e '"StatusCode": 4' static/refcache.json; then
63+
echo "Run 'npx gulp prune' to remove 4xx entries from the refcache"
64+
exit 1
4465
fi
66+
- name: Does the refcache need updating?
67+
run: npm run diff:fail
68+
69+
check-build-log-for-issues:
70+
name: WARNINGS in build log?
71+
needs: build-and-test
72+
runs-on: ubuntu-latest
73+
steps:
74+
- uses: actions/checkout@v4
75+
- uses: actions/download-artifact@v4
76+
with: { name: build-log-etc }
77+
- run: cat tmp/build-log.txt
78+
- run: scripts/check-build-log.sh

0 commit comments

Comments
 (0)