pr-upload-render-test-result #2527
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
name: pr-upload-render-test-result | |
permissions: | |
pull-requests: write # This is required to leave a comment on the PR | |
id-token: write # This is required for requesting the AWS JWT | |
on: | |
workflow_run: | |
workflows: [linux-ci] | |
types: | |
- completed | |
jobs: | |
upload-render-test-result: | |
runs-on: ubuntu-22.04 | |
if: github.event.workflow_run.event == 'pull_request' | |
env: | |
html_filename: "linux-drawable.html" | |
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: render-test-result | |
# when there are no results, the render test succeeded | |
# in this case the subsequent steps can be skipped | |
- name: "Check existence render test results HTML" | |
id: render_test_results | |
uses: andstor/[email protected] | |
with: | |
files: ${{ env.html_filename }} | |
- name: Configure AWS Credentials | |
if: steps.render_test_results.outputs.files_exists | |
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: Upload render test results to S3 | |
if: steps.render_test_results.outputs.files_exists | |
id: upload_render_test_results | |
run: | | |
aws s3 cp metrics/${{ env.html_filename }} \ | |
s3://maplibre-native-test-artifacts/${{ github.run_id }}-${{ env.html_filename }} \ | |
--expires "$(date -d '+30 days' --utc +'%Y-%m-%dT%H:%M:%SZ')" | |
- name: 'Leave comment on PR with test results' | |
if: steps.render_test_results.outputs.files_exists | |
uses: marocchino/sticky-pull-request-comment@v2 | |
with: | |
header: render-test-result | |
number: ${{ steps.get-pr-number.outputs.pr-number }} | |
message: | | |
Render test results at https://maplibre-native-test-artifacts.s3.eu-central-1.amazonaws.com/${{ github.run_id }}-${{ env.html_filename }} |