Repository navigation
Temporary: Run the builds across Rubies on this branch #1
Workflow file for this run
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: Benchmarks across Rubies | |
| # Every build on one machine, so the results site can compare i/s across Rubies (benchmarks.yml runs each Ruby on its own machine, which only allows comparing idioms inside one Ruby). | |
| # Weekly, because a full run takes about 3 hours per shard. | |
| on: | |
| schedule: | |
| # Sunday 03:00 UTC, away from the working day's PR runs. | |
| - cron: '0 3 * * 0' | |
| workflow_dispatch: | |
| # Temporary: the first run on GitHub runners, from this PR's branch (workflow_dispatch only works once the file is on main). Removed before merge. | |
| push: | |
| branches: [feature/results-site-view-2] | |
| jobs: | |
| shard: | |
| name: shard ${{ matrix.shard }} | |
| runs-on: ubuntu-latest | |
| # 35 passes of about 13 files each; the job limit is 6 hours. | |
| timeout-minutes: 330 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| # Each shard gets every 6th benchmark file and runs all 26 builds on them. | |
| shard: [0, 1, 2, 3, 4, 5] | |
| # Read by docker/collect_results.rb. | |
| env: | |
| RESULTS_COMMIT: ${{ github.sha }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| # Each image is pulled or built before its Ruby's passes and removed after them; this shows how much disk the runner had to start with. | |
| - name: Show free disk | |
| run: df -h / | |
| - name: Run every build on this machine | |
| run: ruby script/run_cross_ruby.rb --shard ${{ matrix.shard }} --shards 6 --fresh-images --out results | |
| - name: Upload results | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: cross-ruby-${{ matrix.shard }} | |
| path: results/ | |
| if-no-files-found: warn | |
| retention-days: 90 | |
| # Builds the page from every shard's results (also when a shard failed, so there is a preview) and the live site's "Does it hold?" data. | |
| site: | |
| needs: shard | |
| if: ${{ !cancelled() }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| pattern: cross-ruby-* | |
| path: cross-ruby/ | |
| merge-multiple: true | |
| - name: Get the live "Does it hold?" data | |
| run: ruby .github/scripts/fetch-live-view.rb results.json | |
| - name: Build the results site | |
| # A failed shard leaves benchmarks or Rubies out, so the page says so. | |
| env: | |
| RESULTS_INCOMPLETE: ${{ needs.shard.result != 'success' && '1' || '' }} | |
| run: docker compose run --rm -T -e RESULTS_INCOMPLETE --entrypoint ruby ruby_4.0 script/build_results_site.rb --cross-ruby cross-ruby --advice-json live/results.json results _site | |
| - name: Upload the site preview | |
| id: preview | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: site-preview | |
| path: _site/ | |
| overwrite: true | |
| - name: Link the site preview in the run summary | |
| env: | |
| PREVIEW_URL: ${{ steps.preview.outputs.artifact-url }} | |
| run: | | |
| { | |
| echo "### Results site preview" | |
| echo "" | |
| echo "[Download the site preview]($PREVIEW_URL) (a zip, needs a GitHub login), unzip it and open \`index.html\` in a browser." | |
| } >> "$GITHUB_STEP_SUMMARY" | |
| # Publishes only a complete run of main. | |
| # Shares the pages lock with benchmarks.yml, and rebuilds while holding it with the "Does it hold?" data the live site has then, so neither view's deploy drops the other's. | |
| deploy: | |
| needs: [shard, site] | |
| if: github.ref_name == 'main' && needs.shard.result == 'success' && needs.site.result == 'success' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| pages: write | |
| id-token: write | |
| # fetch-live-view.rb --fresh reads the Pages deployments. | |
| deployments: read | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| concurrency: | |
| group: pages | |
| cancel-in-progress: false | |
| queue: max | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: site-preview | |
| path: preview/ | |
| - name: Get the live "Does it hold?" data | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: ruby .github/scripts/fetch-live-view.rb results.json --fresh | |
| - name: Build the site with both views | |
| run: docker compose run --rm -T --entrypoint ruby ruby_4.0 script/build_results_site.rb --advice-json live/results.json --rubies-json preview/cross-ruby.json results _site | |
| - name: Upload the site for GitHub Pages | |
| uses: actions/upload-pages-artifact@v5 | |
| with: | |
| path: _site/ | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v5 |