-
Notifications
You must be signed in to change notification settings - Fork 0
150 lines (140 loc) · 4.3 KB
/
Copy pathci.yml
File metadata and controls
150 lines (140 loc) · 4.3 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
name: CI
on:
push:
branches: [main]
pull_request:
types:
[
opened,
synchronize,
reopened,
ready_for_review,
labeled,
]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
trust-check:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
outputs:
trusted: ${{ steps.check.outputs.trusted }}
steps:
- name: Check if PR is trusted
id: check
env:
HEAD_REPO: >-
${{ github.event.pull_request.head.repo.full_name }}
BASE_REPO: ${{ github.repository }}
HAS_RUN_CI_LABEL: >-
${{ contains(github.event.pull_request.labels.*.name, 'run-ci') }}
run: |
if [[ "$HEAD_REPO" == "$BASE_REPO" ]]; then
echo "trusted=true" >> "$GITHUB_OUTPUT"
elif [[ "$HAS_RUN_CI_LABEL" == "true" ]]; then
echo "trusted=true" >> "$GITHUB_OUTPUT"
else
echo "trusted=false" >> "$GITHUB_OUTPUT"
echo "::notice::Fork PR without 'run-ci' label — CI skipped."
fi
lint:
name: Lint
if: >-
always()
&& (github.event_name != 'pull_request'
|| needs.trust-check.outputs.trusted == 'true')
needs: [trust-check]
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
- run: bun install --frozen-lockfile
- run: bun run lint
- run: bun run format:check
version-sync:
name: Version sync
if: >-
always()
&& (github.event_name != 'pull_request'
|| needs.trust-check.outputs.trusted == 'true')
needs: [trust-check]
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
with:
node-version: "22.21.1"
- run: node scripts/version-sync.mjs check
test:
name: Test
if: >-
always()
&& (github.event_name != 'pull_request'
|| needs.trust-check.outputs.trusted == 'true')
needs: [trust-check]
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
- run: bun install --frozen-lockfile
- run: bun test
oracle:
name: Oracle
if: >-
always()
&& (github.event_name != 'pull_request'
|| needs.trust-check.outputs.trusted == 'true')
needs: [trust-check]
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
- run: bun install --frozen-lockfile
- run: ORACLE_SAMPLES=500 bun run oracle
build:
name: Build
if: >-
always()
&& (github.event_name != 'pull_request'
|| needs.trust-check.outputs.trusted == 'true')
needs: [trust-check]
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
- run: bun install --frozen-lockfile
- run: bun run typecheck
- run: bun run build
- run: bun run sync-exports:check
pack:
name: Pack
if: >-
always()
&& (github.event_name != 'pull_request'
|| needs.trust-check.outputs.trusted == 'true')
needs: [trust-check]
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
with:
node-version: "22.21.1"
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
- run: bun install --frozen-lockfile
- run: npm pack --json --ignore-scripts --dry-run