-
Notifications
You must be signed in to change notification settings - Fork 2
105 lines (100 loc) · 3.24 KB
/
ci.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
name: "CI"
on:
push:
branches:
- "main"
pull_request:
jobs:
check:
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v3"
with:
fetch-depth: 0
- run: sudo apt-get install -y valgrind
- uses: pnpm/action-setup@v2
- uses: actions/setup-node@v3
with:
cache: pnpm
node-version-file: .nvmrc
- run: pnpm install --frozen-lockfile --prefer-offline
- run: pnpm moon check --all
codspeed:
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v3"
with:
fetch-depth: 0
- run: sudo apt-get install -y valgrind
- uses: pnpm/action-setup@v2
- uses: actions/setup-node@v3
with:
cache: pnpm
node-version-file: .nvmrc
- run: pnpm install --frozen-lockfile --prefer-offline
- run: pnpm moon run :build
- name: Run benchmarks
uses: CodSpeedHQ/action@v1
with:
run: pnpm moon run :bench
list-examples:
runs-on: "ubuntu-latest"
name: List examples
outputs:
examples: ${{ steps.list-examples.outputs.examples }}
steps:
- uses: "actions/checkout@v3"
# list the directories in ./examples and output them to a github action workflow variables as a JSON array
- run: |
examples=$(find ./examples -maxdepth 1 -mindepth 1 -type d -printf '%f\n' | jq -R -s -c 'split("\n") | map(select(length > 0))')
echo "::set-output name=examples::$examples"
id: list-examples
node-versions:
runs-on: "ubuntu-latest"
name: "${{ matrix.example }} on Node ${{ matrix.node-version }}"
needs: list-examples
strategy:
matrix:
node-version: ["14", "16", "18", "20"]
example: ${{ fromJson(needs.list-examples.outputs.examples) }}
include:
# tinybench does not support node 14
- node-version: "14"
pnpm-version: "7"
skip-tinybench: true
exclude:
# esbuild-register does not work well with node 14
- node-version: "14"
example: with-typescript-cjs
- node-version: "14"
example: with-typescript-esm
- node-version: "14"
example: with-typescript-simple-esm
fail-fast: false
steps:
- uses: "actions/checkout@v3"
with:
fetch-depth: 0
- run: sudo apt-get install -y valgrind
- uses: pnpm/action-setup@v2
with:
version: ${{ matrix.pnpm-version || '' }}
- uses: actions/setup-node@v3
with:
cache: pnpm
node-version: ${{ matrix.node-version }}
- run: pnpm install --frozen-lockfile --prefer-offline
- run: pnpm moon run :build
- name: Run benchmarks with tinybench-plugin
if: matrix.skip-tinybench != true
uses: CodSpeedHQ/action@feat/v8-flags-from-codspeed-node-core
with:
run: pnpm --filter ${{ matrix.example }} bench-tinybench
env:
CODSPEED_SKIP_UPLOAD: true
- name: Run benchmarks with benchmark.js-plugin
uses: CodSpeedHQ/action@feat/v8-flags-from-codspeed-node-core
with:
run: pnpm --filter ${{ matrix.example }} bench-benchmark-js
env:
CODSPEED_SKIP_UPLOAD: true