Skip to content

Commit 6d38723

Browse files
committed
ci: Add GitHub Actions, CodeQL & Dependabot Configurations
1 parent 45aef8c commit 6d38723

File tree

4 files changed

+182
-0
lines changed

4 files changed

+182
-0
lines changed

.github/codeql/codeql-config.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Copyright 2015 Shuai Zhang
2+
# SPDX-License-Identifier: LGPL-3.0-or-later WITH LGPL-3.0-linking-exception
3+
4+
name: JavaScript CodeQL Configuration
5+
6+
paths-ignore:
7+
- node_modules
8+
- dist

.github/dependabot.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Copyright 2015 Shuai Zhang
2+
# SPDX-License-Identifier: LGPL-3.0-or-later WITH LGPL-3.0-linking-exception
3+
4+
version: 2
5+
updates:
6+
- package-ecosystem: github-actions
7+
directory: /
8+
schedule:
9+
interval: weekly
10+
groups:
11+
actions-minor:
12+
update-types:
13+
- minor
14+
- patch
15+
16+
- package-ecosystem: npm
17+
directory: /
18+
schedule:
19+
interval: weekly
20+
groups:
21+
npm-development:
22+
dependency-type: development
23+
update-types:
24+
- minor
25+
- patch
26+
npm-production:
27+
dependency-type: production
28+
update-types:
29+
- patch

.github/workflows/ci.yml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# Copyright 2015 Shuai Zhang
2+
# SPDX-License-Identifier: LGPL-3.0-or-later WITH LGPL-3.0-linking-exception
3+
4+
name: Continuous Integration
5+
6+
on:
7+
pull_request:
8+
branches:
9+
- main
10+
push:
11+
branches:
12+
- main
13+
14+
permissions:
15+
contents: read
16+
17+
jobs:
18+
validation:
19+
name: Validate
20+
runs-on: ubuntu-latest
21+
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v5
25+
with:
26+
fetch-depth: 0
27+
28+
- name: Mise Install Tools
29+
uses: jdx/mise-action@v3
30+
with:
31+
experimental: true
32+
install_args: "hk pkl typos go:github.com/B1NARY-GR0UP/nwa"
33+
34+
- name: Set up PNPM
35+
uses: pnpm/action-setup@v4
36+
37+
- name: Set up Node.js
38+
uses: actions/setup-node@v6
39+
with:
40+
node-version: 22.x
41+
cache: pnpm
42+
cache-dependency-path: pnpm-lock.yaml
43+
44+
- name: Install dependencies
45+
run: pnpm install --frozen-lockfile
46+
47+
- name: Validate with HK
48+
if: github.event_name == 'push'
49+
run: |
50+
BASE="${{ github.event.before }}"
51+
HEAD="${{ github.sha }}"
52+
53+
echo "hk check from $BASE to $HEAD"
54+
hk check --check --from-ref "$BASE" --to-ref "$HEAD"
55+
56+
- name: Validate with HK
57+
if: github.event_name == 'pull_request'
58+
run: |
59+
BASE="${{ github.event.pull_request.base.sha }}"
60+
HEAD="${{ github.event.pull_request.head.sha }}"
61+
62+
echo "hk check from $BASE to $HEAD"
63+
hk check --check --from-ref "$BASE" --to-ref "$HEAD"
64+
65+
- name: Validate with PNPM
66+
run: pnpm lint && pnpm typecheck
67+
68+
test:
69+
name: Test & Build
70+
runs-on: ubuntu-latest
71+
72+
steps:
73+
- name: Checkout
74+
uses: actions/checkout@v5
75+
76+
- name: Set up PNPM
77+
uses: pnpm/action-setup@v4
78+
79+
- name: Set up Node.js
80+
uses: actions/setup-node@v6
81+
with:
82+
node-version: 20.19.0
83+
cache: pnpm
84+
cache-dependency-path: pnpm-lock.yaml
85+
86+
- name: Install dependencies
87+
run: pnpm install --frozen-lockfile
88+
89+
- name: Run tests
90+
run: pnpm run test
91+
92+
- name: Build
93+
run: pnpm run build

.github/workflows/codeql.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Copyright 2015 Shuai Zhang
2+
# SPDX-License-Identifier: LGPL-3.0-or-later WITH LGPL-3.0-linking-exception
3+
4+
name: CodeQL
5+
6+
on:
7+
pull_request:
8+
branches:
9+
- main
10+
push:
11+
branches:
12+
- main
13+
schedule:
14+
- cron: '31 7 * * 3'
15+
16+
permissions:
17+
actions: read
18+
checks: write
19+
contents: read
20+
security-events: write
21+
22+
jobs:
23+
analyze:
24+
name: Analyze
25+
runs-on: ubuntu-latest
26+
27+
strategy:
28+
fail-fast: false
29+
matrix:
30+
language:
31+
- typescript
32+
33+
steps:
34+
- name: Checkout
35+
id: checkout
36+
uses: actions/checkout@v5
37+
38+
- name: Initialize CodeQL
39+
id: initialize
40+
uses: github/codeql-action/init@v4
41+
with:
42+
config-file: .github/codeql/codeql-config.yml
43+
languages: ${{ matrix.language }}
44+
source-root: src
45+
46+
- name: Autobuild
47+
id: autobuild
48+
uses: github/codeql-action/autobuild@v4
49+
50+
- name: Perform CodeQL Analysis
51+
id: analyze
52+
uses: github/codeql-action/analyze@v4

0 commit comments

Comments
 (0)