-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
121 lines (116 loc) · 3.75 KB
/
Copy patheslint-check.yml
File metadata and controls
121 lines (116 loc) · 3.75 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
name: ESLint Check
on:
push:
pull_request:
jobs:
eslint_check_upload:
runs-on: ubuntu-latest
permissions:
contents: read
name: ESLint Check and Report Upload
steps:
- name: Checkout pull request head
if: github.event_name == 'pull_request'
uses: actions/checkout@v4
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.sha }}
- name: Checkout current branch
if: github.event_name != 'pull_request'
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: lts/*
- name: Setup pnpm
uses: pnpm/action-setup@v6
with:
cache: true
- name: Install Dependencies
run: pnpm install --frozen-lockfile
env:
PUPPETEER_SKIP_DOWNLOAD: true
- name: Build Packages
run: NODE_OPTIONS='--max-old-space-size=4096' pnpm run build:all
env:
PUPPETEER_SKIP_DOWNLOAD: true
- name: Eslint Check
run: pnpm exec turbo run lint
- name: Save Code Linting Report JSON
run: pnpm run lint:report
# Continue to the next step even if this fails
continue-on-error: true
- name: Upload ESLint Report
uses: actions/upload-artifact@v4
with:
name: eslint_report.json
path: eslint_report.json
- name: Measure PR bundle sizes
if: github.event_name == 'pull_request'
run: node .github/scripts/measure-bundle-sizes.js pr-sizes.json
- name: Upload PR bundle sizes
if: github.event_name == 'pull_request'
uses: actions/upload-artifact@v4
with:
name: pr-sizes
path: pr-sizes.json
bundle_size_build:
# Only runs on PRs. Reuses the PR build from eslint_check_upload (via the
# pr-sizes artifact) and only builds the base branch itself. The privileged
# bundle-size-comment workflow then posts the PR comment without ever
# executing fork code.
if: github.event_name == 'pull_request'
needs: eslint_check_upload
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
name: Build Base for Bundle Size Comparison
steps:
- name: Checkout workflow ref
uses: actions/checkout@v4
- name: Prepare bundle size helper
run: |
cp .github/scripts/measure-bundle-sizes.js /tmp/measure-bundle-sizes.js
# --- Base branch ---
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.base.sha }}
- name: Download PR bundle sizes
uses: actions/download-artifact@v4
with:
name: pr-sizes
- uses: actions/setup-node@v3
with:
node-version: lts/*
- name: Setup pnpm
if: ${{ hashFiles('pnpm-lock.yaml') != '' }}
uses: pnpm/action-setup@v6
with:
cache: true
- name: Install base dependencies
run: |
if [ -f pnpm-lock.yaml ]; then
pnpm install --frozen-lockfile
else
yarn install --frozen-lockfile
fi
env:
PUPPETEER_SKIP_DOWNLOAD: true
- name: Build base branch
run: |
if [ -f pnpm-lock.yaml ]; then
NODE_OPTIONS='--max-old-space-size=4096' pnpm run build:all
else
NODE_OPTIONS='--max-old-space-size=4096' yarn build:all
fi
env:
PUPPETEER_SKIP_DOWNLOAD: true
- name: Measure base bundle sizes
run: node /tmp/measure-bundle-sizes.js base-sizes.json
- uses: actions/upload-artifact@v4
with:
name: bundle-size-data
path: |
pr-sizes.json
base-sizes.json