Skip to content

Commit bf2f862

Browse files
authored
Add CI workflow (#10)
* Add CI workflow * Setup yarn with corepack * Setup node twice for yarn cache
1 parent 27ee4ad commit bf2f862

File tree

4 files changed

+57
-8
lines changed

4 files changed

+57
-8
lines changed

.github/workflows/ci.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
all:
17+
name: Lint, check format, build, and test
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Check out repository
21+
uses: actions/[email protected]
22+
- name: Setup Node
23+
uses: actions/[email protected]
24+
with:
25+
node-version-file: ".nvmrc"
26+
- name: Setup yarn with corepack
27+
run: corepack enable && corepack install
28+
- name: Setup Node again with yarn cache
29+
uses: actions/[email protected]
30+
with:
31+
node-version-file: ".nvmrc"
32+
cache: yarn
33+
- name: Install dependencies
34+
run: yarn install --immutable
35+
- name: Check for duplicate dependencies
36+
run: yarn dedupe --check
37+
- name: Setup tools cache
38+
uses: actions/[email protected]
39+
with:
40+
path: node_modules/.cache
41+
key: tools-${{ github.sha }}
42+
restore-keys: tools-
43+
- name: Check javascript and typescript
44+
run: yarn run lint:js
45+
- name: Check format
46+
run: yarn run lint:format
47+
- name: Build package
48+
run: yarn run build
49+
#- name: Run Tests
50+
#run: yarn run test

.gitignore

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,6 @@ pids
1717
# Dependency directories
1818
node_modules/
1919

20-
# TypeScript cache
21-
*.tsbuildinfo
22-
23-
# Optional eslint cache
24-
.eslintcache
25-
2620
# Optional REPL history
2721
.node_repl_history
2822

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,11 @@
3737
"types": "./dist/index.d.cts",
3838
"sideEffects": false,
3939
"scripts": {
40-
"fix": "eslint --cache --fix .",
40+
"lint:js": "eslint --cache --cache-strategy=content --cache-location=node_modules/.cache/eslint/.eslintcache .",
41+
"fix": "yarn run lint:js --fix",
4142
"format": "prettier --cache --write .",
42-
"lint": "yarn dedupe --check && eslint --cache . && prettier --cache --check .",
43+
"lint:format": "prettier --cache --check .",
44+
"lint": "yarn dedupe --check && yarn run lint:js && yarn run lint:format",
4345
"build": "tsc",
4446
"test": "mocha",
4547
"clean": "rm -rf dist",

tsconfig.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
"declarationMap": true,
1212
"sourceMap": true,
1313
"outDir": "dist",
14+
// Caching
15+
"incremental": true,
16+
"tsBuildInfoFile": "node_modules/.cache/typescript/.tsbuildinfo",
1417
// Interop Constraints
1518
"esModuleInterop": true,
1619
"forceConsistentCasingInFileNames": true,

0 commit comments

Comments
 (0)