Skip to content

Commit

Permalink
Add CURL as a fallback to the link-verifier check (#112)
Browse files Browse the repository at this point in the history
Add CURL as a fallback to the link-verifier check

This is needed to address some of the recent failures observed with
Renesas links.

Signed-off-by: Gaurav Aggarwal <[email protected]>
  • Loading branch information
aggarg authored Sep 30, 2024
1 parent 8ee0846 commit 7ad2e17
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 5 deletions.
20 changes: 18 additions & 2 deletions .github/workflows/pr_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ jobs:
org: FreeRTOS,
branch: main,
run-link-verifier: true,
run-spelling-check: true,
run-complexity: false,
run-doxygen: false,
},
Expand All @@ -34,6 +35,7 @@ jobs:
org: FreeRTOS,
branch: main,
run-link-verifier: true,
run-spelling-check: true,
run-complexity: false,
run-doxygen: false,
},
Expand All @@ -42,6 +44,7 @@ jobs:
org: FreeRTOS,
branch: main,
run-link-verifier: false,
run-spelling-check: true,
run-complexity: false,
run-doxygen: false,
exclude-dirs: ethernet, drivers, FreeRTOS/Demo,
Expand All @@ -51,6 +54,7 @@ jobs:
org: FreeRTOS,
branch: main,
run-link-verifier: true,
run-spelling-check: true,
run-complexity: true,
run-doxygen: true,
build-flags: -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_FLAGS='--coverage -Wall -Wextra -Werror',
Expand All @@ -61,6 +65,7 @@ jobs:
org: FreeRTOS,
branch: main,
run-link-verifier: true,
run-spelling-check: true,
run-complexity: true,
run-doxygen: true,
build-flags: -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_FLAGS='--coverage -Wall -Wextra -DNDEBUG',
Expand All @@ -71,6 +76,7 @@ jobs:
org: FreeRTOS,
branch: main,
run-link-verifier: true,
run-spelling-check: true,
run-complexity: true,
run-doxygen: true,
build-flags: -DCMAKE_BUILD_TYPE=Debug -DBUILD_CLONE_SUBMODULES=ON -DCMAKE_C_FLAGS='--coverage -Wall -Wextra -Werror',
Expand All @@ -81,6 +87,7 @@ jobs:
org: FreeRTOS,
branch: main,
run-link-verifier: true,
run-spelling-check: true,
run-complexity: true,
run-doxygen: true,
build-flags: -DCMAKE_BUILD_TYPE=Debug -DBUILD_CLONE_SUBMODULES=ON -DCMAKE_C_FLAGS='--coverage -Wall -Wextra -Werror -DNDEBUG -DLIBRARY_LOG_LEVEL=LOG_DEBUG',
Expand All @@ -90,7 +97,8 @@ jobs:
repository: corePKCS11,
org: FreeRTOS,
branch: main,
run-link-verifier: true,
run-link-verifier: false,
run-spelling-check: false,
run-complexity: true,
run-doxygen: true,
build-flags: -DCMAKE_BUILD_TYPE=Debug -DSYSTEM_TESTS=0 -DCMAKE_C_FLAGS='--coverage -Wall -Wextra -DNDEBUG',
Expand All @@ -102,6 +110,7 @@ jobs:
org: FreeRTOS,
branch: main,
run-link-verifier: true,
run-spelling-check: true,
run-complexity: true,
run-doxygen: true,
build-flags: -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_FLAGS='--coverage -Wall -Wextra -Werror -DNDEBUG -Wno-error=pedantic -Wno-variadic-macros -DLOGGING_LEVEL_DEBUG=1',
Expand All @@ -112,6 +121,7 @@ jobs:
org: FreeRTOS,
branch: main,
run-link-verifier: true,
run-spelling-check: true,
run-complexity: true,
run-doxygen: true,
build-flags: -DCMAKE_BUILD_TYPE=Debug -DBUILD_CLONE_SUBMODULES=ON -DCMAKE_C_FLAGS='--coverage -Wall -Wextra -Werror -DNDEBUG',
Expand All @@ -122,6 +132,7 @@ jobs:
org: AWS,
branch: main,
run-link-verifier: true,
run-spelling-check: true,
run-complexity: true,
run-doxygen: true,
build-flags: -DBUILD_CLONE_SUBMODULES=ON -DCMAKE_C_FLAGS='--coverage -Wall -Wextra -Werror -DNDEBUG',
Expand All @@ -132,6 +143,7 @@ jobs:
org: AWS,
branch: main,
run-link-verifier: true,
run-spelling-check: true,
run-complexity: true,
build-flags: -DCMAKE_BUILD_TYPE=Debug -DBUILD_CLONE_SUBMODULES=ON -DCMAKE_C_FLAGS='--coverage -Wall -Wextra -Werror -DNDEBUG',
coverage-skips: '"\*test\*" "\*CMakeCCompilerId\*" "\*mocks\*"',
Expand All @@ -141,6 +153,7 @@ jobs:
org: AWS,
branch: main,
run-link-verifier: true,
run-spelling-check: true,
run-complexity: true,
run-doxygen: true,
build-flags: -DCMAKE_BUILD_TYPE=Debug -DBUILD_CLONE_SUBMODULES=ON -DCMAKE_C_FLAGS='--coverage -Wall -Wextra -Werror -DNDEBUG',
Expand All @@ -151,6 +164,7 @@ jobs:
org: AWS,
branch: main,
run-link-verifier: true,
run-spelling-check: true,
run-complexity: false,
run-doxygen: true,
build-flags: -DCMAKE_BUILD_TYPE=Debug -DBUILD_CLONE_SUBMODULES=ON -DCMAKE_C_FLAGS='--coverage -Wall -Wextra -Werror',
Expand All @@ -161,6 +175,7 @@ jobs:
org: AWS,
branch: main,
run-link-verifier: true,
run-spelling-check: true,
run-complexity: true,
run-doxygen: true,
build-flags: -DCMAKE_BUILD_TYPE=Debug -DBUILD_CLONE_SUBMODULES=ON -DCMAKE_C_FLAGS='--coverage -Wall -Wextra -DNDEBUG',
Expand All @@ -170,6 +185,7 @@ jobs:
org: AWS,
branch: main,
run-complexity: true,
run-spelling-check: true,
run-doxygen: true,
build-flags: -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_FLAGS='--coverage -Wall -Wextra -DNDEBUG -DLOGGING_LEVEL_DEBUG=1',
coverage-skips: '"\*test\*" "\*CMakeCCompilerId\*" "\*mocks\*"',
Expand Down Expand Up @@ -226,7 +242,7 @@ jobs:
generate_zip: true

- name: "Spelling Check: ${{ matrix.inputs.repository }} "
if: success() || failure()
if: matrix.inputs.run-spelling-check && ( success() || failure() )
uses: ./spellings
with:
path: repo/${{ matrix.inputs.repository }}
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ jobs:
uses: ./complexity
with:
path: coreMQTT
# The default threshold for all repos is 10
horrid_threshold: 10
# The default threshold for all repos is 10 but coreMQTT requires 12.
horrid_threshold: 12

test-doxygen-zip-check:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -215,7 +215,8 @@ jobs:
echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}"
declare -a EXCLUDE=("\*test/\*")
set +e
lcov --rc lcov_branch_coverage=1 --remove build/coverage.info -o build/coverage.info
lcov --directory build/ --base-directory build/ --initial --capture --rc lcov_branch_coverage=1 --output-file=build/base_coverage.info
lcov --base-directory build/ --directory build/ --add-tracefile build/base_coverage.info --add-tracefile build/second_coverage.info --output-file build/coverage.info --rc lcov_branch_coverage=1
echo -e "::endgroup::"
lcov --rc lcov_branch_coverage=1 --list build/coverage.info
Expand Down
16 changes: 16 additions & 0 deletions link-verifier/verify-links.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,22 @@ def access_url(url):
is_broken = True
status = 'Error'

# Use curl as a fallback.
if is_broken == True:
curl_cmd = f'curl -sIL -o /dev/null -w "%{{http_code}}" {url}'
process = subprocess.run(
curl_cmd,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
shell=True,
encoding="utf-8",
universal_newlines=True
)
http_status_code = int(process.stdout)
if http_status_code == 200:
is_broken = False
status = http_status_code

return is_broken, status

def test_url(url):
Expand Down

0 comments on commit 7ad2e17

Please sign in to comment.