|
1 | 1 | name: Benchmark |
2 | 2 |
|
3 | 3 | on: |
| 4 | + push: |
4 | 5 | workflow_dispatch: |
5 | 6 | inputs: |
6 | 7 | repo: |
@@ -30,132 +31,8 @@ permissions: |
30 | 31 | contents: read |
31 | 32 |
|
32 | 33 | jobs: |
33 | | - build: |
34 | | - strategy: |
35 | | - fail-fast: true |
36 | | - matrix: |
37 | | - include: |
38 | | - - runner: ubuntu-24.04 |
39 | | - system: x86_64-linux |
40 | | - - runner: ubuntu-24.04-arm |
41 | | - system: aarch64-linux |
42 | | - - runner: macos-15-intel |
43 | | - system: x86_64-darwin |
44 | | - - runner: macos-latest |
45 | | - system: aarch64-darwin |
46 | | - name: '${{ matrix.system }}: with shared libraries' |
47 | | - runs-on: ${{ matrix.runner }} |
48 | | - steps: |
49 | | - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
50 | | - with: |
51 | | - repository: ${{ inputs.repo || github.repository }} |
52 | | - ref: refs/pull/${{ inputs.pr_id }}/merge |
53 | | - persist-credentials: false |
54 | | - fetch-depth: 2 |
55 | | - |
56 | | - - name: Validate PR head and roll back to base commit |
57 | | - run: | |
58 | | - [ "$(git rev-parse HEAD^2)" = "$EXPECTED_SHA" ] |
59 | | - git reset HEAD^ --hard |
60 | | - env: |
61 | | - EXPECTED_SHA: ${{ inputs.commit }} |
62 | | - |
63 | | - - uses: cachix/install-nix-action@96951a368ba55167b55f1c916f7d416bac6505fe # v31.10.3 |
64 | | - with: |
65 | | - extra_nix_config: sandbox = true |
66 | | - |
67 | | - - uses: cachix/cachix-action@1eb2ef646ac0255473d23a5907ad7b04ce94065c # v17 |
68 | | - with: |
69 | | - # We do not pass any `authToken` to avoid polluting the cache with potentially untrusted code. |
70 | | - name: nodejs |
71 | | - |
72 | | - - name: Configure sccache |
73 | | - uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 |
74 | | - with: |
75 | | - script: | |
76 | | - core.exportVariable('SCCACHE_GHA_VERSION', 'on'); |
77 | | - core.exportVariable('ACTIONS_CACHE_SERVICE_V2', 'on'); |
78 | | - core.exportVariable('ACTIONS_RESULTS_URL', process.env.ACTIONS_RESULTS_URL || ''); |
79 | | - core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); |
80 | | -
|
81 | | - - name: Build Node.js on the base commit |
82 | | - run: | |
83 | | - nix-shell \ |
84 | | - -I nixpkgs=./tools/nix/pkgs.nix \ |
85 | | - --pure --keep TAR_DIR --keep FLAKY_TESTS \ |
86 | | - --keep SCCACHE_GHA_ENABLED --keep ACTIONS_CACHE_SERVICE_V2 --keep ACTIONS_RESULTS_URL --keep ACTIONS_RUNTIME_TOKEN \ |
87 | | - --arg useSeparateDerivationForV8 true \ |
88 | | - --arg loadJSBuiltinsDynamically false \ |
89 | | - --arg ccache "${NIX_SCCACHE:-null}" \ |
90 | | - --arg devTools '[]' \ |
91 | | - --arg benchmarkTools '[]' \ |
92 | | - --run ' |
93 | | - make build-ci -j4 V=1 |
94 | | - ' |
95 | | - mv out/Release/node base_node |
96 | | -
|
97 | | - - name: Checkout the merge commit |
98 | | - run: git reset FETCH_HEAD --hard |
99 | | - |
100 | | - - name: Re-build Node.js on the merge commit |
101 | | - # ccache is disabled here to avoid polluting the cache. Local build outputs should make this build relatively quick anyway. |
102 | | - run: | |
103 | | - nix-shell \ |
104 | | - -I nixpkgs=./tools/nix/pkgs.nix \ |
105 | | - --pure \ |
106 | | - --arg useSeparateDerivationForV8 true \ |
107 | | - --arg loadJSBuiltinsDynamically false \ |
108 | | - --arg ccache 'null' \ |
109 | | - --arg devTools '[]' \ |
110 | | - --arg benchmarkTools '[]' \ |
111 | | - --run ' |
112 | | - make -j4 V=1 |
113 | | - ' |
114 | | -
|
115 | | - - name: Run benchmark |
116 | | - run: | |
117 | | - nix-shell \ |
118 | | - -I nixpkgs=./tools/nix/pkgs.nix \ |
119 | | - --pure --keep FILTER --keep LC_ALL --keep LANG \ |
120 | | - --arg loadJSBuiltinsDynamically false \ |
121 | | - --arg ccache 'null' \ |
122 | | - --arg icu 'null' \ |
123 | | - --arg sharedLibDeps '{}' \ |
124 | | - --arg devTools '[]' \ |
125 | | - --run ' |
126 | | - set -o pipefail |
127 | | - ./base_node benchmark/compare.js \ |
128 | | - --filter "$FILTER" \ |
129 | | - --runs ${{ inputs.runs }} \ |
130 | | - --old ./base_node --new ./node \ |
131 | | - -- ${{ inputs.category }} \ |
132 | | - | tee /dev/stderr \ |
133 | | - > ${{ matrix.system }}.csv |
134 | | - echo "> [!WARNING] " |
135 | | - echo "> Do not take GHA benchmark results as face value, always confirm them" |
136 | | - echo "> using a dedicated machine, e.g. Jenkins CI." |
137 | | - echo |
138 | | - echo "Benchmark results:" |
139 | | - echo |
140 | | - echo '"'"'```'"'"' |
141 | | - Rscript benchmark/compare.R < ${{ matrix.system }}.csv |
142 | | - echo '"'"'```'"'"' |
143 | | - echo |
144 | | - echo "> [!WARNING] " |
145 | | - echo "> Do not take GHA benchmark results as face value, always confirm them" |
146 | | - echo "> using a dedicated machine, e.g. Jenkins CI." |
147 | | - ' | tee /dev/stderr >> "$GITHUB_STEP_SUMMARY" |
148 | | - env: |
149 | | - FILTER: ${{ inputs.filter }} |
150 | | - |
151 | | - - name: Upload raw benchmark results |
152 | | - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 |
153 | | - with: |
154 | | - name: csv-${{ matrix.system }} |
155 | | - path: ${{ matrix.system }}.csv |
156 | | - |
157 | 34 | aggregate-results: |
158 | | - needs: build |
| 35 | + # needs: build |
159 | 36 | name: Aggregate benchmark results |
160 | 37 | runs-on: ubuntu-slim |
161 | 38 | steps: |
|
174 | 51 | pattern: csv-* |
175 | 52 | merge-multiple: true |
176 | 53 | path: raw-results |
| 54 | + github-token: ${{ secrets.GH_USER_TOKEN }} # token with actions:read permissions on target repo |
| 55 | + run-id: 26591497321 |
177 | 56 |
|
178 | 57 | - uses: cachix/install-nix-action@96951a368ba55167b55f1c916f7d416bac6505fe # v31.10.3 |
179 | 58 | with: |
|
0 commit comments