forked from TypeScriptToLua/TypeScriptToLua
-
Notifications
You must be signed in to change notification settings - Fork 0
118 lines (112 loc) · 4.05 KB
/
ci.yml
File metadata and controls
118 lines (112 loc) · 4.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
name: CI
on:
push:
branches: master
pull_request:
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- run: npm ci
- run: npm run lint
env:
CI: true
test:
name: Test on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@v2
- name: Use Node.js 12.13.1
uses: actions/setup-node@v1
with:
node-version: 12.13.1
- run: npm ci
- run: npm run build
- run: npx jest --maxWorkers 2 --coverage
env:
CI: true
- if: matrix.os == 'ubuntu-latest'
uses: codecov/codecov-action@v1
benchmark:
name: Benchmark
runs-on: ubuntu-latest
steps:
- name: Lua Install
run: sudo apt-get install lua5.3 luajit
- name: Glow Install
run: brew install glow
# Checkout master & commit
- name: Checkout master
uses: actions/checkout@v2
with:
ref: master
path: master
- name: Checkout commit
uses: actions/checkout@v2
with:
path: commit
- name: Use Node.js 12.13.1
uses: actions/setup-node@v1
with:
node-version: 12.13.1
# NPM
- name: NPM master
run: npm ci && npm run build
working-directory: master
- name: NPM commit
run: npm ci && npm run build
working-directory: commit
# Benchmark directory setup
- name: Ensure benchmark data dir exists
run: mkdir -p ./benchmark/data
working-directory: commit
- name: Copy commit benchmark to master
run: rm -rf ./master/benchmark && cp -rf ./commit/benchmark ./master/benchmark
# Run master benchmark first and output to commit benchmark data
- name: Build benchmark Lua 5.3 master
run: node ../dist/tstl.js -p tsconfig.53.json
working-directory: master/benchmark
- name: Run benchmark Lua 5.3 master
id: benchmark-lua-master
run: lua5.3 -- run.lua ../../../commit/benchmark/data/benchmark_master_53.json
working-directory: master/benchmark/dist
- name: Build benchmark LuaJIT master
run: node ../dist/tstl.js -p tsconfig.jit.json
working-directory: master/benchmark
- name: Run benchmark LuaJIT master
id: benchmark-jit-master
run: luajit -- run.lua ../../../commit/benchmark/data/benchmark_master_jit.json
working-directory: master/benchmark/dist
# Run commit benchmark and compare with master
- name: Build benchmark Lua 5.3 commit
run: node ../dist/tstl.js -p tsconfig.53.json
working-directory: commit/benchmark
- name: Run benchmark Lua 5.3 commit
id: benchmark-lua-commit
run: lua5.3 -- run.lua ../data/benchmark_master_vs_commit_53.json ../data/benchmark_master_53.json
working-directory: commit/benchmark/dist
- name: Build benchmark LuaJIT commit
run: node ../dist/tstl.js -p tsconfig.jit.json
working-directory: commit/benchmark
- name: Run benchmark LuaJIT commit
id: benchmark-jit-commit
run: luajit -- run.lua ../data/benchmark_master_vs_commit_jit.json ../data/benchmark_master_jit.json
working-directory: commit/benchmark/dist
- name: Combine benchmark results
id: script-combine-results
uses: actions/github-script@v3
with:
benchmark-result-path-lua: commit/benchmark/data/benchmark_master_vs_commit_53.json
benchmark-result-path-jit: commit/benchmark/data/benchmark_master_vs_commit_jit.json
result-encoding: string
script: |
const createBenchmarkCheck = require(`${process.env.GITHUB_WORKSPACE}/commit/.github/scripts/create_benchmark_check.js`);
return createBenchmarkCheck({ github, context, core });
- name: Benchmark results
run: echo "${{steps.script-combine-results.outputs.result}}" | glow -s dark -w 120 -