-
-
Notifications
You must be signed in to change notification settings - Fork 7
chore: Move composer.json test scripts to build.sh test #578
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
6206dc8
de685fd
068ffbe
7ac0025
c3f1c8a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,10 @@ cdn/deploy/ | |
|
|
||
| tier.txt | ||
|
|
||
| # unit test artifacts | ||
| blc.log | ||
| .phpunit.result.cache | ||
|
|
||
| vendor* | ||
| /node_modules/ | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,11 +28,21 @@ builder_describe \ | |
| builder_parse "$@" | ||
|
|
||
| function test_docker_container() { | ||
| # TODO: lint tests | ||
| # Note: ci.yml replicates these | ||
|
|
||
| echo "TIER_TEST" > tier.txt | ||
| echo "---- Testing links ----" | ||
| set +e; | ||
| set +o pipefail; | ||
|
|
||
| builder_echo blue "---- PHP unit tests" | ||
| docker exec $KEYMAN_CONTAINER_DESC sh -c "vendor/bin/phpunit --testdox" | ||
|
|
||
| # Lint .php files for obvious errors | ||
| builder_echo blue "---- Lint PHP files" | ||
| docker exec $KEYMAN_CONTAINER_DESC sh -c "find . -name '*.php' | grep -v '/vendor/' | xargs -n 1 -d '\\n' php -l" | ||
|
|
||
| # NOTE: link checker runs on host rather than in docker image | ||
| builder_echo blue "---- Testing links" | ||
| npx broken-link-checker http://localhost:8053/_test --recursive --ordered ---host-requests 50 -e --filter-level 3 --exclude '*/donate' | tee blc.log | ||
| local BLC_RESULT=${PIPESTATUS[0]} | ||
| echo ---------------------------------------------------------------------- | ||
|
|
@@ -42,15 +52,15 @@ function test_docker_container() { | |
| grep -E "BROKEN|Getting links from" | \ | ||
| grep -B 1 "BROKEN"; | ||
|
|
||
| echo "Done checking links" | ||
| builder_echo blue "Done checking links" | ||
| rm tier.txt | ||
| return "${BLC_RESULT}" | ||
| } | ||
|
|
||
| builder_run_action configure bootstrap_configure | ||
| builder_run_action clean clean_docker_container $KEYMAN_IMAGE_NAME $KEYMAN_CONTAINER_NAME | ||
| builder_run_action stop stop_docker_container $KEYMAN_IMAGE_NAME $KEYMAN_CONTAINER_NAME | ||
| builder_run_action build build_docker_container $KEYMAN_IMAGE_NAME $KEYMAN_CONTAINER_NAME | ||
| builder_run_action build build_docker_container $KEYMAN_IMAGE_NAME $KEYMAN_CONTAINER_NAME $BUILDER_CONFIGURATION | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This passes in the BUILDER_CONFIGURATION parameter for keymanapp/shared-sites#84 |
||
| builder_run_action start start_docker_container $KEYMAN_IMAGE_NAME $KEYMAN_CONTAINER_NAME $KEYMAN_CONTAINER_DESC $HOST_KEYMAN_COM $PORT_KEYMAN_COM $BUILDER_CONFIGURATION | ||
|
|
||
| builder_run_action test test_docker_container | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,24 +1,12 @@ | ||
| { | ||
| "name": "keymanapi/keyman.com", | ||
| "require": { | ||
| "sentry/sdk": "^2.1", | ||
| "sentry/sdk": "^2.1.0", | ||
| "php-http/curl-client": "^2.1", | ||
| "erusev/parsedown-extra": "^0.8.1", | ||
| "erusev/parsedown": "^1.7" | ||
| "erusev/parsedown": "^1.7", | ||
| "erusev/parsedown-extra": "^0.8.1" | ||
| }, | ||
| "require-dev": { | ||
| "phpunit/phpunit": "^9.2" | ||
| }, | ||
| "scripts": { | ||
| "test": "vendor\\bin\\phpunit --testdox", | ||
| "check-links": [ | ||
| "Composer\\Config::disableProcessTimeout", | ||
| "npx broken-link-checker http://keyman.com.localhost --ordered --recursive --host-requests 10 -e --filter-level 3 --exclude '*/donate'" | ||
| ], | ||
| "check-docker-links": [ | ||
| "Composer\\Config::disableProcessTimeout", | ||
| "npx broken-link-checker http://localhost:8053 --ordered --recursive --host-requests 10 -e --filter-level 3 --exclude '*/donate'" | ||
| ], | ||
| "lint": "find . -name '*.php' | grep -v '/vendor/' | xargs -n 1 -d '\\n' php -l" | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <phpunit bootstrap="vendor/autoload.php"> | ||
| <testsuites> | ||
| <testsuite name="Test Suite"> | ||
| <directory>tests</directory> | ||
| </testsuite> | ||
| </testsuites> | ||
| </phpunit> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| <?php declare(strict_types=1); | ||
|
|
||
| namespace Keyman\Site\com\keyman\tests; | ||
|
|
||
| use PHPUnit\Framework\TestCase; | ||
|
|
||
| final class InfrastructureTest extends TestCase | ||
| { | ||
| public function testTestsAreWorking(): void | ||
| { | ||
| $this->assertTrue(true); | ||
| } | ||
| } | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. copied from help.keyman.com
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should .htaccess block the /tests folder? Otherwise, I get this error Fatal error: Uncaught Error: Class 'PHPUnit\Framework\TestCase' not found in /var/www/html/tests/InfrastructureTest.php:7 Stack trace: #0 {main} thrown in /var/www/html/tests/InfrastructureTest.php on line 7
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added redirect in c3f1c8a
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, unsure, probably fine? |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--debug needed so Docker will build with dev dependencies