-
Notifications
You must be signed in to change notification settings - Fork 18
117 lines (104 loc) · 3.32 KB
/
build.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
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: ApiDOM Monorepo Build
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
env:
CPU_CORES: 2
jobs:
lint-commit-messages:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # necessary for linting commit messages
ref: ${{ github.event.pull_request.head.sha }} # necessary to check out pull request HEAD commit instead of merge commit
- name: Use Node.js 20
uses: actions/setup-node@v3
with:
node-version: 20
cache: 'npm'
cache-dependency-path: 'package-lock.json'
- name: Install dependencies
run: npm ci
- name: Lint commit message
if: github.ref != 'refs/heads/main' && github.actor != 'dependabot[bot]'
run: |
npx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js 20
uses: actions/setup-node@v3
with:
node-version: 20
cache: 'npm'
cache-dependency-path: 'package-lock.json'
- name: Install dependencies
run: npm ci
- name: Generate typescript declarations
run: npm run typescript:declaration
working-directory: ./packages/apidom-error
- name: Lint code
run: npm run lint
check-typescript-types:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js 20
uses: actions/setup-node@v3
with:
node-version: 20
cache: 'npm'
cache-dependency-path: 'package-lock.json'
- name: Install dependencies
run: npm ci
- name: Generate typescript declarations
run: npm run typescript:declaration
- name: Check TypeScript types
run: npm run typescript:check-types
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js 20
uses: actions/setup-node@v3
with:
node-version: 20
cache: 'npm'
cache-dependency-path: 'package-lock.json'
- name: Install dependencies
run: npm ci
- name: Build monorepo for testing
run: |
npm run prebuild
npm run build:cjs
- name: Execute tests in monorepo
run: npm run test
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js 20
uses: actions/setup-node@v3
with:
node-version: 20
cache: 'npm'
cache-dependency-path: 'package-lock.json'
- name: Install dependencies
run: npm ci
- name: Build monorepo
run: npm run build:es
- name: Build ApiDOM Playground
run: npm run build
working-directory: ./packages/apidom-playground
- name: Upload build artifacts from ApiDOM Playground
if: github.ref == 'refs/heads/main'
uses: actions/upload-artifact@v3
with:
name: build
path: ./packages/apidom-playground/build