-
Notifications
You must be signed in to change notification settings - Fork 671
115 lines (97 loc) · 3 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
name: CI
on:
pull_request:
types: [opened, synchronize]
push:
branches:
- develop
- stable
# - ci/* # uncomment this when workin on CI without PR
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
with:
version: 9.12.1
- uses: actions/setup-node@v3
with:
node-version: 20.x
cache: 'pnpm'
- name: Install
run: pnpm install --no-optional
- name: Run linter
run: pnpm lint --quiet
- name: Run tests and collect coverage
run: pnpm test:coverage
- name: Typecheck
run: pnpm typecheck
- name: Build
run: pnpm build
- name: Run Codechecks
run: pnpm codechecks
env:
CC_SECRET: ${{ secrets.CC_SECRET }}
if: ${{ env.CC_SECRET != '' }}
# Dependabot and PRs from forks should not release canaries,
# but secrets and env vars cannot be read in `job.if`, so we check if
# GH_TOKEN is present before attempting to release.
release_check:
runs-on: ubuntu-latest
needs: [build]
steps:
- id: can_release
run: echo 'CAN_RELEASE=${{ env.CAN_RELEASE }}' >> $GITHUB_OUTPUT
env:
CAN_RELEASE: ${{ secrets.AUTO_RELEASE_GH_TOKEN != '' }}
outputs:
CAN_RELEASE: ${{ steps.can_release.outputs.CAN_RELEASE }}
release:
runs-on: ubuntu-latest
needs: [release_check]
if: >
!contains(github.event.head_commit.message, 'ci skip') &&
!contains(github.event.head_commit.message, 'skip ci') && (
github.event_name == 'push' ||
github.event.pull_request.head.repo.full_name == github.repository
) && (
needs.release_check.outputs.CAN_RELEASE == 'true'
)
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 100
fetch-tags: true
- uses: pnpm/action-setup@v2
with:
version: 9.12.1
- uses: actions/setup-node@v3
with:
node-version: 20.x
cache: 'pnpm'
registry-url: 'https://registry.npmjs.org'
- name: Install
run: pnpm install --no-optional
- name: Queue in release turnstile
id: turnstyle
continue-on-error: true
uses: softprops/turnstyle@v1
with:
abort-after-seconds: 600
- name: Create release
if: steps.turnstyle.outcome == 'success'
# failing to release a canary because of network problems or duplicate tag shouldn't give the same message as failing tests
# continue-on-error: true
env:
GITHUB_TOKEN: ${{ secrets.AUTO_RELEASE_GH_TOKEN }}
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
run: pnpm release
- name: Check published prerelease
if: github.ref == 'refs/heads/develop'
run: |
cd scripts/typecheck-built-files
pnpm start