|
9 | 9 | # Vitest auto retry on flaky segfault
|
10 | 10 | VITEST_SEGFAULT_RETRY: 3
|
11 | 11 |
|
| 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 | + |
12 | 16 | on:
|
13 | 17 | push:
|
14 | 18 | branches:
|
|
22 | 26 | - v2.*
|
23 | 27 | - v3.*
|
24 | 28 | pull_request:
|
25 |
| - paths-ignore: |
26 |
| - - "docs/**" |
27 |
| - - "packages/create-vite/**" |
28 | 29 | workflow_dispatch:
|
29 | 30 |
|
30 | 31 | concurrency:
|
31 | 32 | group: ${{ github.workflow }}-${{ github.event.number || github.sha }}
|
32 | 33 | cancel-in-progress: true
|
33 | 34 |
|
34 | 35 | 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 }} |
36 | 63 | timeout-minutes: 20
|
37 | 64 | runs-on: ${{ matrix.os }}
|
38 | 65 | strategy:
|
@@ -101,3 +128,43 @@ jobs:
|
101 | 128 |
|
102 | 129 | - name: Test build
|
103 | 130 | 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 | + |
| 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