# Runs Bloaty (size test) and Google Benchmark and reports results on PR name: pr-linux-tests on: workflow_run: workflows: [linux-ci] types: - completed env: download_url: https://maplibre-native.s3.eu-central-1.amazonaws.com legacy_maplibre_sha: d38709084a9865fe0bb8300aec70ebf8243b3d43 bloaty_sha: 8be8b448550b37c978e8defd9d421c0464c52cc7 permissions: pull-requests: write id-token: write # This is required for requesting the AWS JWT jobs: pre_job: if: github.event.workflow_run.event == 'pull_request' runs-on: ubuntu-latest outputs: should_skip: ${{ steps.parent_workflow.outputs.was_skipped_or_cancelled }} steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: sparse-checkout: | .github .nvmrc persist-credentials: false - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 with: node-version-file: '.nvmrc' - run: npm install - name: Get parent workflow result id: parent_workflow run: node .github/scripts/check-job-skipped.ts env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} TEST_RUN_ID: ${{ github.event.workflow_run.id }} JOB_NAME: linux-build-and-test pr-bloaty: needs: pre_job if: needs.pre_job.outputs.should_skip == 'false' runs-on: ubuntu-24.04 steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - uses: ./.github/actions/get-pr-number id: get-pr-number - uses: ./.github/actions/download-workflow-run-artifact with: artifact-name: mbgl-render expect-files: "mbgl-render" - name: Download mbgl-render-main run: wget -O mbgl-render-main "${download_url}/mbgl-render-main" - name: Download mbgl-render-legacy id: download-mbgl-render-legacy run: wget -O mbgl-render-legacy "${download_url}/mbgl-render-${legacy_maplibre_sha}" continue-on-error: true - name: Cache Bloaty id: cache-bloaty uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 with: path: bloaty/build/bloaty key: bloaty-${{ env.bloaty_sha }} # because Google is not making a release... # https://github.com/google/bloaty/issues/334 - name: Compile Bloaty if: ${{ !steps.cache-bloaty.outputs.cache-hit }} run: | git clone https://github.com/google/bloaty.git cd bloaty git checkout "$bloaty_sha" cmake -B build -G Ninja -S . cmake --build build - name: Run Bloaty McBloatface on main run: bloaty/build/bloaty mbgl-render -- mbgl-render-main -n 0 -s vm -d compileunits > tlus_diff_main.txt - name: Run Bloaty McBloatface on legacy if: steps.download-mbgl-render-legacy.outcome == 'success' run: bloaty/build/bloaty mbgl-render -- mbgl-render-legacy -n 0 -s vm -d compileunits > tlus_diff_legacy.txt - name: Configure AWS Credentials if: github.ref == 'refs/heads/main' && vars.OIDC_AWS_ROLE_TO_ASSUME uses: aws-actions/configure-aws-credentials@e6de054238d6b7531b4efff3b6587d9aade6a06c # v6.2.3 with: aws-region: us-west-2 role-to-assume: ${{ vars.OIDC_AWS_ROLE_TO_ASSUME }} role-session-name: ${{ github.run_id }} - name: Prepare Bloaty message (main) run: | report_path=bloaty-results/pr-${{ steps.get-pr-number.outputs.pr-number }}-compared-to-main.txt aws s3 cp tlus_diff_main.txt s3://maplibre-native/"$report_path" { echo "# Bloaty Results 🐋" echo 'Compared to main' echo '```' awk 'NR <= 2; END { print }' tlus_diff_main.txt echo '```' echo "Full report: $download_url/$report_path" echo "---" } >> message.md - name: Prepare Bloaty message (legacy) run: | report_path=bloaty-results/pr-${{ steps.get-pr-number.outputs.pr-number }}-compared-to-legacy.txt aws s3 cp tlus_diff_legacy.txt s3://maplibre-native/"$report_path" { echo "Compared to $legacy_maplibre_sha (legacy)" echo '```' awk 'NR <= 2; END { print }' tlus_diff_legacy.txt echo '```' echo "Full report: $download_url/$report_path" } >> message.md - name: Leave a comment with Bloaty results uses: marocchino/sticky-pull-request-comment@5770ad5eb8f42dd2c4f34da00c94c5381e49af88 # v3.0.5 with: number: ${{ steps.get-pr-number.outputs.pr-number }} header: bloaty path: message.md pr-benchmark: needs: pre_job if: needs.pre_job.outputs.should_skip == 'false' runs-on: ubuntu-24.04 steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: submodules: true persist-credentials: false - uses: ./.github/actions/get-pr-number id: get-pr-number - uses: ./.github/actions/download-workflow-run-artifact with: artifact-name: mbgl-benchmark-runner expect-files: "mbgl-benchmark-runner" - name: Download mbgl-benchmark-runner-main, set permissions run: | wget -O mbgl-benchmark-runner-main "${download_url}/mbgl-benchmark-runner-main" chmod +x mbgl-benchmark-runner-main mbgl-benchmark-runner # needed for compare.py - name: Install scipy run: pip3 install scipy - name: Install dependencies run: .github/scripts/install-linux-deps - name: Run Benchmarks # excluding the API tests because they hang https://github.com/maplibre/maplibre-native/issues/1808 run: python3 vendor/benchmark/tools/compare.py --no-color benchmarks ./mbgl-benchmark-runner-main ./mbgl-benchmark-runner --benchmark_filter='^[^A][^P][^I].*' > benchmark_out.txt - name: Configure AWS Credentials if: github.ref == 'refs/heads/main' && vars.OIDC_AWS_ROLE_TO_ASSUME uses: aws-actions/configure-aws-credentials@e6de054238d6b7531b4efff3b6587d9aade6a06c # v6.2.3 with: aws-region: us-west-2 role-to-assume: ${{ vars.OIDC_AWS_ROLE_TO_ASSUME }} role-session-name: ${{ github.run_id }} - name: Prepare Benchmark message run: | sed -n '/Comparing/,$p' benchmark_out.txt | tail -n +2 > benchmark_diff.txt report_path=benchmark-results/pr-${{ steps.get-pr-number.outputs.pr-number }}-compared-to-main.txt aws s3 cp benchmark_diff.txt s3://maplibre-native/"$report_path" { echo "Benchmark Results ⚡" echo '```' awk 'NR <= 2; END { print }' benchmark_diff.txt echo '```' echo "Full report: $download_url/$report_path" } >> message.md - name: Leave a comment with Benchmark results uses: marocchino/sticky-pull-request-comment@5770ad5eb8f42dd2c4f34da00c94c5381e49af88 # v3.0.5 with: number: ${{ steps.get-pr-number.outputs.pr-number }} header: benchmark path: message.md