-
Notifications
You must be signed in to change notification settings - Fork 17
104 lines (102 loc) · 3.17 KB
/
ci.yaml
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
name: Node.js CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
name: "Build and run integration tests"
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x, 19.x, 20.x, 21.x]
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- name: Build
run: pnpm run build
- name: Install dependencies
run: pnpm install -r
- name: Build Other Packages (excluding docs website)
run: pnpm run --filter="!website" -r build
- name: Run Integration Tests
run: pnpm run integration-tests
- name: Build Docs Website
working-directory: ./website
run: ./scripts/build.sh
test:
name: "JS Tests"
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x, 18.x, 19.x, 20.x, 21.x]
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- name: Build # Integration tests depend upon having .js versions created by tsc
run: pnpm run build
- name: Unit Tests
run: pnpm run test
lint:
name: "Lint"
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x, 19.x, 20.x, 21.x]
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- name: Lint
run: pnpm run lint
main-release:
name: Publish to NPM
runs-on: ubuntu-latest
environment: CI
if: github.event_name == 'push' && github.repository == 'captbaritone/grats'
needs: [build, test, lint]
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- name: Build latest (main) version
if: github.ref == 'refs/heads/main'
run: pnpm run build
- name: Set package version
run: pnpm version --no-git-tag-version 0.0.0-main-${RELEASE_COMMIT_SHA:0:8}
env:
RELEASE_COMMIT_SHA: ${{ github.sha }}
# https://github.com/pnpm/pnpm/issues/3141#issuecomment-1305563972
- name: Set publishing config
run: pnpm config set '//registry.npmjs.org/:_authToken' "${NODE_AUTH_TOKEN}"
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
- name: Publish
run: pnpm publish --tag main --access=public --no-git-checks