mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-11 15:04:52 +09:00
Cache build output and skip builds where unused
The prepare scripts (tsc --build and webpack) are most of the install time in every job, so their output is cached between runs. tsc's tsbuildinfo tracks file hashes and webpack's filesystem cache keeps its node_modules modules, so a restored cache makes both incremental. The lint and build-mod jobs never read the compiled output: eslint is not type-aware here and build_mod.js is plain JavaScript. They now install with --ignore-scripts. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
b38211469a
commit
992fc0fed7
2 files changed
+21
-2
No files matched your search
@@ -1,10 +1,13 @@
|
||||
name: Install dependencies
|
||||
description: Set up pnpm and Node.js, restore the pnpm store from the cache and run pnpm install
|
||||
description: Set up pnpm and Node.js, restore caches and run pnpm install
|
||||
|
||||
inputs:
|
||||
node-version:
|
||||
description: Node.js version passed to actions/setup-node
|
||||
required: true
|
||||
ignore-scripts:
|
||||
description: Skip the prepare scripts that build the workspace packages
|
||||
default: "false"
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
@@ -28,8 +31,22 @@ runs:
|
||||
key: pnpm-store-${{ runner.os }}-${{ steps.store.outputs.week }}-${{ hashFiles('**/package.json', 'pnpm-workspace.yaml') }}
|
||||
restore-keys: pnpm-store-${{ runner.os }}-
|
||||
|
||||
# The prepare scripts run tsc --build and webpack, both incremental when
|
||||
# their previous output is present. Every run saves its output and the
|
||||
# next run starts from the most recent one.
|
||||
- if: inputs.ignore-scripts != 'true'
|
||||
uses: actions/cache@v6
|
||||
with:
|
||||
path: |
|
||||
packages/*/dist
|
||||
plugins/*/dist
|
||||
packages/*/node_modules/.cache
|
||||
plugins/*/node_modules/.cache
|
||||
key: build-${{ runner.os }}-${{ github.sha }}
|
||||
restore-keys: build-${{ runner.os }}-
|
||||
|
||||
- shell: bash
|
||||
run: pnpm i --no-frozen-lockfile
|
||||
run: pnpm i --no-frozen-lockfile ${{ inputs.ignore-scripts == 'true' && '--ignore-scripts' || '' }}
|
||||
# Drop packages the restored store had but this install did not use, so
|
||||
# the snapshot does not grow with every version bump.
|
||||
- shell: bash
|
||||
|
||||
@@ -96,6 +96,7 @@ jobs:
|
||||
- uses: ./.github/actions/pnpm-install
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
ignore-scripts: true
|
||||
- run: pnpm run lint
|
||||
|
||||
build:
|
||||
@@ -106,6 +107,7 @@ jobs:
|
||||
- uses: ./.github/actions/pnpm-install
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
ignore-scripts: true
|
||||
- run: pnpm run build-mod
|
||||
# Upload build to artifacts
|
||||
- name: Upload build to artifacts
|
||||
|
||||
Reference in new issue
Block a user