-
Notifications
You must be signed in to change notification settings - Fork 1
118 lines (111 loc) · 3.52 KB
/
ci.yml
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
name: CI
run-name: '${{ github.workflow }} (${{ github.ref_name }}): ${{ github.event.pull_request.title }}'
on:
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
env:
NODE_VERSION: '18'
# Declare default permissions as read only.
permissions: read-all
jobs:
setup:
name: Setup
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
pull-requests: read
outputs:
typescript: ${{ steps.filter.outputs.typescript }}
renovate-config: ${{ steps.filter.outputs.renovate-config }}
if: ${{ !github.event.pull_request.draft }}
steps:
- name: Checkout Repository
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
- name: Initialize
uses: ./.github/actions/setup-bun
- name: Check diff targets by path filters
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
id: filter
with:
filters: |
typescript:
- 'pnpm-lock.yaml'
- '**/tsconfig*.json'
- '**/*.ts'
- '**/*.tsx'
renovate-config:
- '.github/renovate.json'
renovate-config-lint:
name: Renovate config lint
runs-on: ubuntu-latest
timeout-minutes: 5
needs: [setup]
if: ${{ needs.setup.outputs.renovate-config == 'true' }}
steps:
- name: Checkout Repository
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
with:
sparse-checkout: |
.github/actions/setup-node-and-pnpm/action.yml
.github/renovate.json
package.json
pnpm-lock.yaml
prettier.config.mjs
sparse-checkout-cone-mode: false
- name: Initialize
uses: ./.github/actions/setup-node-and-pnpm
with:
node-version: ${{ env.NODE_VERSION }}
- name: Check format by Prettier
run: pnpm exec prettier --check .github/renovate.json
- name: Validate Renovate config
run: pnpm --package renovate dlx renovate-config-validator --strict
lint:
name: Lint
runs-on: ubuntu-latest
timeout-minutes: 3
needs: [setup]
steps:
- name: Checkout Repository
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
- name: Initialize
uses: ./.github/actions/setup-bun
- name: Run format check
run: bun run lint:prettier
- name: Run lint
run: bun run lint:eslint
typecheck:
name: Type check
runs-on: ubuntu-latest
timeout-minutes: 3
needs: [setup]
if: ${{ needs.setup.outputs.typescript == 'true' }}
steps:
- name: Checkout Repository
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
- name: Initialize
uses: ./.github/actions/setup-bun
- name: Run type check
run: bun run typecheck
test:
name: Test
runs-on: ubuntu-latest
timeout-minutes: 5
needs: [lint, typecheck]
if: ${{ !(failure() || contains(needs.*.result, 'cancelled')) }}
steps:
- name: Checkout Repository
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
- name: Initialize
uses: ./.github/actions/setup-bun
- name: Run test
run: bun run test
- name: Upload coverage to Codecov
uses: codecov/codecov-action@6d798873df2b1b8e5846dba6fb86631229fbcb17 # v4.4.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true