-
Notifications
You must be signed in to change notification settings - Fork 24
139 lines (137 loc) · 4.32 KB
/
Copy pathci.yaml
File metadata and controls
139 lines (137 loc) · 4.32 KB
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: Node.js CI
on:
push:
branches: [main]
tags: ["v*"]
pull_request:
branches: [main]
jobs:
build:
name: "Build and run integration tests"
runs-on: ubuntu-latest
strategy:
matrix:
node-version: &node-versions
- 20.x # LTS
- 22.x # LTS
- 24.x # LTS
typescript-version: &typescript-versions
- "5.5"
- "5.7"
- "~5.9"
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 9.3.0
- 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: Install TypeScript ${{ matrix.typescript-version }}
run: pnpm add -D typescript@${{ matrix.typescript-version }}
- name: Build
run: pnpm run build
- name: Install dependencies
run: pnpm install -r
- name: Build Grats for each project
run: pnpm run --filter="!website" -r grats
- name: Assert no files changed after grats generation
run: |
if [ -n "$(git status --porcelain)" ]; then
echo "Files were modified after running grats:"
git status --porcelain
git diff
exit 1
fi
- name: Build Other Packages (excluding docs website)
run: pnpm run --filter="!website" -r build
- name: Test Example Projects
run: pnpm run test-example-projects
- name: Build Docs Website
working-directory: ./website
run: ./scripts/build.sh
test:
name: "JS Tests"
runs-on: ubuntu-latest
strategy:
matrix:
node-version: *node-versions
typescript-version: *typescript-versions
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 9.3.0
- 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: Install TypeScript ${{ matrix.typescript-version }}
run: pnpm add -D typescript@${{ matrix.typescript-version }}
- 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: *node-versions
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 9.3.0
- 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
publish:
name: Publish to NPM
runs-on: ubuntu-latest
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')) && github.repository == 'captbaritone/grats'
needs: [build, test, lint]
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 9.3.0
- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: "20.x"
registry-url: "https://registry.npmjs.org"
cache: "pnpm"
- name: Ensure npm 11.5.1 or later for trusted publishing
run: npm install -g npm@11.7.0
- name: Install dependencies
run: pnpm install
- name: Build
run: pnpm run build
- name: Set dev version (main branch)
if: github.ref == 'refs/heads/main'
run: pnpm version --no-git-tag-version 0.0.0-main-${RELEASE_COMMIT_SHA:0:8}
env:
RELEASE_COMMIT_SHA: ${{ github.sha }}
- name: Publish dev version (main branch)
if: github.ref == 'refs/heads/main'
run: pnpm publish --tag main --access=public --no-git-checks
- name: Publish release (tag)
if: startsWith(github.ref, 'refs/tags/v')
run: pnpm publish --access=public --no-git-checks