pr-tests #603
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-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: | |
pr-bloaty: | |
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@v3 | |
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: | |
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 | |
run: | | |
wget -O mbgl-benchmark-runner-main "${download_url}/mbgl-benchmark-runner-main" | |
chmod +x mbgl-benchmark-runner-main | |
# needed for compare.py | |
- name: Install scipy | |
run: pip3 install scipy | |
- 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 |