Performance tests #1518
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: 'Performance tests' | |
| on: | |
| schedule: | |
| - cron: '0 2-23/4 * * *' | |
| push: | |
| branches: [main] | |
| workflow_dispatch: | |
| inputs: | |
| sendReport: | |
| description: 'Whether to send the stats to the Datadog dashboards' | |
| required: true | |
| default: 'false' | |
| hyperfineOptions: | |
| description: 'Options passed to Hyperfine' | |
| required: false | |
| default: '' | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| build: | |
| name: 'Building the benchmark binary' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout the repo | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| - name: Build the repository | |
| uses: ./.github/actions/build | |
| with: | |
| target: x86_64-unknown-linux-musl | |
| profile: release-lto | |
| - name: Store the build artifacts | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 | |
| with: | |
| name: benchmark-binary | |
| path: target/x86_64-unknown-linux-musl/release-lto | |
| benchmark: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| packageManager: ${{ fromJSON(github.event_name == 'schedule' && '[["Yarn 6.x","zpm"],["Yarn 4.x","yarn"],["npm","npm"],["pnpm","pnpm"],["Yarn Classic","classic"]]' || '[["Yarn 6.x","zpm"]]') }} | |
| benchmark: | |
| - [Next.js, next] | |
| - [Gatsby, gatsby] | |
| - [Monorepo, monorepo] | |
| scenario: | |
| - [Full cold install, install-full-cold] | |
| - [Cache only, install-cache-only] | |
| - [Cache + lockfile, install-cache-and-lock] | |
| - [Recurrent call, install-ready] | |
| needs: [build] | |
| name: 'Running ${{matrix.packageManager[0]}} on ${{matrix.benchmark[0]}} (${{matrix.scenario[0]}})' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout the repo | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| - name: Install Yarn Switch | |
| uses: yarnpkg/setup-action@main | |
| - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8 | |
| with: | |
| name: benchmark-binary | |
| path: local | |
| - name: Set the +x flag on the binaries | |
| run: | | |
| chmod +x local/{yarn,yarn-bin} | |
| - name: Install Hyperfine | |
| run: | | |
| wget https://github.com/sharkdp/hyperfine/releases/download/v1.10.0/hyperfine_1.10.0_amd64.deb | |
| sudo dpkg -i hyperfine_1.10.0_amd64.deb | |
| - name: 'Creates a temporary directory' | |
| run: | | |
| BENCH_DIR=$(mktemp -d) | |
| echo "BENCH_DIR=$BENCH_DIR" >> "$GITHUB_ENV" | |
| - name: Prepare Node | |
| uses: ./.github/actions/prepare-node | |
| - name: 'Run the performance test' | |
| run: | | |
| bash scripts/bench-run.sh ${{matrix.packageManager[1]}} ${{matrix.benchmark[1]}} hyperfine "$BENCH_DIR" ${{matrix.scenario[1]}} || true | |
| if [[ '${{github.event.inputs.sendReport}}' != 'false' ]]; then | |
| yarn node scripts/submit-bench-data.js ${{matrix.packageManager[1]}} ${{matrix.benchmark[1]}} "$BENCH_DIR" | |
| fi | |
| env: | |
| DD_API_KEY: ${{secrets.DD_API_KEY}} | |
| HYPERFINE_OPTIONS: ${{github.event.inputs.hyperfineOptions}} | |
| YARN_ENABLE_HARDENED_MODE: '0' |