Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: check-links: enable caching and check for warnings #3026

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 50 additions & 6 deletions .github/workflows/check-links.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,59 @@ on:
pull_request:

jobs:
check-formatting:
name: Check links and refcache
build-and-check-links:
name: BUILD and CHECK LINKS
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- run: npm install
- run: npm run build
- name: Create NPM cache-hash input file
run: |
mkdir -p tmp
jq '{devDependencies, dependencies, engines, gitHubActionCacheKey}' package.json > tmp/package-ci.json

- name: Create and use reduced-dependencies package.json
run: |
jq '.devDependencies |= with_entries(
select(.key | test("prefix|hugo|run|css"))
)
| del(.dependencies)' \
package.json > tmp/package-min.json
cp tmp/package-min.json package.json

- uses: actions/setup-node@v3
with:
node-version-file: .nvmrc
cache: npm
cache-dependency-path: tmp/package-ci.json

- run: npm install --no-optional
- run: npm run build+log
- run: npm run _check:links
- uses: actions/upload-artifact@v3
with:
name: build-log-etc
path: |
tmp/build-log.txt
tmp/package*.json
static/refcache.json

check-refcache:
name: REFCACHE updates?
needs: build-and-check-links
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with: { name: build-log-etc }
- run: npm run diff:fail

- name: Fail on uncommitted refcache changes
run: npm run diff:fail
check-build-log-for-issues:
name: WARNINGS in build log?
needs: build-and-check-links
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with: { name: build-log-etc }
- run: scripts/check-build-log.sh
1 change: 1 addition & 0 deletions .warnings-skip-list.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
WARN docs/specs/opamp/index.md:.*semantic-conventions/tree/main/docs/resource
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"build:preview": "set -x && npm run _build -- --minify --baseURL \"${DEPLOY_PRIME_URL:-/}\"",
"build:production": "hugo --cleanDestinationDir --minify",
"build": "npm run _build",
"build+log": "npm run build | tee tmp/build-log.txt",
"cd:public": "cd public &&",
"check": "npm run all -- check:*",
"check:filenames": "test -z \"$(npm run -s _ls-bad-filenames)\" || npm run -s _filename-error",
Expand Down Expand Up @@ -100,10 +101,11 @@
"@opentelemetry/sdk-trace-web": "^1.8.0",
"@opentelemetry/semantic-conventions": "^1.8.0"
},
"engines-comment": "Ensure that engines.node value stays consistent with the project's .nvmrc",
"enginesComment": "Ensure that engines.node value stays consistent with the project's .nvmrc",
"engines": {
"node": "18.x"
},
"gitHubActionCacheKey": "2023-07-13 - change this key to force cache refresh",
"private": true,
"prettier": {
"proseWrap": "always",
Expand Down
19 changes: 19 additions & 0 deletions scripts/check-build-log.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash
#
# NOTE: add warning skip patterns, one per line to WARNINGS_SKIP_LIST to
# temporarily skip known warnings or errors.

BUILD_LOG=tmp/build-log.txt
WARNINGS_SKIP_LIST=.warnings-skip-list.txt

WARNINGS=`grep -E -ie 'warn(ing)?|error' $BUILD_LOG | grep -v -f $WARNINGS_SKIP_LIST`

if [ -e $BUILD_LOG ]; then
if [ -n "$WARNINGS" ]; then
echo "WARNINGs or ERRORs found in build log:\n"
echo "$WARNINGS\n"
exit 1
fi
else
echo "INFO: $BUILD_LOG file not found."
fi