Skip to content

Commit 26a4354

Browse files
authored
ci: add ci workflow
1 parent ce16dd9 commit 26a4354

File tree

1 file changed

+71
-0
lines changed

1 file changed

+71
-0
lines changed

.github/workflows/ci.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: CI
2+
3+
on: [push, pull_request]
4+
5+
env:
6+
CI: true
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
test:
13+
name: Run tests
14+
runs-on: ${{ matrix.os }}
15+
strategy:
16+
matrix:
17+
os:
18+
- macos-latest
19+
- ubuntu-latest
20+
- windows-latest
21+
steps:
22+
- name: Install clang for Windows
23+
if: runner.os == 'Windows'
24+
run: |
25+
iwr -useb get.scoop.sh -outfile 'install.ps1'
26+
.\install.ps1 -RunAsAdmin
27+
scoop install llvm --global
28+
29+
# Scoop modifies the PATH so we make the modified PATH global.
30+
echo $env:PATH >> $env:GITHUB_PATH
31+
32+
- name: Fetch code
33+
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
34+
with:
35+
fetch-depth: 1
36+
37+
- name: Setup Node.js
38+
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # 4.0.3
39+
with:
40+
node-version: 'lts/*'
41+
cache: 'npm'
42+
cache-dependency-path: package-lock.json
43+
44+
- name: Install dependencies
45+
run: npm ci --ignore-scripts
46+
47+
- name: Run tests
48+
run: npm run test
49+
50+
lint:
51+
name: Run Lint
52+
runs-on: ubuntu-latest
53+
steps:
54+
- name: Fetch code
55+
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
56+
with:
57+
fetch-depth: 1
58+
59+
- name: Restore node_modules cache
60+
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
61+
with:
62+
path: ~/.npm
63+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
64+
restore-keys: |
65+
${{ runner.os }}-node-
66+
67+
- name: Install dependencies
68+
run: npm ci --ignore-scripts
69+
70+
- name: Run lint command
71+
run: npm run lint

0 commit comments

Comments
 (0)