-
Notifications
You must be signed in to change notification settings - Fork 248
172 lines (148 loc) · 4.5 KB
/
ci.yml
File metadata and controls
172 lines (148 loc) · 4.5 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
169
170
171
172
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
concurrency:
group: ci-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
env:
NODE_VERSION: 24
PNPM_VERSION: 10.33.2
jobs:
scope:
runs-on: ubuntu-24.04
permissions:
contents: read
pull-requests: read
outputs:
docs_only: ${{ steps.scope.outputs.docs_only }}
docs_changed: ${{ steps.scope.outputs.docs_changed }}
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
fetch-tags: false
submodules: false
- name: Detect changed scope
id: scope
shell: bash
run: |
set -euo pipefail
if [ "${{ github.event_name }}" = "push" ]; then
BASE_SHA="${{ github.event.before }}"
BASE_REF="origin/${{ github.ref_name }}"
else
BASE_SHA="${{ github.event.pull_request.base.sha }}"
BASE_REF="origin/${{ github.event.pull_request.base.ref }}"
fi
if ! git cat-file -e "${BASE_SHA}^{commit}" 2>/dev/null; then
git fetch --no-tags origin "${BASE_REF#origin/}" --depth=1
fi
mapfile -t changed_files < <(git diff --name-only "${BASE_SHA}"...HEAD)
docs_changed=false
docs_only=true
changelog_present=false
changelog_scope_only=true
if [ "${#changed_files[@]}" -eq 0 ]; then
docs_only=false
fi
for file in "${changed_files[@]}"; do
case "$file" in
docs/**|README.md|CONTRIBUTING.md|CHANGELOG.md)
docs_changed=true
if [ "$file" = "CHANGELOG.md" ]; then
changelog_present=true
else
changelog_scope_only=false
fi
;;
.github/workflows/ci.yml)
docs_only=false
;;
*)
docs_only=false
changelog_scope_only=false
;;
esac
done
if [ "$docs_only" != "true" ] && [ "$changelog_present" = "true" ] && [ "$changelog_scope_only" = "true" ]; then
docs_only=true
fi
echo "docs_only=${docs_only}" >> "$GITHUB_OUTPUT"
echo "docs_changed=${docs_changed}" >> "$GITHUB_OUTPUT"
checks:
name: ${{ matrix.name }}
needs: scope
if: needs.scope.outputs.docs_only != 'true'
runs-on: ubuntu-24.04
permissions:
contents: read
strategy:
fail-fast: false
matrix:
include:
- name: Format
command: pnpm run format:check
- name: Typecheck
command: pnpm run typecheck
- name: Lint
command: pnpm run lint
- name: Build
command: pnpm run build
- name: Conformance Smoke
command: pnpm run conformance:run -- --case acp.v1.initialize.handshake
- name: Test
node_version: 22
command: pnpm run test:coverage
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 1
fetch-tags: false
submodules: false
- name: Setup pnpm
uses: pnpm/[email protected]
with:
version: ${{ env.PNPM_VERSION }}
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node_version || env.NODE_VERSION }}
check-latest: true
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run ${{ matrix.name }}
run: ${{ matrix.command }}
check-docs:
name: Docs
needs: scope
if: needs.scope.outputs.docs_changed == 'true'
runs-on: ubuntu-24.04
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 1
fetch-tags: false
submodules: false
- name: Setup pnpm
uses: pnpm/[email protected]
with:
version: ${{ env.PNPM_VERSION }}
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: ${{ env.NODE_VERSION }}
check-latest: true
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Check docs
run: pnpm run check:docs