-
Notifications
You must be signed in to change notification settings - Fork 0
146 lines (146 loc) · 5.35 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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
name: ci
on:
push:
branches: [master]
paths-ignore: ['**.md']
pull_request: {}
workflow_dispatch: {}
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.head.label || github.run_id }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- run: bun install --frozen-lockfile
- run: bun run build
- uses: actions/upload-artifact@v4
with:
name: build
path: packages/*/dist/**
test:
needs: build
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest, windows-latest, macos-latest]
name: test-bun (${{ matrix.platform }})
runs-on: ${{ matrix.platform }}
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
# bun install on windows is currently slow, cache it
- uses: actions/cache@v4
if: ${{ matrix.platform == 'windows-latest' }}
with:
path: ~/.bun/install/cache
key: ${{ runner.os }}-bun-${{ hashFiles('bun.lockb') }}
restore-keys: |
${{ runner.os }}-bun-
- uses: actions/download-artifact@v4
with:
name: build
path: packages
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- run: bun install --frozen-lockfile
- run: bun run test --coverage --coverage-reporter=lcov --coverage-reporter=text
- name: Report coverage
if: ${{ matrix.platform == 'ubuntu-latest' && github.repository_owner == 'maxmilton' }}
run: |
curl -LO https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 \
-LO https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64.sha256
grep test-reporter-latest-linux-amd64 test-reporter-latest-linux-amd64.sha256 | shasum -a 256 -c -
mv test-reporter-latest-linux-amd64 test-reporter
chmod +x ./test-reporter
./test-reporter format-coverage -t lcov -o coverage/codeclimate.json coverage/lcov.info
./test-reporter upload-coverage
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
test-node:
needs: build
strategy:
fail-fast: false
matrix:
node-version: [12, 14, 16, 18, 20, 22]
platform: [ubuntu-latest, windows-latest, macos-latest]
exclude:
# no prebuilt node <=14 for darwin arm64 (macos-latest; macos-14)
- node-version: 12
platform: macos-latest
- node-version: 14
platform: macos-latest
include:
- node-version: 12
platform: macos-13
- node-version: 14
platform: macos-13
name: test-node (v${{ matrix.node-version }} ${{ matrix.platform }})
runs-on: ${{ matrix.platform }}
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
# bun install on windows is currently slow, cache it
- uses: actions/cache@v4
if: ${{ matrix.platform == 'windows-latest' }}
with:
path: ~/.bun/install/cache
key: ${{ runner.os }}-bun-${{ hashFiles('bun.lockb') }}
restore-keys: |
${{ runner.os }}-bun-
- uses: actions/download-artifact@v4
with:
name: build
path: packages
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- run: bun install --frozen-lockfile
- run: bun install --global pnpm@6
if: ${{ matrix.node-version == 12 }}
- run: bun install --global pnpm@7
if: ${{ matrix.node-version == 14 }}
- run: bun install --global pnpm@8
if: ${{ matrix.node-version == 16 }}
- run: bun install --global pnpm
if: ${{ matrix.node-version >= 18 }}
- run: pnpm run test:node
if : ${{ matrix.node-version < 22 || matrix.platform != 'ubuntu-latest' }}
- run: pnpm run test:node:c8
if : ${{ matrix.node-version == 22 && matrix.platform == 'ubuntu-latest' }}
- name: Report coverage
if: ${{ matrix.node-version == 22 && matrix.platform == 'ubuntu-latest' && github.repository_owner == 'maxmilton' }}
run: |
curl -LO https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 \
-LO https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64.sha256
grep test-reporter-latest-linux-amd64 test-reporter-latest-linux-amd64.sha256 | shasum -a 256 -c -
mv test-reporter-latest-linux-amd64 test-reporter
chmod +x ./test-reporter
./test-reporter format-coverage -t lcov -o coverage/codeclimate.json coverage/lcov.info
./test-reporter upload-coverage
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
lint:
needs: build
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: build
path: packages
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- run: bun install --frozen-lockfile
- run: bun run lint