-
Notifications
You must be signed in to change notification settings - Fork 74
56 lines (50 loc) · 1.76 KB
/
bundle.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
name: Bundle
on:
workflow_call:
jobs:
test-tree-shaking-pull-request:
name: ${{ matrix.bundler }} ${{ matrix.target }} ${{ matrix.module }}
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
bundler: [esbuild, rollup, webpack]
target: [es5, es2015, esnext]
module: [cjs, esm, umd]
include:
- {bundler: esbuild, target: ix}
- {bundler: rollup, target: ix}
- {bundler: webpack, target: ix}
steps:
- name: Setup node v22.x
uses: actions/setup-node@v4
with:
node-version: 22.x
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Construct cache keys
run: |
echo node_modules_key='["${{ runner.os }}", "node_modules", "22.x", "${{ hashFiles('package.json', 'yarn.lock') }}"]' >> $GITHUB_ENV;
echo targets_key='["${{ runner.os }}", "targets", "22.x", "ix", "", "${{ hashFiles('package.json', 'yarn.lock', 'tsconfig.json', 'src/**/*', 'tsconfigs/**/*') }}"]' >> $GITHUB_ENV;
- name: Cache targets
uses: actions/cache@v4
with:
key: ${{ join(fromJSON(env.targets_key), '-') }}
path: targets
- name: Cache node_modules
uses: actions/cache@v4
with:
key: ${{ join(fromJSON(env.node_modules_key), '-') }}
path: node_modules
- name: Test ${{ matrix.bundler }} tree-shaking
env:
t: "${{ matrix.target }}"
m: "${{ matrix.module }}"
run: |
integration/make-files-to-bundle.sh
if test "${t}" != ix; then
yarn build ${t:+-t ${t}} ${m:+-m ${m}}
fi
yarn gulp bundle${t:+:${t}}${m:+:${m}}:${{ matrix.bundler }}