-
-
Notifications
You must be signed in to change notification settings - Fork 6
168 lines (161 loc) · 4.57 KB
/
ci.yml
File metadata and controls
168 lines (161 loc) · 4.57 KB
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
name: CI
on:
push:
branches: [main, release/**]
paths:
- 'src/**'
- 'test/**'
- 'script/**'
- 'package.json'
- 'bun.lock'
- '.github/workflows/ci.yml'
pull_request:
paths:
- 'src/**'
- 'test/**'
- 'script/**'
- 'package.json'
- 'bun.lock'
- '.github/workflows/ci.yml'
workflow_call:
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
lint:
name: Lint & Typecheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
- uses: actions/cache@v4
id: cache
with:
path: node_modules
key: node-modules-${{ hashFiles('bun.lock') }}
- if: steps.cache.outputs.cache-hit != 'true'
run: bun install --frozen-lockfile
- run: bun run lint
- run: bun run typecheck
test:
name: Test
runs-on: ubuntu-latest
permissions:
contents: read
actions: read
pull-requests: write
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
- uses: actions/cache@v4
id: cache
with:
path: node_modules
key: node-modules-${{ hashFiles('bun.lock') }}
- if: steps.cache.outputs.cache-hit != 'true'
run: bun install --frozen-lockfile
- name: Test
env:
SENTRY_TEST_AUTH_TOKEN: ${{ secrets.SENTRY_TEST_AUTH_TOKEN }}
SENTRY_TEST_ORG: ${{ secrets.SENTRY_TEST_ORG }}
SENTRY_TEST_PROJECT: ${{ secrets.SENTRY_TEST_PROJECT }}
run: bun test --coverage --coverage-reporter=lcov
- name: Upload Coverage
uses: getsentry/codecov-action@main
with:
token: ${{ secrets.GITHUB_TOKEN }}
post-pr-comment: true
build-binary:
name: Build Binary (${{ matrix.target }})
needs: [lint, test]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
# Native builds (can run smoke test)
- target: darwin-arm64
os: macos-latest
can-test: true
- target: linux-x64
os: ubuntu-latest
can-test: true
- target: windows-x64
os: windows-latest
can-test: true
# Cross-compiled builds (cannot run smoke test)
- target: darwin-x64
os: macos-latest
can-test: false
- target: linux-arm64
os: ubuntu-latest
can-test: false
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
- uses: actions/cache@v4
id: cache
with:
path: node_modules
key: node-modules-${{ matrix.os }}-${{ hashFiles('bun.lock') }}
- if: steps.cache.outputs.cache-hit != 'true'
run: bun install --frozen-lockfile
- name: Build
env:
SENTRY_CLIENT_ID: ${{ vars.SENTRY_CLIENT_ID }}
run: bun run build --target ${{ matrix.target }}
- name: Smoke test
if: matrix.can-test
shell: bash
run: |
if [[ "${{ matrix.target }}" == "windows-x64" ]]; then
./dist/sentry-windows-x64/bin/sentry.exe --help
else
./dist/sentry-${{ matrix.target }}/bin/sentry --help
fi
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: sentry-${{ matrix.target }}
path: dist/sentry-*/bin/sentry*
build-npm:
name: Build npm Package
needs: [lint, test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
- uses: actions/setup-node@v4
with:
node-version: '22'
- uses: actions/cache@v4
id: cache
with:
path: node_modules
key: node-modules-${{ hashFiles('bun.lock') }}
- if: steps.cache.outputs.cache-hit != 'true'
run: bun install --frozen-lockfile
- name: Bundle
env:
SENTRY_CLIENT_ID: ${{ vars.SENTRY_CLIENT_ID }}
run: bun run bundle
- name: Smoke test (Node.js)
run: node dist/bin.mjs --help
- run: npm pack
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: npm-package
path: '*.tgz'
merge-artifacts:
name: Merge Artifacts
needs: [build-binary, build-npm]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
- uses: actions/upload-artifact@v4
with:
name: ${{ github.sha }}
path: |
sentry-*/
npm-package/*.tgz