|
19 | 19 | - README.md |
20 | 20 | - .github/** |
21 | 21 | - '!.github/workflows/test-shared.yml' |
| 22 | + workflow_dispatch: |
| 23 | + inputs: |
| 24 | + repo: |
| 25 | + type: string |
| 26 | + description: 'GitHub repository to fetch from (default to the current repo)' |
| 27 | + pr_id: |
| 28 | + type: number |
| 29 | + required: true |
| 30 | + description: 'The PR to test' |
| 31 | + commit: |
| 32 | + required: true |
| 33 | + type: string |
| 34 | + description: 'The expect HEAD of the PR' |
| 35 | + category: |
| 36 | + required: true |
| 37 | + type: string |
| 38 | + description: The category (or categories) of tests to run, for example buffers, cluster etc. Maps to a folders in node/benchmark |
| 39 | + filter: |
| 40 | + type: string |
| 41 | + description: A substring to restrict the benchmarks to run in a category. e.g. `net-c2c` |
| 42 | + runs: |
| 43 | + type: number |
| 44 | + default: 30 |
| 45 | + description: How many times to repeat each benchmark |
22 | 46 |
|
23 | 47 | concurrency: |
24 | 48 | group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} |
|
50 | 74 | runs-on: ${{ matrix.runner }} |
51 | 75 | steps: |
52 | 76 | - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 77 | + if: ${{ github.event_name != 'workflow_dispatch' }} |
| 78 | + |
| 79 | + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 80 | + if: ${{ github.event_name == 'workflow_dispatch' }} |
| 81 | + with: |
| 82 | + repository: ${{ inputs.repo || github.repository }} |
| 83 | + ref: refs/pull/${{ inputs.pr_id }}/merge |
| 84 | + fetch-depth: 2 |
| 85 | + |
| 86 | + - name: Validate HEAD of PR is expected value |
| 87 | + if: ${{ github.event_name == 'workflow_dispatch' }} |
| 88 | + run: | |
| 89 | + [ "$(git rev-parse HEAD^2)" = "$EXPECTED_SHA" ] |
| 90 | + git reset HEAD^ --hard |
| 91 | + env: |
| 92 | + EXPECTED_SHA: ${{ inputs.commit }} |
| 93 | + |
| 94 | + - run: git show --name-only FETCH_HEAD |
53 | 95 |
|
54 | 96 | - uses: cachix/install-nix-action@f0fe604f8a612776892427721526b4c7cfb23aba # v31 |
55 | 97 | with: |
@@ -84,5 +126,47 @@ jobs: |
84 | 126 | --arg devTools '[]' \ |
85 | 127 | --arg benchmarkTools '[]' \ |
86 | 128 | --run ' |
87 | | - make run-ci -j4 V=1 TEST_CI_ARGS="-p actions --measure-flakiness 9 --skip-tests=$CI_SKIP_TESTS" |
| 129 | + make ${{ github.event_name == 'workflow_dispatch' && 'build' || 'run' }}-ci -j4 V=1 TEST_CI_ARGS="-p actions --measure-flakiness 9 --skip-tests=$CI_SKIP_TESTS" |
| 130 | + ' |
| 131 | +
|
| 132 | + - name: Pull commit to benchmark |
| 133 | + if: ${{ github.event_name == 'workflow_dispatch' }} |
| 134 | + run: git pull --allow-unrelated-histories --no-rebase --no-commit --no-ff --depth=1 origin ${{ inputs.commit }} |
| 135 | + |
| 136 | + - run: git log |
| 137 | + |
| 138 | + - name: Re-build Node.js |
| 139 | + # ccache is disabled here to avoid polluting the cache. Local build outputs should make this build relatively quick anyway. |
| 140 | + if: ${{ github.event_name == 'workflow_dispatch' }} |
| 141 | + run: | |
| 142 | + mv out/Release/node base_node |
| 143 | + nix-shell \ |
| 144 | + --pure \ |
| 145 | + --arg loadJSBuiltinsDynamically false \ |
| 146 | + --arg ccache 'null' \ |
| 147 | + --arg devTools '[]' \ |
| 148 | + --arg benchmarkTools '[]' \ |
| 149 | + --run ' |
| 150 | + make build-ci -j4 V=1 |
| 151 | + ' |
| 152 | +
|
| 153 | + - name: Run benchmark |
| 154 | + if: ${{ github.event_name == 'workflow_dispatch' }} |
| 155 | + run: | |
| 156 | + nix-shell \ |
| 157 | + --pure --keep FILTER \ |
| 158 | + --arg loadJSBuiltinsDynamically false \ |
| 159 | + --arg ccache 'null' \ |
| 160 | + --arg devTools '[]' \ |
| 161 | + --run ' |
| 162 | + ./base_node benchmark/compare.js \ |
| 163 | + --filter "$FILTER" \ |
| 164 | + --runs ${{ inputs.runs }} \ |
| 165 | + --old ./base_node --new ./node \ |
| 166 | + -- ${{ inputs.category }} \ |
| 167 | + | Rscript benchmark/compare.R |
88 | 168 | ' |
| 169 | + env: |
| 170 | + FILTER: ${{ inputs.filter }} |
| 171 | + |
| 172 | + |
0 commit comments