diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index dace9817a..a6e26fb5d 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -1,8 +1,11 @@ name: Benchmark on: - pull_request: - push: + workflow_call: + inputs: + package: + required: true + type: string jobs: benchmark: @@ -10,9 +13,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 with: node-version: 18 - - run: node ./scripts/checkCpuModel.js diff --git a/.github/workflows/retryBenchmark.yml b/.github/workflows/retryBenchmark.yml new file mode 100644 index 000000000..e174e4616 --- /dev/null +++ b/.github/workflows/retryBenchmark.yml @@ -0,0 +1,70 @@ +name: Benchmark + +on: + pull_request: + push: + +jobs: + benchmark-try-1: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 18 + - run: node ./scripts/checkCpuModel.js + + benchmark-try-2: + needs: benchmark-try-1 + if: ${{ always() && needs.benchmark-try-1.result == 'failure') }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 18 + - run: node ./scripts/checkCpuModel.js + + benchmark-try-3: + needs: benchmark-try-2 + if: ${{ always() && needs.benchmark-try-2.result == 'failure') }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 18 + - run: node ./scripts/checkCpuModel.js + + benchmark-try-4: + needs: benchmark-try-1 + if: ${{ always() && needs.benchmark-try-3.result == 'failure') }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 18 + - run: node ./scripts/checkCpuModel.js + + benchmark-try-5: + needs: benchmark-try-1 + if: ${{ always() && needs.benchmark-try-4.result == 'failure') }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 18 + - run: node ./scripts/checkCpuModel.js + + benchmark-try-6: + needs: benchmark-try-1 + if: ${{ always() && needs.benchmark-try-5.result == 'failure') }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 18 + - run: node ./scripts/checkCpuModel.js diff --git a/scripts/checkCpuModel.js b/scripts/checkCpuModel.js index 4bd4beae3..c592ba94b 100644 --- a/scripts/checkCpuModel.js +++ b/scripts/checkCpuModel.js @@ -1,7 +1,7 @@ import os from 'node:os' -const hostCpu = os.cpus()[0].model +const hostCpu = os.cpus()[0].model.trim() const targetCpu = await fetch('https://raw.githubusercontent.com/discordeno/discordeno/benchies/cpu').then((res) => res.text()) -console.log(`host cpu: ${hostCpu} target cpu: ${targetCpu}`) +console.dir(`host cpu: ${hostCpu} target cpu: ${targetCpu}`) if (hostCpu !== targetCpu) process.exit(1)