-
Notifications
You must be signed in to change notification settings - Fork 3
139 lines (132 loc) · 4.28 KB
/
main.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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
name: CI & Release
on:
push:
branches:
- alpha
- beta
- next
- main
pull_request:
branches:
- alpha
- beta
- next
- main
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
permissions:
contents: read # for checkout
jobs:
build:
runs-on: ubuntu-latest
name: Lint & Build
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@d882d12c64e032187b2edb46d3a0d003b7a43598 # v2.4.0
- uses: actions/setup-node@v3
with:
cache: pnpm
node-version: lts/*
- run: corepack enable && pnpm --version
- run: pnpm install
- run: pnpm lint
- run: pnpm build
- uses: actions/upload-artifact@v3
name: Cache build output
with:
name: build-output
path: |
bin/
dist/
playground:
needs: build
runs-on: ubuntu-latest
name: Playground builds
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@d882d12c64e032187b2edb46d3a0d003b7a43598 # v2.4.0
- uses: actions/setup-node@v3
with:
cache: pnpm
node-version: lts/*
- run: corepack enable && pnpm --version
- run: pnpm install
- uses: actions/download-artifact@v3
name: Restore build output
with:
name: build-output
- run: pnpm playground:build
env:
NODE_OPTIONS: --max_old_space_size=8192
- name: Archive build outputs of runtime tests
uses: actions/upload-artifact@v3
with:
name: runtime-dist
path: |
playground/runtime-*/dist
playground/runtime-*/.next
!playground/runtime-*/.next/cache
test:
needs: build
runs-on: ${{ matrix.platform }}
name: Node.js ${{ matrix.node-version }} / ${{ matrix.platform }}
strategy:
# A test failing on windows doesn't mean it'll fail on macos. It's useful to let all tests run to its completion to get the full picture
fail-fast: false
matrix:
# Run the testing suite on each major OS with the latest LTS release of Node.js
platform: [macos-latest, ubuntu-latest, windows-latest]
node-version: [lts/*]
# It makes sense to also test latest version of Node.js, on ubuntu-only since it's the fastest CI runner
# @TODO re-enable after the nightly is stable
# include:
# - platform: ubuntu-latest
# Test the actively developed version that will become the latest LTS release next October
# node-version: current
steps:
- name: Set git to use LF
if: matrix.platform == 'windows-latest'
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- uses: actions/checkout@v4
- uses: pnpm/action-setup@d882d12c64e032187b2edb46d3a0d003b7a43598 # v2.4.0
- uses: actions/setup-node@v3
with:
cache: pnpm
node-version: ${{ matrix.node-version }}
- run: corepack enable && pnpm --version
- run: pnpm install
- uses: actions/download-artifact@v3
name: Restore build output
with:
name: build-output
- run: pnpm test
release:
permissions:
contents: write # to be able to publish a GitHub release
issues: write # to be able to comment on released issues
pull-requests: write # to be able to comment on released pull requests
id-token: write # to enable use of OIDC for npm provenance
name: "Semantic release"
needs: [test, playground]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
# Need to fetch entire commit history to
# analyze every commit since last release
fetch-depth: 0
- uses: pnpm/action-setup@d882d12c64e032187b2edb46d3a0d003b7a43598 # v2.4.0
- uses: actions/setup-node@v3
with:
cache: pnpm
node-version: lts/*
- run: corepack enable && pnpm --version
- run: pnpm install
# Branches that will release new versions are defined in .releaserc.json
- run: pnpm release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}