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,58 @@ 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
2934 shell : bash
3035 run : |
31- docker exec help-keyman-com-app sh -c "vendor/bin/phpunit --testdox"
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() }}
43+ shell : bash
44+ run : |
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() }}
5778 shell : bash
5879 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'
63- exit 1
64- else
65- echo 'No PHP errors found'
66- exit 0
67- fi
80+ source ./_common/tests.inc.sh
81+ set -e
82+ do_test_print_container_error_logs "$CONTAINER_DESC"
0 commit comments