|
38 | 38 | CI: true |
39 | 39 | - if: matrix.os == 'ubuntu-latest' |
40 | 40 | uses: codecov/codecov-action@v1 |
| 41 | + |
| 42 | + benchmark: |
| 43 | + name: Benchmark |
| 44 | + runs-on: ubuntu-latest |
| 45 | + steps: |
| 46 | + - name: Lua Install |
| 47 | + run: sudo apt-get install lua5.3 luajit |
| 48 | + - uses: actions/checkout@v2 |
| 49 | + - name: Use Node.js 12.13.1 |
| 50 | + uses: actions/setup-node@v1 |
| 51 | + with: |
| 52 | + node-version: 12.13.1 |
| 53 | + - run: npm ci |
| 54 | + - run: npm run build |
| 55 | + # This will never result in a direct cache hit. |
| 56 | + # Teherefore benchmark data is always updated. |
| 57 | + - name: Cache benchmark data |
| 58 | + id: cache-benchmark |
| 59 | + uses: actions/cache@v1 |
| 60 | + with: |
| 61 | + path: ./benchmark/data |
| 62 | + key: ${{ runner.os }}-master-benchmark-${{ github.sha }} |
| 63 | + restore-keys: ${{ runner.os }}-master-benchmark- |
| 64 | + - name: Ensure benchmark data dir exists |
| 65 | + run: mkdir -p ./benchmark/data |
| 66 | + - name: Build benchmark Lua 5.3 |
| 67 | + run: node dist/tstl.js -p benchmark/tsconfig.53.json |
| 68 | + - name: Run benchmark Lua 5.3 |
| 69 | + id: benchmark-lua |
| 70 | + run: echo ::set-output name=info::`lua5.3 -- run.lua ../data/benchmark_master_53.json ${{github.ref}}` |
| 71 | + working-directory: benchmark/dist |
| 72 | + - name: Build benchmark LuaJIT |
| 73 | + run: node dist/tstl.js -p benchmark/tsconfig.jit.json |
| 74 | + - name: Run benchmark LuaJIT |
| 75 | + id: benchmark-jit |
| 76 | + run: echo ::set-output name=info::`luajit -- run.lua ../data/benchmark_master_jit.json ${{github.ref}}` |
| 77 | + working-directory: benchmark/dist |
| 78 | + - name: Create benchmark check |
| 79 | + uses: actions/github-script@0.9.0 |
| 80 | + with: |
| 81 | + benchmark-info-lua: ${{steps.benchmark-lua.outputs.info}} |
| 82 | + benchmark-info-jit: ${{steps.benchmark-jit.outputs.info}} |
| 83 | + script: | |
| 84 | + const benchmarkInfoLua = JSON.parse(core.getInput('benchmark-info-lua', { required: true })); |
| 85 | + const benchmarkInfoJIT = JSON.parse(core.getInput('benchmark-info-jit', { required: true })); |
| 86 | +
|
| 87 | + const summary = `### Lua5.3\n${benchmarkInfoLua.summary}\n### LuaJIT\n${benchmarkInfoJIT.summary}`; |
| 88 | +
|
| 89 | + const text = `### Lua5.3\n${benchmarkInfoLua.text}\n### LuaJIT\n${benchmarkInfoJIT.text}`; |
| 90 | +
|
| 91 | + github.checks.create({ |
| 92 | + owner: context.repo.owner, |
| 93 | + repo: context.repo.repo, |
| 94 | + name: "Benchmark results", |
| 95 | + head_sha: context.sha, |
| 96 | + status: "completed", |
| 97 | + conclusion: "neutral", |
| 98 | + output: { |
| 99 | + title: "Benchmark results", |
| 100 | + summary: summary, |
| 101 | + text: text |
| 102 | + } |
| 103 | + }); |
0 commit comments