Skip to content

Commit 2b4c6c4

Browse files
committed
ci: setup checks for update of branch main and for PRs
1 parent f407323 commit 2b4c6c4

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed

.github/workflows/ci.yml

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: CI
2+
3+
# configure concurrency: cancel pending and in-progress workflow runs if a new commit to the same branch is pushed (`github.head_ref` is the source branch of PRs, `github.ref_name` is the branch name of non-PR events)
4+
concurrency:
5+
group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }}
6+
cancel-in-progress: true
7+
8+
on:
9+
push:
10+
branches:
11+
- main
12+
pull_request:
13+
branches:
14+
- main
15+
types:
16+
- opened # new PR was created
17+
- synchronize # the last commit of the `head_ref` (= source branch) changed, e.g. a new commit was pushed or the source branch was rebased
18+
- ready_for_review # the PR switched from draft to non-draft
19+
- reopened # PR had been closed and got reopened
20+
21+
jobs:
22+
check:
23+
name: Checks (typechecking, linting, formatting)
24+
# run only if triggered by push on a branch or by a PR event for a PR which is not a draft
25+
if: ${{ !github.event.pull_request || github.event.pull_request.draft == false }}
26+
runs-on: ubuntu-24.04
27+
steps:
28+
- uses: actions/checkout@v4
29+
30+
- name: Install Node.js
31+
uses: actions/setup-node@v4
32+
with:
33+
node-version-file: ".nvmrc"
34+
cache: npm
35+
36+
- name: Install dependencies
37+
run: |
38+
npm ci
39+
40+
- name: Typecheck everything (tsc)
41+
run: |
42+
npm run compile
43+
44+
- name: Lint everything (eslint)
45+
run: |
46+
npm run lint
47+
48+
- name: Check formatting of everything (prettier)
49+
run: |
50+
npm run fmt

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"build:preview": "vite preview",
1313
"build:readme": "node tools/update-readme.js",
1414
"start": "vite",
15+
"compile": "tsc",
1516
"lint": "npm-run-all --parallel lint:js",
1617
"lint:fix": "npm-run-all --parallel lint:fix:*",
1718
"lint:js": "eslint .",

0 commit comments

Comments
 (0)