Skip to content

Commit 2478835

Browse files
authored
Merge pull request #2570 from keymanapp/chore/linkinator
chore: replace broken-link-checker with linkinator
2 parents 789750b + bf76077 commit 2478835

9 files changed

Lines changed: 73 additions & 71 deletions

File tree

.github/workflows/ci.yml

Lines changed: 51 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ jobs:
88
runs-on: ubuntu-latest
99
env:
1010
KEYMANHOSTS_TIER: TIER_TEST
11+
CONTAINER_DESC: help-keyman-com-app
12+
CONTAINER_PORT: 8055
1113

1214
steps:
1315
- name: Checkout
@@ -23,45 +25,71 @@ jobs:
2325
fail-fast: true
2426

2527
#
26-
# Finally, run the tests; note that this is almost all replicated in build.sh; here logging is reduced (TODO sync)
28+
# Run tests -- these step definitions are NEARLY identical across:
29+
# help.keyman.com, keyman.com, keymanweb.com, api.keyman.com
2730
#
28-
- name: PHP unit tests
31+
# No differences on this site
32+
#
33+
- name: Test setup
34+
shell: bash
35+
run: |
36+
source ./_common/tests.inc.sh
37+
set -e
38+
do_test_record_start_time
39+
echo "TEST_START_TIME=${TEST_START_TIME}" >> "$GITHUB_ENV"
40+
41+
- name: PHP test
42+
if: ${{ !cancelled() }}
2943
shell: bash
3044
run: |
31-
docker exec help-keyman-com-app sh -c "vendor/bin/phpunit --testdox"
45+
source ./_common/tests.inc.sh
46+
set -e
47+
do_test_unit_tests "$CONTAINER_DESC"
3248
3349
- name: Lint
50+
if: ${{ !cancelled() }}
3451
shell: bash
3552
run: |
36-
( set +e; set +o pipefail; find . -name '*.php' | grep -v '/vendor/' | xargs -n 1 -d '\n' php -l | grep -v "No syntax errors detected"; exit ${PIPESTATUS[2]} )
53+
source ./_common/tests.inc.sh
54+
set -e
55+
do_test_lint "$CONTAINER_DESC"
3756
3857
- name: Check broken links
58+
if: ${{ !cancelled() }}
3959
shell: bash
40-
continue-on-error: false
4160
run: |
42-
set +e
43-
set +o pipefail
44-
npx broken-link-checker http://localhost:8055 --ordered --recursive --host-requests 50 -e --filter-level 3 | tee blc.log
45-
echo "BLC_RESULT=${PIPESTATUS[0]}" >> "$GITHUB_ENV"
61+
source ./_common/tests.inc.sh
62+
set -e
63+
do_test_links "http://localhost:${CONTAINER_PORT}" /
64+
65+
# We split the reporting of broken links into a separate step for ease of
66+
# viewing because the broken links are otherwise hidden in a sea of good
67+
# links in a very long report
4668

4769
- name: Report on broken links
70+
if: ${{ !cancelled() }}
4871
run: |
49-
set +e
50-
set +o pipefail
51-
cat blc.log | \
52-
grep -E "BROKEN|Getting links from" | \
53-
grep -B 1 "BROKEN";
54-
exit "${BLC_RESULT}"
72+
source ./_common/tests.inc.sh
73+
set -e
74+
do_test_print_link_report
5575
5676
- name: Check PHP errors
77+
if: ${{ !cancelled() }}
78+
shell: bash
79+
run: |
80+
source ./_common/tests.inc.sh
81+
set -e
82+
do_test_print_container_error_logs "$CONTAINER_DESC"
83+
84+
- name: Verify .bootstrap-required-version
85+
if: ${{ !cancelled() }}
5786
shell: bash
5887
run: |
59-
CONTAINER=`docker container ls -l -q`
60-
if docker container logs $CONTAINER 2>&1 | grep -q 'php7'; then
61-
echo 'PHP reported errors or warnings:'
62-
docker container logs $CONTAINER 2>&1 | grep 'php7'
88+
# We want to avoid merging a bootstrap version that is not based on a published tag
89+
# in the shared-sites repo. We will do this with a heuristic based on the normal
90+
# shape of the tags, which is `v#.#.#`. Any other shape we will assume is a test
91+
# branch.
92+
cat resources/.bootstrap-required-version | grep -qP '^v\d+\.\d+\.\d+$' || (
93+
echo "::error file=resources/.bootstrap-required-version,line=1,col=1::This branch cannot be merged, because resources/.bootstrap-required-version references \`$(cat resources/.bootstrap-required-version)\`, which does not appear to be a published tag -- is it a test branch?"
6394
exit 1
64-
else
65-
echo 'No PHP errors found'
66-
exit 0
67-
fi
95+
)

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ cdn/deploy
66
tier.txt
77

88
# unit test artifacts
9-
blc.log
9+
linkinator-results.json
1010
.phpunit.result.cache
1111

1212
vendor*
@@ -24,4 +24,4 @@ _control/debug
2424

2525
# Cache of keyboard metadata, deleted on site rebuild
2626
keyboard/index.cache
27-
.phpunit.result.cache
27+
.phpunit.result.cache

build.sh

Lines changed: 6 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
## START STANDARD SITE BUILD SCRIPT INCLUDE
33
readonly THIS_SCRIPT="$(readlink -f "${BASH_SOURCE[0]}")"
44
readonly BOOTSTRAP="$(dirname "$THIS_SCRIPT")/resources/bootstrap.inc.sh"
5-
readonly BOOTSTRAP_VERSION=v1.0.14
5+
BOOTSTRAP_VERSION="$(cat "$(dirname "THIS_SCRIPT")/resources/.bootstrap-required-version")" || exit 1
6+
readonly BOOTSTRAP_VERSION
67
if ! [ -f "$BOOTSTRAP" ] || ! source "$BOOTSTRAP"; then
78
curl -H "Cache-Control: no-cache" --fail --silent --show-error -w "curl: Finished attempt to download %{url}" "https://raw.githubusercontent.com/keymanapp/shared-sites/$BOOTSTRAP_VERSION/bootstrap.inc.sh" -o "$BOOTSTRAP.tmp" || exit 1
89
source "$BOOTSTRAP.tmp"
@@ -29,44 +30,16 @@ builder_describe \
2930
start \
3031
stop \
3132
test \
33+
"--no-unit-test" \
34+
"--no-lint" \
35+
"--no-link-check"
3236

3337
builder_parse "$@"
3438

35-
function test_docker_container() {
36-
# Note: ci.yml replicates these
37-
38-
echo "TIER_TEST" > tier.txt
39-
set +e;
40-
set +o pipefail;
41-
42-
builder_echo blue "---- PHP unit tests"
43-
docker exec $HELP_CONTAINER_DESC sh -c "vendor/bin/phpunit --testdox"
44-
45-
# Lint .php files for obvious errors
46-
builder_echo blue "---- Lint PHP files"
47-
docker exec $HELP_CONTAINER_DESC sh -c "find . -name '*.php' | grep -v '/vendor/' | xargs -n 1 -d '\\n' php -l"
48-
49-
# Check all internal links
50-
# NOTE: link checker runs on host rather than in docker image
51-
builder_echo blue "---- Testing links"
52-
npx broken-link-checker http://localhost:8055 --recursive --ordered ---host-requests 50 -e --filter-level 3 | tee blc.log
53-
local BLC_RESULT=${PIPESTATUS[0]}
54-
echo ----------------------------------------------------------------------
55-
echo Link check summary
56-
echo ----------------------------------------------------------------------
57-
cat blc.log | \
58-
grep -E "BROKEN|Getting links from" | \
59-
grep -B 1 "BROKEN";
60-
61-
builder_echo blue "Done checking links"
62-
rm tier.txt
63-
return "${BLC_RESULT}"
64-
}
65-
6639
builder_run_action configure bootstrap_configure
6740
builder_run_action clean clean_docker_container $HELP_IMAGE_NAME $HELP_CONTAINER_NAME
6841
builder_run_action stop stop_docker_container $HELP_IMAGE_NAME $HELP_CONTAINER_NAME
6942
builder_run_action build build_docker_container $HELP_IMAGE_NAME $HELP_CONTAINER_NAME $BUILDER_CONFIGURATION
7043
builder_run_action start start_docker_container $HELP_IMAGE_NAME $HELP_CONTAINER_NAME $HELP_CONTAINER_DESC $HOST_HELP_KEYMAN_COM $PORT_HELP_KEYMAN_COM $BUILDER_CONFIGURATION
7144

72-
builder_run_action test test_docker_container
45+
builder_run_action test test_docker_container $HELP_CONTAINER_DESC $PORT_HELP_KEYMAN_COM /

keyboard/buhid/1.0/buhid.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
<?php
1+
<?php
22
$pagename = 'Buhid Keyboard Help';
33
$pagetitle = $pagename;
4-
// Header we will tidy up later
4+
// Header we will tidy up later
55
require_once('header.php');
66
?>
77

88

99
<p class="p1"> Basic Buhid <span style="font-family: Noto Sans Buhid">(ᝊᝓᝑᝒ)</span> Keyboard for Philippines languages, included Tagalog, Buhid, etc. This keyboard covered all Buhid characters on the <a href="http://www.unicode.org/charts/PDF/U1740.pdf">Unicode Standard 13.0</a>. Other additional characters can be included in the future if necesarry. There is no standard keyboard layout yet for the Buhid Keyboard at the moment, so this keyboard can be one of the alternative options.</p>
1010

11-
<p class="p1">This keyboard layout designed based on suggestions from the user group in social media. I would like to thank to the admins of <a href="https://www.facebook.com/groups/1136372230134825/">Writing Script in the Philippines</a> on Facebook : John Andy Untalan Uy, Joliana Juan Sawal, Luke Biglang-Awa, Melgazar Galvan, Nathaniel Pønce de Leøn, & Raymond Bondoc Figueroa for their inputs. If there any other suggestions about the layout design, please let me know.</p>
11+
<p class="p1">This keyboard layout designed based on suggestions from the user group in social media. I would like to thank to the admins of <a href="https://www.facebook.com/groups/1136372230134825/">Writing Script in the Philippines</a> on Facebook : John Andy Untalan Uy, Joliana Juan Sawal, Luke Biglang-Awa, Melgazar Galvan, Nathaniel Pønce de Leøn, & Raymond Bondoc Figueroa for their inputs. If there any other suggestions about the layout design, please let me know.</p>
1212

13-
<p class="p1">The font used along with this keyboard is Noto Sans Buhid. In case you have not install it on your machine, you can simply download the font from the <a href="https://www.google.com/get/noto/">Google Noto website</a> and install it.</p>
13+
<p class="p1">The font used along with this keyboard is Noto Sans Buhid. In case you have not install it on your machine, you can simply download the font from the <a href="https://www.google.com/get/noto/">Google Noto website</a> and install it.</p>
1414

1515
<h1>Keyboard Layout</h1>
1616

@@ -23,5 +23,5 @@
2323
<div id='osk-phone' data-states='default numeric'>
2424
</div>
2525

26-
<p class="footer">This keyboard is part of the <a href="https://kairaga.com>Kairaga.com">Kairaga.com</a> keyboard development program. Please send your thoughts to <a href="mailto:info@kairaga.com">info@kairaga.com</a></p>
26+
<p class="footer">This keyboard is part of the <a href="https://kairaga.com">Kairaga.com</a> keyboard development program. Please send your thoughts to <a href="mailto:info@kairaga.com">info@kairaga.com</a></p>
2727

keyboard/tengwar_quenya/1.1/tengwar_quenya.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
<img src="keyboard_layout.png" alt="Keyboard Layout" srcset=""><br>
1515
<img src="keyboard_layout_shifted.png" alt="Shift Keyboard Layout" srcset=""><br>
16-
<img src="keyboard_layout_alt.png" alt="" srcset="Alt Keyboard Layout"><br>
16+
<img src="keyboard_layout_alt.png" alt="Alt Keyboard Layout" srcset=""><br>
1717
<img src="keyboard_layout_alt-shifted.png" alt="Alt-Shift Keyboard Layout" srcset=""><br>
1818
<p>
1919
This keyboard follows Dvorak for Programmers keyboard layout.
@@ -25,5 +25,5 @@
2525
<img src="mobile_keyboard_layout.jpg" alt="Mobile Keyboard Layout" srcset=""><br>
2626
<img src="mobile_layout_numbers.jpg" alt="Mobile Keyboard Layout (Numbers)" srcset="">
2727
<p>
28-
This keyboard uses the same layout as the desktop layout. While characters in desktop shift, alt and alt-shift are available at long press.
28+
This keyboard uses the same layout as the desktop layout. While characters in desktop shift, alt and alt-shift are available at long press.
2929
</p>

keyboard/tengwar_quenya/1.2/tengwar_quenya.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
<img src="keyboard_layout.png" alt="Keyboard Layout" srcset=""><br>
1515
<img src="keyboard_layout_shifted.png" alt="Shift Keyboard Layout" srcset=""><br>
16-
<img src="keyboard_layout_alt.png" alt="" srcset="Alt Keyboard Layout"><br>
16+
<img src="keyboard_layout_alt.png" alt="Alt Keyboard Layout" srcset=""><br>
1717
<img src="keyboard_layout_alt-shifted.png" alt="Alt-Shift Keyboard Layout" srcset=""><br>
1818
<p>
1919
This keyboard follows Dvorak for Programmers keyboard layout.
@@ -25,5 +25,5 @@
2525
<img src="mobile_keyboard_layout.jpg" alt="Mobile Keyboard Layout" srcset=""><br>
2626
<img src="mobile_layout_numbers.jpg" alt="Mobile Keyboard Layout (Numbers)" srcset="">
2727
<p>
28-
This keyboard uses the same layout as the desktop layout. While characters in desktop shift, alt and alt-shift are available at long press.
28+
This keyboard uses the same layout as the desktop layout. While characters in desktop shift, alt and alt-shift are available at long press.
2929
</p>

keyboard/tengwar_quenya/1.3/tengwar_quenya.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
<img src="keyboard_layout.png" alt="Keyboard Layout" srcset=""><br>
1515
<img src="keyboard_layout_shifted.png" alt="Shift Keyboard Layout" srcset=""><br>
16-
<img src="keyboard_layout_alt.png" alt="" srcset="Alt Keyboard Layout"><br>
16+
<img src="keyboard_layout_alt.png" alt="Alt Keyboard Layout" srcset=""><br>
1717
<img src="keyboard_layout_alt-shifted.png" alt="Alt-Shift Keyboard Layout" srcset=""><br>
1818
<p>
1919
This keyboard follows Dvorak for Programmers keyboard layout.
@@ -25,5 +25,5 @@
2525
<img src="mobile_keyboard_layout.jpg" alt="Mobile Keyboard Layout" srcset=""><br>
2626
<img src="mobile_layout_numbers.jpg" alt="Mobile Keyboard Layout (Numbers)" srcset="">
2727
<p>
28-
This keyboard uses the same layout as the desktop layout. While characters in desktop shift, alt and alt-shift are available at long press.
28+
This keyboard uses the same layout as the desktop layout. While characters in desktop shift, alt and alt-shift are available at long press.
2929
</p>

keyboard/tengwar_quenya/1.4/tengwar_quenya.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
<img src="keyboard_layout.png" alt="Keyboard Layout" srcset=""><br>
1515
<img src="keyboard_layout_shifted.png" alt="Shift Keyboard Layout" srcset=""><br>
16-
<img src="keyboard_layout_alt.png" alt="" srcset="Alt Keyboard Layout"><br>
16+
<img src="keyboard_layout_alt.png" alt="Alt Keyboard Layout" srcset=""><br>
1717
<img src="keyboard_layout_alt-shifted.png" alt="Alt-Shift Keyboard Layout" srcset=""><br>
1818
<p>
1919
This keyboard follows Dvorak for Programmers keyboard layout.
@@ -25,5 +25,5 @@
2525
<img src="mobile_keyboard_layout.jpg" alt="Mobile Keyboard Layout" srcset=""><br>
2626
<img src="mobile_layout_numbers.jpg" alt="Mobile Keyboard Layout (Numbers)" srcset="">
2727
<p>
28-
This keyboard uses the same layout as the desktop layout. While characters in desktop shift, alt and alt-shift are available at long press.
28+
This keyboard uses the same layout as the desktop layout. While characters in desktop shift, alt and alt-shift are available at long press.
2929
</p>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v1.0.14

0 commit comments

Comments
 (0)