-
Notifications
You must be signed in to change notification settings - Fork 137
148 lines (138 loc) · 6.18 KB
/
Copy pathchecks.yml
File metadata and controls
148 lines (138 loc) · 6.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
name: Checks
on:
pull_request:
types: [opened, reopened, synchronize, labeled, unlabeled]
permissions:
contents: read
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-22.04
steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # ratchet:actions/checkout@v3
with:
submodules: false
persist-credentials: false
- name: Setup python
uses: actions/setup-python@7f4fc3e22c37d6ff65e88745f38bd3157c663f7c # ratchet:actions/setup-python@v4
with:
python-version: 3.9
- 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-22.04
permissions:
contents: read
pull-requests: read
steps:
- uses: docker://index.docker.io/agilepathway/pull-request-label-checker@sha256:14f5f3dfda922496d07d53494e2d2b42885165f90677a1c03d600059b7706a61 # ratchet: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-22.04
permissions:
contents: read
pull-requests: write
steps:
- uses: lukka/get-cmake@591817e96fcad43505fb4eae36172462abb3a42e # ratchet:lukka/get-cmake@latest
with:
cmakeVersion: "~3.31.0"
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # ratchet:actions/checkout@v3
with:
submodules: false
persist-credentials: false
- name: Setup python
uses: actions/setup-python@7f4fc3e22c37d6ff65e88745f38bd3157c663f7c # ratchet:actions/setup-python@v4
with:
python-version: 3.9
- 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-22.04
steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # ratchet:actions/checkout@v3
with:
submodules: false
persist-credentials: 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-22.04
steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # ratchet: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
persist-credentials: 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')}}
env:
HEAD_REF: ${{github.event.pull_request.head.ref}}
BASE_REF: ${{github.event.pull_request.base.ref}}
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/${HEAD_REF}" "origin/${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/${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