Skip to content

Commit 573b692

Browse files
authored
build: Setup Initial CI (#11)
Setup initial CI pipeline for testing, linting, and type checking.
1 parent 35c629a commit 573b692

File tree

14 files changed

+1166
-603
lines changed

14 files changed

+1166
-603
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ""
5+
labels: ""
6+
assignees: ""
7+
---
8+
9+
<!--
10+
Sentry/Codecov employees and contractors can delete or ignore the following.
11+
-->
12+
13+
# 📣 Feedback / 🐛 Bugs
14+
15+
Do you want to file a bug report and/or feature request for Codecov? [Please use our feedback repo instead](https://github.com/codecov/feedback/issues).
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: ""
5+
labels: ""
6+
assignees: ""
7+
---
8+
9+
<!--
10+
Sentry/Codecov employees and contractors can delete or ignore the following.
11+
-->
12+
13+
# 📣 Feedback / 🐛 Bugs
14+
15+
Do you want to file a bug report and/or feature request for Codecov? [Please use our feedback repo instead](https://github.com/codecov/feedback/issues).

.github/pull_request_template.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Description
2+
3+
# Code Example
4+
5+
# Notable Changes
6+
7+
<!--
8+
Sentry/Codecov employees and contractors can delete or ignore the following.
9+
-->
10+
11+
# Legal Boilerplate
12+
13+
Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. In 2022 this entity acquired Codecov and as result Sentry is going to need some rights from me in order to utilize my contributions in this PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

.github/workflows/cache_cleanup.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: cleanup caches by a branch
2+
on:
3+
pull_request:
4+
types:
5+
- closed
6+
7+
jobs:
8+
cleanup:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Check out code
12+
uses: actions/checkout@v4
13+
14+
- name: Cleanup
15+
run: |
16+
gh extension install actions/gh-actions-cache
17+
18+
REPO=${{ github.repository }}
19+
BRANCH="refs/pull/${{ github.event.pull_request.number }}/merge"
20+
21+
echo "Fetching list of cache key"
22+
cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH -L 100 | cut -f 1 )
23+
24+
## Setting this to not fail the workflow while deleting cache keys.
25+
set +e
26+
echo "Deleting caches..."
27+
for cacheKey in $cacheKeysForPR
28+
do
29+
gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm
30+
done
31+
echo "Done"
32+
env:
33+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/ci.yml

Lines changed: 209 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,209 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- staging
8+
pull_request:
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
12+
cancel-in-progress: true
13+
14+
jobs:
15+
install:
16+
name: Install deps
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0
23+
24+
- name: Setup node
25+
uses: actions/setup-node@v3
26+
with:
27+
node-version: 18
28+
29+
- name: Install pnpm
30+
uses: pnpm/action-setup@v2
31+
with:
32+
version: 8
33+
run_install: false
34+
35+
- name: Get pnpm store directory
36+
shell: bash
37+
run: |
38+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
39+
40+
- name: Cache node_modules
41+
id: cache-node-modules
42+
uses: actions/cache@v3
43+
env:
44+
cache-name: cache-codecov-js-bundle-plugin-node-modules
45+
with:
46+
path: ${{ env.STORE_PATH }}
47+
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/pnpm-lock.yaml') }}
48+
restore-keys: |
49+
${{ runner.os }}-${{ env.cache-name }}-
50+
51+
- name: Install dependencies
52+
run: pnpm install
53+
54+
lint:
55+
name: Run Lint
56+
runs-on: ubuntu-latest
57+
needs: install
58+
steps:
59+
- name: Checkout
60+
uses: actions/checkout@v4
61+
with:
62+
fetch-depth: 0
63+
64+
- name: Setup node
65+
uses: actions/setup-node@v3
66+
with:
67+
node-version: 18
68+
69+
- name: Install pnpm
70+
uses: pnpm/action-setup@v2
71+
with:
72+
version: 8
73+
run_install: false
74+
75+
- name: Get pnpm store directory
76+
shell: bash
77+
run: |
78+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
79+
80+
- name: Cache node_modules
81+
id: cache-node-modules
82+
uses: actions/cache@v3
83+
env:
84+
cache-name: cache-codecov-js-bundle-plugin-node-modules
85+
with:
86+
path: ${{ env.STORE_PATH }}
87+
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/pnpm-lock.yaml') }}
88+
restore-keys: |
89+
${{ runner.os }}-${{ env.cache-name }}-
90+
91+
- name: Install dependencies
92+
run: pnpm install
93+
94+
- name: Build packages
95+
run: pnpm run build
96+
97+
- name: Run linter
98+
run: pnpm run lint
99+
100+
type-check:
101+
name: Run Type Checker
102+
runs-on: ubuntu-latest
103+
needs: install
104+
steps:
105+
- name: Checkout
106+
uses: actions/checkout@v4
107+
with:
108+
fetch-depth: 0
109+
110+
- name: Setup node
111+
uses: actions/setup-node@v3
112+
with:
113+
node-version: 18
114+
115+
- name: Install pnpm
116+
uses: pnpm/action-setup@v2
117+
with:
118+
version: 8
119+
run_install: false
120+
121+
- name: Get pnpm store directory
122+
shell: bash
123+
run: |
124+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
125+
126+
- name: Cache node_modules
127+
id: cache-node-modules
128+
uses: actions/cache@v3
129+
env:
130+
cache-name: cache-codecov-js-bundle-plugin-node-modules
131+
with:
132+
path: ${{ env.STORE_PATH }}
133+
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/pnpm-lock.yaml') }}
134+
restore-keys: |
135+
${{ runner.os }}-${{ env.cache-name }}-
136+
137+
- name: Install dependencies
138+
run: pnpm install
139+
140+
- name: Build packages
141+
run: pnpm run build
142+
143+
- name: Run TSC
144+
run: pnpm run type-check
145+
146+
unit-test:
147+
name: Run Unit Tests
148+
runs-on: ubuntu-latest
149+
needs: install
150+
steps:
151+
- name: Checkout
152+
uses: actions/checkout@v4
153+
with:
154+
fetch-depth: 0
155+
156+
- name: Setup node
157+
uses: actions/setup-node@v3
158+
with:
159+
node-version: 18
160+
161+
- name: Install pnpm
162+
uses: pnpm/action-setup@v2
163+
with:
164+
version: 8
165+
run_install: false
166+
167+
- name: Get pnpm store directory
168+
shell: bash
169+
run: |
170+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
171+
172+
- name: Cache node_modules
173+
id: cache-node-modules
174+
uses: actions/cache@v3
175+
env:
176+
cache-name: cache-codecov-js-bundle-plugin-node-modules
177+
with:
178+
path: ${{ env.STORE_PATH }}
179+
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/pnpm-lock.yaml') }}
180+
restore-keys: |
181+
${{ runner.os }}-${{ env.cache-name }}-
182+
183+
- name: Install dependencies
184+
run: pnpm install
185+
186+
- name: Build packages
187+
run: pnpm run build
188+
189+
- name: Run unit tests
190+
run: pnpm run test:unit:ci --maxWorkers=2
191+
192+
# fossa:
193+
# name: Run Fossa
194+
# runs-on: ubuntu-latest
195+
# needs: install
196+
# if: ${{ !github.event.pull_request.head.repo.fork && github.repository_owner == 'codecov' }}
197+
# steps:
198+
# - name: Checkout
199+
# uses: actions/checkout@v4
200+
201+
# - name: Setup Node
202+
# uses: actions/setup-node@v3
203+
# with:
204+
# node-version: '18.8.0'
205+
206+
# - name: Run Fossa
207+
# uses: fossas/fossa-action@v1.3.1
208+
# with:
209+
# api-key: ${{secrets.FOSSA_API_KEY}}

bundlers/next-js/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@
2929
"extends": "../../package.json"
3030
},
3131
"engines": {
32-
"node": ">=20.0.0"
32+
"node": ">=18.0.0"
3333
}
34-
}
34+
}

bundlers/rollup/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@
2828
"extends": "../../package.json"
2929
},
3030
"engines": {
31-
"node": ">=20.0.0"
31+
"node": ">=18.0.0"
3232
}
33-
}
33+
}

bundlers/webpack/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@
1717
"@codecov/webpack-plugin": "workspace:^",
1818
"lodash": "^4.17.21"
1919
},
20+
"engines": {
21+
"node": ">=18.0.0"
22+
},
2023
"volta": {
2124
"extends": "../../package.json"
2225
}
23-
}
26+
}

package.json

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,36 +3,41 @@
33
"version": "1.0.0",
44
"description": "",
55
"main": "index.js",
6+
"private": true,
67
"scripts": {
78
"build": "pnpm -r --filter='./packages/*' run build",
89
"clean": "pnpm -r --filter='./packages/*' clean && rm -rf node_modules",
9-
"lint": "pnpm -r --filter='./packages/*' lint && manypkg check",
10-
"lint:fix": "pnpm -r --filter='./packages/*' lint:fix && manypkg fix",
10+
"type-check": "pnpm -r --filter='./packages/*' run type-check",
11+
"lint": "pnpm -r --filter='./packages/*' lint",
12+
"lint:fix": "pnpm -r --filter='./packages/*' lint:fix",
1113
"format": "pnpm -r --filter='./packages/*' format && prettier --write '*.{cjs,json}' --ignore-unknown --no-error-on-unmatched-pattern",
12-
"format:check": "pnpm -r --filter='./packages/*' format:check && prettier --check '*.{cjs,json}' --ignore-unknown --no-error-on-unmatched-pattern"
14+
"format:check": "pnpm -r --filter='./packages/*' format:check && prettier --check '*.{cjs,json}' --ignore-unknown --no-error-on-unmatched-pattern",
15+
"test:unit:ci": "pnpm -r --filter='./packages/*' run test:unit:ci"
1316
},
1417
"keywords": [],
1518
"author": "",
1619
"license": "Apache-2.0",
17-
"dependencies": {
18-
"@manypkg/cli": "^0.21.0",
20+
"devDependencies": {
1921
"@total-typescript/ts-reset": "^0.5.1",
20-
"@types/eslint": "^8.44.4",
21-
"@types/node": "^20.8.6",
22-
"@typescript-eslint/eslint-plugin": "^6.8.0",
23-
"@typescript-eslint/parser": "^6.8.0",
24-
"eslint": "^8.51.0",
22+
"@types/eslint": "^8.44.7",
23+
"@types/node": "^20.10.0",
24+
"@typescript-eslint/eslint-plugin": "^6.13.1",
25+
"@typescript-eslint/parser": "^6.13.1",
26+
"eslint": "^8.54.0",
2527
"eslint-config-prettier": "^9.0.0",
26-
"eslint-plugin-import": "^2.28.1",
27-
"eslint-plugin-isaacscript": "^3.5.6",
28+
"eslint-plugin-import": "^2.29.0",
29+
"eslint-plugin-isaacscript": "^3.5.8",
2830
"eslint-plugin-prettier": "^5.0.1",
29-
"prettier": "^3.0.3",
31+
"prettier": "^3.1.0",
3032
"typescript": "^5.3.2"
3133
},
34+
"workspaces": [
35+
"packages/*"
36+
],
3237
"volta": {
3338
"node": "20.9.0"
3439
},
3540
"engines": {
36-
"node": ">=20.0.0"
41+
"node": ">=18.0.0"
3742
}
3843
}

0 commit comments

Comments
 (0)