Skip to content

Commit e2d502f

Browse files
authored
ci: add ci workflow (#7)
* ci: add ci workflow * better triggers * rename step
1 parent 089b0b8 commit e2d502f

3 files changed

Lines changed: 81 additions & 6 deletions

File tree

.github/workflows/ci.yml

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

.travis.yml

Lines changed: 0 additions & 4 deletions
This file was deleted.

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313
"clean": "rm -rf lib",
1414
"prepare": "npm run clean && npm run build",
1515
"lint": "tslint -c tslint.json src/*.ts src/**/*.ts src/**/**/*.ts test/*.ts",
16-
"mocha": "mocha -r ts-node/register/type-check --reporter spec test/*-test.ts",
17-
"test": "npm run mocha && npm run lint"
16+
"test": "mocha -r ts-node/register/type-check --reporter spec test/*-test.ts"
1817
},
1918
"repository": {
2019
"type": "git",

0 commit comments

Comments
 (0)