Skip to content

GHA: release management for the firebase C++ SDK #1

GHA: release management for the firebase C++ SDK

GHA: release management for the firebase C++ SDK #1

Workflow file for this run

name: Checks
on:
pull_request:
types: [opened, reopened, synchronize, labeled, unlabeled]
env:
triggerLabelFull: "tests-requested: full"
triggerLabelQuick: "tests-requested: quick"
statusLabelInProgress: "tests: in-progress"
statusLabelFailed: "tests: failed"
skipReleaseNotesLabel: "skip-release-notes"
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
file_format_check:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
submodules: false
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: 3.7
- name: Install prerequisites
run: python scripts/gha/install_prereqs_desktop.py
- name: log clang format version
shell: bash
run: clang-format --version
- name: git fetch origin main
shell: bash
run: git fetch origin main
- name: Detect Formatting Changes
shell: bash
run: python3 scripts/format_code.py -git_diff -noformat_file -verbose -github_log
check_integration_test_labels:
# This check fails if integration tests are queued, in progress, or failed.
runs-on: ubuntu-20.04
steps:
- uses: docker://agilepathway/pull-request-label-checker:latest
with:
none_of: "${{ env.statusLabelInProgress }},${{ env.statusLabelFailed }},${{ env.triggerLabelFull }},${{ env.triggerLabelQuick }}"
repo_token: ${{ github.token }}
generated_docs_check:
# This check succeeds if Doxygen documentation generates without errors.
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
submodules: false
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: 3.7
- name: Install prerequisites
run: |
python scripts/gha/install_prereqs_desktop.py
python -m pip install unidiff
- name: Generate headers
run: |
mkdir build
cd build
cmake ..
cmake --build . --target FIREBASE_GENERATED_HEADERS
- name: Install doxygen
run: sudo apt-get install doxygen
- name: Run doxygen
run: |
cp docs/Doxyfile /tmp/Doxyfile
echo INPUT = $(find */src/include/firebase/ build/generated/ -name '*.h') >> /tmp/Doxyfile
doxygen /tmp/Doxyfile 2>doxygen_errors.txt
cat doxygen_errors.txt
- name: Check output
run: |
if grep -Eq "error:|warning:" doxygen_errors.txt; then
# Grep for warnings and print them out (replacing \n with %0A for github log)
grep -E "error:|warning:|^ parameter" doxygen_errors.txt > doxygen_errors_filtered.txt
cat doxygen_errors_filtered.txt | sed ':a;N;$!ba;s/\n/%0A/g' | sed 's/^/::error ::DOXYGEN ERRORS: %0A/'
python scripts/gha/pr_file_commenter.py -t ${{ github.token }} -p ${{ github.event.pull_request.number }} -T hidden-doxygen-comment-tag -P '📝 __Documentation issue:__ ' -S '' -f 10 < doxygen_errors_filtered.txt || true
exit 1
fi
copyright_check:
# Check for Google copyright in each file.
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
submodules: false
- name: Run check_copyright.sh
run: |
set -e
bash scripts/gha/check_copyright.sh -g
release_notes_check:
# Check that the readme was updated, unless the PR has a specific label set (env.skipReleaseNotesLabel).
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
# Skip this if the PR has the skipReleaseNotes label or if it's a merge to other than main.
if: ${{!contains(github.event.pull_request.labels.*.name, env.skipReleaseNotesLabel) && (github.event.pull_request.base.ref == 'main')}}
with:
fetch-depth: 0
submodules: false
- name: Check whether release notes have been updated
# Skip this if the PR has the skipReleaseNotes label or if it's a merge to other than main.
if: ${{!contains(github.event.pull_request.labels.*.name, env.skipReleaseNotesLabel) && (github.event.pull_request.base.ref == 'main')}}
run: |
set -e
# Filename to check.
README_FILE=release_build_files/readme.md
# Determine the github merge base - same logic as integration_tests.yml
# "git merge-base main branch_name" will give the common ancestor of both branches.
MERGE_BASE=$(git merge-base origin/${{github.event.pull_request.head.ref}} origin/${{github.event.pull_request.base.ref}} || true)
# If MERGE_BASE can't be determined, ignore this check, something odd is going on.
if [[ -n "${MERGE_BASE}" ]]; then
DIFF_RESULT=$(git diff --name-only "origin/${{github.event.pull_request.head.ref}}..${MERGE_BASE}" -- "${README_FILE}")
if [[ "${DIFF_RESULT}" != "${README_FILE}" ]]; then
echo "::error ::Please update release notes (${README_FILE}) or add '${{env.skipReleaseNotesLabel}}' label."
exit 1
fi
fi