mirror of
https://github.com/firebase/firebase-ios-sdk
synced 2026-11-10 22:45:59 +05:45
114 lines
3.4 KiB
YAML
114 lines
3.4 KiB
YAML
name: infra.api_diff
|
|
|
|
on: [pull_request, workflow_dispatch]
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.head_ref || github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
env:
|
|
STAGE_PROGRESS: progress
|
|
STAGE_END: end
|
|
PR_API_OUTPUT: ci_outputs/pr_branch_api
|
|
BASE_API_OUTPUT: ci_outputs/base_branch_api
|
|
DIFF_REPORT_OUTPUT: ci_outputs/diff_report
|
|
|
|
permissions:
|
|
contents: read
|
|
pull-requests: write
|
|
|
|
jobs:
|
|
diff_report:
|
|
runs-on: macos-latest
|
|
permissions:
|
|
contents: read
|
|
pull-requests: write
|
|
env:
|
|
FIREBASECI_USE_LATEST_GOOGLEAPPMEASUREMENT: 1
|
|
|
|
steps:
|
|
- name: Checkout PR branch
|
|
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
|
with:
|
|
fetch-depth: 2
|
|
persist-credentials: false
|
|
|
|
- name: Copy diff report tools
|
|
run: cp -a scripts/api_diff_report/. ~/api_diff_report
|
|
|
|
- id: get_changed_files
|
|
name: Get changed file list
|
|
run: |
|
|
echo "file_list=$(git diff --name-only -r HEAD^1 HEAD | tr '\n' ' ')" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Setup python
|
|
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
|
|
with:
|
|
python-version: '3.11'
|
|
|
|
- name: Install Prerequisites
|
|
run: ~/api_diff_report/prerequisite.sh
|
|
|
|
- name: Clean Diff Report Comment in PR
|
|
env:
|
|
STAGE: ${{ env.STAGE_PROGRESS }}
|
|
TOKEN: ${{github.token}}
|
|
PR_NUMBER: ${{github.event.pull_request.number}}
|
|
RUN_ID: ${{github.run_id}}
|
|
run: |
|
|
python ~/api_diff_report/pr_commenter.py \
|
|
--stage "$STAGE" \
|
|
--token "$TOKEN" \
|
|
--pr_number "$PR_NUMBER" \
|
|
--commit "$GITHUB_SHA" \
|
|
--run_id "$RUN_ID"
|
|
|
|
- name: Generate API files for PR branch
|
|
env:
|
|
FILE_LIST: ${{ steps.get_changed_files.outputs.file_list }}
|
|
run: |
|
|
python ~/api_diff_report/api_info.py \
|
|
--file_list "$FILE_LIST" \
|
|
--output_dir ${{ env.PR_API_OUTPUT }}
|
|
|
|
- name: Checkout Base branch
|
|
run: git checkout HEAD^
|
|
|
|
- name: Generate API files for Base branch
|
|
env:
|
|
FILE_LIST: ${{ steps.get_changed_files.outputs.file_list }}
|
|
run: |
|
|
python ~/api_diff_report/api_info.py \
|
|
--file_list "$FILE_LIST" \
|
|
--output_dir ${{ env.BASE_API_OUTPUT }}
|
|
|
|
- name: Generate API Diff Report
|
|
run: |
|
|
python ~/api_diff_report/api_diff_report.py \
|
|
--pr_branch ${{ env.PR_API_OUTPUT }} \
|
|
--base_branch ${{ env.BASE_API_OUTPUT }} \
|
|
--output_dir ${{ env.DIFF_REPORT_OUTPUT }}
|
|
|
|
- name: Update Diff Report Comment in PR
|
|
env:
|
|
STAGE: ${{ env.STAGE_END }}
|
|
REPORT: ${{ env.DIFF_REPORT_OUTPUT }}
|
|
TOKEN: ${{github.token}}
|
|
PR_NUMBER: ${{github.event.pull_request.number}}
|
|
RUN_ID: ${{github.run_id}}
|
|
run: |
|
|
python ~/api_diff_report/pr_commenter.py \
|
|
--stage "$STAGE" \
|
|
--report "$REPORT" \
|
|
--token "$TOKEN" \
|
|
--pr_number "$PR_NUMBER" \
|
|
--commit "$GITHUB_SHA" \
|
|
--run_id "$RUN_ID"
|
|
|
|
- uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
|
|
if: ${{ !cancelled() }}
|
|
with:
|
|
name: api_info_and_report
|
|
path: ci_outputs
|
|
retention-days: 1
|