pr-linux-tests #2704
This file contains 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
# 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.check_skip.outputs.should_skip }} | |
steps: | |
- id: check_skip | |
run: | | |
conclusion=$(curl ${{ github.event.workflow_run.jobs_url }} | jq -r '.jobs[] | select(.name == "linux-build-and-test").conclusion') | |
should_skip=$([[ "$conclusion" = "skipped" || "$conclusion" = "cancelled" ]] && echo "true" || echo "false") | |
echo "should_skip=$should_skip" >> "$GITHUB_OUTPUT" | |
pr-bloaty: | |
needs: pre_job | |
if: needs.pre_job.outputs.should_skip == 'false' | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- 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: Get latest CMake and Ninja | |
uses: lukka/get-cmake@latest | |
with: | |
cmakeVersion: latest | |
ninjaVersion: latest | |
- name: Cache Bloaty | |
id: cache-bloaty | |
uses: actions/cache@v4 | |
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@v4 | |
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@v2 | |
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-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- 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 | |
# not sure which one of these are runtime dependencies | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y \ | |
libcurl4-openssl-dev \ | |
libuv1-dev \ | |
libjpeg-dev \ | |
libpng-dev \ | |
libglfw3-dev \ | |
libwebp-dev \ | |
libopengl0 | |
- 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@v4 | |
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@v2 | |
with: | |
number: ${{ steps.get-pr-number.outputs.pr-number }} | |
header: benchmark | |
path: message.md |