Skip to content

Commit 2bee2f3

Browse files
authored
chore: merge back CI jobs using tj-actions/changed-files (#11548)
1 parent 4f7a48f commit 2bee2f3

File tree

2 files changed

+71
-74
lines changed

2 files changed

+71
-74
lines changed

.github/workflows/ci-lint.yml

-70
This file was deleted.

.github/workflows/ci.yml

+71-4
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ env:
99
# Vitest auto retry on flaky segfault
1010
VITEST_SEGFAULT_RETRY: 3
1111

12+
# Remove default permissions of GITHUB_TOKEN for security
13+
# https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs
14+
permissions: {}
15+
1216
on:
1317
push:
1418
branches:
@@ -22,17 +26,40 @@ on:
2226
- v2.*
2327
- v3.*
2428
pull_request:
25-
paths-ignore:
26-
- "docs/**"
27-
- "packages/create-vite/**"
2829
workflow_dispatch:
2930

3031
concurrency:
3132
group: ${{ github.workflow }}-${{ github.event.number || github.sha }}
3233
cancel-in-progress: true
3334

3435
jobs:
35-
build:
36+
diff:
37+
timeout-minutes: 2
38+
runs-on: ubuntu-latest
39+
name: "Diff files"
40+
outputs:
41+
runTest: ${{ steps.skip-tests-files.outputs.only_changed != 'true' }}
42+
steps:
43+
- name: Checkout
44+
uses: actions/checkout@v3
45+
with:
46+
# Assume PRs are less than 50 commits
47+
fetch-depth: 50
48+
49+
- name: Get changed files
50+
id: skip-tests-files
51+
uses: tj-actions/changed-files@1d1287f9fafd92be283f99b781fb5f00f00dd471 # v35.2.1
52+
with:
53+
files: |
54+
docs/**
55+
.github/**
56+
!.github/workflows/ci.yml
57+
packages/create-vite/template**
58+
**.md
59+
60+
test:
61+
needs: diff
62+
if: ${{ needs.diff.outputs.runTest }}
3663
timeout-minutes: 20
3764
runs-on: ${{ matrix.os }}
3865
strategy:
@@ -101,3 +128,43 @@ jobs:
101128

102129
- name: Test build
103130
run: pnpm run test-build
131+
132+
lint:
133+
timeout-minutes: 10
134+
runs-on: ubuntu-latest
135+
name: "Lint: node-18, ubuntu-latest"
136+
steps:
137+
- uses: actions/checkout@v3
138+
139+
- name: Install pnpm
140+
uses: pnpm/[email protected]
141+
142+
- name: Set node version to 18
143+
uses: actions/setup-node@v3
144+
with:
145+
node-version: 18
146+
cache: "pnpm"
147+
148+
- name: Install deps
149+
run: pnpm install
150+
151+
- name: Build
152+
run: pnpm run build
153+
154+
- name: Lint
155+
run: pnpm run lint
156+
157+
- name: Check formatting
158+
run: pnpm prettier --check .
159+
160+
- name: Typecheck
161+
run: pnpm run typecheck
162+
163+
- name: Test docs
164+
run: pnpm run test-docs
165+
166+
# From https://github.com/rhysd/actionlint/blob/main/docs/usage.md#use-actionlint-on-github-actions
167+
- name: Check workflow files
168+
run: |
169+
bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
170+
./actionlint -color -shellcheck=""

0 commit comments

Comments
 (0)