Dev build #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Dev build | |
on: | |
workflow_dispatch: | |
inputs: | |
submodule_path_regex: | |
description: | |
Regex of submodule paths to updated to HEAD before building. | |
default: content-modules | |
type: string | |
jobs: | |
build-and-test: | |
name: BUILD and CHECK LINKS | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- 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|css")) | |
) | |
| del(.dependencies, .optionalDependencies)' \ | |
package.json > tmp/package-min.json | |
cp tmp/package-min.json package.json | |
- uses: actions/setup-node@v4 | |
with: | |
node-version-file: .nvmrc | |
cache: npm | |
cache-dependency-path: tmp/package-ci.json | |
- run: npm install --omit=optional | |
- name: Fetch all submodules at HEAD | |
run: npm run update:submodule | |
- name: | |
Revert to pinned versions of submodules except for | |
submodule_path_regex | |
run: npm run _pin -- ${{ inputs.submodule_path_regex }} | |
- run: npm run log:test-and-fix | |
continue-on-error: true | |
env: | |
GET: no | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: build-log-etc | |
path: | | |
tmp/build-log.txt | |
tmp/package*.json | |
static/refcache.json | |
check-refcache: | |
name: REFCACHE updates? | |
needs: build-and-test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: { name: build-log-etc } | |
- name: Fail when refcache contains entries with HTTP status 4XX | |
run: | | |
if grep -B 1 -e '"StatusCode": 4' static/refcache.json; then | |
echo "Run 'npx gulp prune' to remove 4xx entries from the refcache" | |
exit 1 | |
fi | |
- name: Does the refcache need updating? | |
run: npm run diff:fail | |
check-build-log-for-issues: | |
name: WARNINGS in build log? | |
needs: build-and-test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: { name: build-log-etc } | |
- run: cat tmp/build-log.txt | |
- run: scripts/check-build-log.sh |