From ec1ae2e2616777b73664e965bbde55853cc9f5e3 Mon Sep 17 00:00:00 2001 From: jerrykingxyz Date: Wed, 25 Oct 2023 17:34:58 +0800 Subject: [PATCH] ci: add ci test --- .github/workflows/ci.yml | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..12da5031 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,33 @@ +name: CI + +on: + push: + pull_request: + branches: [ main ] + +jobs: + bench: + runs-on: [self-hosted, rspack-bench] + timeout-minutes: 30 + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Init env + uses: ./.github/actions/env + - name: Build rspack + run: node bin/build-rspack.js + - name: Run benchmark + run: node bin/bench.js + - id: print-compare-results + name: Print compare results + run: | + result=$(node bin/compare-bench.js latest current) + echo "$result" + echo "diff-result=${result//$'\n'/'@@'}" >> $GITHUB_OUTPUT + - name: Check Threshold + run: | + result="${{ steps.print-compare-results.outputs.diff-result }}"; + if [[ $result =~ "Threshold exceeded" ]]; then + echo "Some benchmark cases exceed the threshold, please visit the previous step for more information" + exit 1 + fi