|
45 | 45 | steps: |
46 | 46 | - name: Lua Install |
47 | 47 | run: sudo apt-get install lua5.3 luajit |
| 48 | + - name: Glow Install |
| 49 | + run: brew install glow |
48 | 50 | # Checkout master & commit |
49 | 51 | - name: Checkout master |
50 | 52 | uses: actions/checkout@v2 |
@@ -93,50 +95,24 @@ jobs: |
93 | 95 | working-directory: commit/benchmark |
94 | 96 | - name: Run benchmark Lua 5.3 commit |
95 | 97 | id: benchmark-lua-commit |
96 | | - run: echo ::set-output name=info::`lua5.3 -- run.lua ../data/benchmark_commit_53.json ../data/benchmark_master_53.json` |
| 98 | + run: lua5.3 -- run.lua ../data/benchmark_master_vs_commit_53.json ../data/benchmark_master_53.json |
97 | 99 | working-directory: commit/benchmark/dist |
98 | 100 | - name: Build benchmark LuaJIT commit |
99 | 101 | run: node ../dist/tstl.js -p tsconfig.jit.json |
100 | 102 | working-directory: commit/benchmark |
101 | 103 | - name: Run benchmark LuaJIT commit |
102 | 104 | id: benchmark-jit-commit |
103 | | - run: echo ::set-output name=info::`luajit -- run.lua ../data/benchmark_commit_jit.json ../data/benchmark_master_jit.json` |
| 105 | + run: luajit -- run.lua ../data/benchmark_master_vs_commit_jit.json ../data/benchmark_master_jit.json |
104 | 106 | working-directory: commit/benchmark/dist |
105 | | - - name: Create benchmark check |
106 | | - uses: actions/github-script@0.9.0 |
| 107 | + - name: Combine benchmark results |
| 108 | + id: script-combine-results |
| 109 | + uses: actions/github-script@v3 |
107 | 110 | with: |
108 | | - benchmark-info-lua: ${{steps.benchmark-lua-commit.outputs.info}} |
109 | | - benchmark-info-jit: ${{steps.benchmark-jit-commit.outputs.info}} |
| 111 | + benchmark-result-path-lua: commit/benchmark/data/benchmark_master_vs_commit_53.json |
| 112 | + benchmark-result-path-jit: commit/benchmark/data/benchmark_master_vs_commit_jit.json |
| 113 | + result-encoding: string |
110 | 114 | script: | |
111 | | - const benchmarkInfoLua = JSON.parse(core.getInput('benchmark-info-lua', { required: true })); |
112 | | - const benchmarkInfoJIT = JSON.parse(core.getInput('benchmark-info-jit', { required: true })); |
113 | | -
|
114 | | - const zlib = require('zlib'); |
115 | | - const buffer = Buffer.from(core.getInput('benchmark-info-lua', { required: true })); |
116 | | - const compressed = zlib.deflateSync(buffer); |
117 | | -
|
118 | | - const summary = `[Open visualizer](https://typescripttolua.github.io/benchviz?d=${compressed.toString('base64')})\n` |
119 | | - + `### Lua5.3\n${benchmarkInfoLua.summary}\n### LuaJIT\n${benchmarkInfoJIT.summary}`; |
120 | | -
|
121 | | - const text = `### Lua5.3\n${benchmarkInfoLua.text}\n### LuaJIT\n${benchmarkInfoJIT.text}`; |
122 | | -
|
123 | | - const pull_request = context.payload.pull_request; |
124 | | - if (!pull_request || pull_request.head.repo.url === pull_request.base.repo.url) { |
125 | | - // This only works if not in a fork. |
126 | | - github.checks.create({ |
127 | | - owner: context.repo.owner, |
128 | | - repo: context.repo.repo, |
129 | | - name: "Benchmark results", |
130 | | - head_sha: context.sha, |
131 | | - status: "completed", |
132 | | - conclusion: "neutral", |
133 | | - output: { |
134 | | - title: "Benchmark results", |
135 | | - summary: summary, |
136 | | - text: text |
137 | | - } |
138 | | - }); |
139 | | - } else { |
140 | | - console.log(summary); |
141 | | - console.log(text); |
142 | | - } |
| 115 | + const createBenchmarkCheck = require(`${process.env.GITHUB_WORKSPACE}/commit/.github/scripts/create_benchmark_check.js`); |
| 116 | + return createBenchmarkCheck({ github, context, core }); |
| 117 | + - name: Benchmark results |
| 118 | + run: echo "${{steps.script-combine-results.outputs.result}}" | glow -s dark -w 120 - |
0 commit comments