Skip to content

Commit bcaa8df

Browse files
committed
Try to speed up CI
1 parent 9aa4f59 commit bcaa8df

File tree

1 file changed

+55
-15
lines changed

1 file changed

+55
-15
lines changed

.github/workflows/ci.yml

Lines changed: 55 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
name: CI
22

3-
on:
3+
on:
44
push:
55
pull_request:
66
# Only run on pull requests that change relevant files
77
paths-ignore:
8-
- '**.md'
9-
- 'docs/**'
10-
- '.gitignore'
11-
- 'LICENSE.txt'
8+
- "**.md"
9+
- "docs/**"
10+
- ".gitignore"
11+
- "LICENSE.txt"
1212

1313
jobs:
1414
# Fast job to install dependencies and cache them for other jobs
@@ -25,11 +25,11 @@ jobs:
2525
uses: actions/setup-node@v4
2626
with:
2727
node-version: 20.x
28-
cache: 'yarn'
28+
cache: "yarn"
2929
- name: Install Dependencies
3030
run: yarn install --frozen-lockfile
3131

32-
# Build job - runs in parallel with lint and test jobs
32+
# Build job - Vite build for demo site
3333
build:
3434
runs-on: ubuntu-latest
3535
needs: setup
@@ -39,16 +39,15 @@ jobs:
3939
uses: actions/setup-node@v4
4040
with:
4141
node-version: 20.x
42-
cache: 'yarn'
42+
cache: "yarn"
4343
- name: Install Dependencies
4444
run: yarn install --frozen-lockfile
45-
- name: Build
45+
- name: Build Vite Demo
4646
run: |
4747
# Set CI environment variable for optimized builds
4848
export CI=true
4949
yarn workspace ani-cursor build
5050
yarn workspace webamp build
51-
yarn workspace webamp build-library
5251
env:
5352
NODE_ENV: production
5453
- name: Cache build artifacts
@@ -59,6 +58,37 @@ jobs:
5958
packages/*/dist
6059
key: build-artifacts-${{ github.sha }}
6160

61+
# Build Library job - Rollup build for library bundles
62+
build-library:
63+
runs-on: ubuntu-latest
64+
needs: setup
65+
steps:
66+
- uses: actions/checkout@v4
67+
- name: Use Node.js 20.x
68+
uses: actions/setup-node@v4
69+
with:
70+
node-version: 20.x
71+
cache: "yarn"
72+
- name: Install Dependencies
73+
run: yarn install --frozen-lockfile
74+
- name: Build Library Bundles
75+
run: |
76+
# Set CI environment variable for optimized builds
77+
export CI=true
78+
yarn workspace ani-cursor build
79+
yarn workspace webamp build-library
80+
env:
81+
NODE_ENV: production
82+
- name: Cache library artifacts
83+
uses: actions/cache@v4
84+
with:
85+
path: |
86+
packages/webamp/built/*.js
87+
packages/webamp/built/*.mjs
88+
packages/webamp/built/*.map
89+
packages/webamp/built/*.html
90+
key: library-artifacts-${{ github.sha }}
91+
6292
# Lint job - runs in parallel
6393
lint:
6494
runs-on: ubuntu-latest
@@ -69,7 +99,7 @@ jobs:
6999
uses: actions/setup-node@v4
70100
with:
71101
node-version: 20.x
72-
cache: 'yarn'
102+
cache: "yarn"
73103
- name: Install Dependencies
74104
run: yarn install --frozen-lockfile
75105
- name: Lint
@@ -87,7 +117,7 @@ jobs:
87117
uses: actions/setup-node@v4
88118
with:
89119
node-version: 20.x
90-
cache: 'yarn'
120+
cache: "yarn"
91121
- name: Install Dependencies
92122
run: yarn install --frozen-lockfile
93123
- name: Run Unit Tests
@@ -123,14 +153,14 @@ jobs:
123153
name: Publish to NPM
124154
runs-on: ubuntu-latest
125155
if: github.event_name == 'push' && github.repository == 'captbaritone/webamp'
126-
needs: [build, lint, test]
156+
needs: [build, build-library, lint, test]
127157
steps:
128158
- uses: actions/checkout@v4
129159
- uses: actions/setup-node@v4
130160
with:
131161
node-version: 20.x
132162
registry-url: https://registry.npmjs.org/
133-
cache: 'yarn'
163+
cache: "yarn"
134164
- name: Install dependencies
135165
run: yarn install --frozen-lockfile
136166
- name: Restore build artifacts
@@ -141,6 +171,16 @@ jobs:
141171
packages/*/dist
142172
key: build-artifacts-${{ github.sha }}
143173
fail-on-cache-miss: true
174+
- name: Restore library artifacts
175+
uses: actions/cache@v4
176+
with:
177+
path: |
178+
packages/webamp/built/*.js
179+
packages/webamp/built/*.mjs
180+
packages/webamp/built/*.map
181+
packages/webamp/built/*.html
182+
key: library-artifacts-${{ github.sha }}
183+
fail-on-cache-miss: true
144184
- name: Set version
145185
if: github.ref == 'refs/heads/master'
146186
run: |
@@ -156,7 +196,7 @@ jobs:
156196
if: github.ref == 'refs/heads/master' || github.ref_type == 'tag' && startsWith(github.ref_name, 'v')
157197
# Use pre-built artifacts instead of rebuilding
158198
run: |
159-
npm publish ${TAG}
199+
npm publish ${TAG} --ignore-scripts
160200
env:
161201
TAG: ${{ github.ref == 'refs/heads/master' && '--tag=next' || ''}}
162202
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

0 commit comments

Comments
 (0)