-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'staging' into chore/merge-master-to-staging-a17s26
- Loading branch information
Showing
19 changed files
with
179 additions
and
239 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
|
||
Dockerfile text eol=lf | ||
*.sh eol=lf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
name: CI | ||
|
||
on: [pull_request] | ||
|
||
jobs: | ||
|
||
build-test: | ||
runs-on: ubuntu-20.04 | ||
env: | ||
KEYMANHOSTS_TIER: TIER_TEST | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
# Build the docker image | ||
- name: Build the Docker image | ||
shell: bash | ||
run: | | ||
echo "TIER_TEST" > tier.txt | ||
./build.sh build start | ||
env: | ||
fail-fast: true | ||
|
||
# | ||
# Finally, run the tests; note that this is almost all replicated in build.sh; here logging is reduced (TODO sync) | ||
# | ||
- name: Lint | ||
shell: bash | ||
run: | | ||
( 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]} ) | ||
# Link checker not needed. No html files to verify | ||
|
||
- name: Check PHP errors | ||
shell: bash | ||
run: | | ||
CONTAINER=`docker container ls -l -q` | ||
if docker container logs $CONTAINER 2>&1 | grep -q 'php7'; then | ||
echo 'PHP reported errors or warnings:' | ||
docker container logs $CONTAINER 2>&1 | grep 'php7' | ||
exit 1 | ||
else | ||
echo 'No PHP errors found' | ||
exit 0 | ||
fi | ||
- name: Check static file generated | ||
shell: bash | ||
run: | | ||
pwd | ||
if [ ! -f ./metadata/kmwversions.json ]; then | ||
echo "Failed to generate static file" | ||
exit 1 | ||
fi | ||
# | ||
# If any of the tests fail, let's grab a bit more detail on the environment | ||
# | ||
- name: Report errors | ||
if: ${{ failure() }} | ||
shell: bash | ||
run: | | ||
CONTAINER=`docker container ls -l -q` | ||
echo "--- PHP errors in Docker log ---" | ||
docker container logs $CONTAINER 2>&1 | grep 'php7' |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,11 @@ | ||
.idea/ | ||
|
||
# Ignore CI-generated static file of kmwversions | ||
metadata/ | ||
metadata/ | ||
|
||
/vendor | ||
|
||
# Shared files are bootstrapped: | ||
resources/bootstrap.inc.sh | ||
resources/.bootstrap-version | ||
_common/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,20 @@ | ||
<IfModule mod_headers.c> | ||
Header set Access-Control-Allow-Origin "*" | ||
</IfModule> | ||
<IfModule mod_mime.c> | ||
AddType font/ttf .ttf | ||
AddType font/woff .woff | ||
AddType font/woff2 .woff2 | ||
AddType font/otf .otf | ||
AddType application/vnd.ms-fontobject .eot | ||
AddType application/x-apple-aspen-config .mobileconfig | ||
AddType image/svg+xml .svg | ||
AddType application/javascript .js | ||
|
||
AddCharset UTF-8 .js | ||
</IfModule> | ||
<IfModule mod_rewrite.c> | ||
RewriteEngine on | ||
|
||
RewriteRule ^(cdnrefresh.php|Dockerfile|web.config|.git|App_Data)$ - [R=404,L] | ||
RewriteRule ^(build.sh|Dockerfile|.git|resources/)$ - [R=404,L] | ||
</IfModule> |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,11 @@ | ||
FROM php:5.6-apache | ||
RUN a2enmod rewrite | ||
# syntax=docker/dockerfile:1 | ||
# Site | ||
FROM php:7.4-apache | ||
|
||
# Install jq | ||
RUN apt-get update && apt-get install -y \ | ||
jq | ||
RUN cp /usr/local/etc/php/php.ini-production /usr/local/etc/php/php.ini | ||
RUN chown -R www-data:www-data /var/www/html/ | ||
|
||
RUN a2enmod headers mime rewrite |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
#!/usr/bin/env bash | ||
## START STANDARD SITE BUILD SCRIPT INCLUDE | ||
readonly THIS_SCRIPT="$(readlink -f "${BASH_SOURCE[0]}")" | ||
readonly BOOTSTRAP="$(dirname "$THIS_SCRIPT")/resources/bootstrap.inc.sh" | ||
readonly BOOTSTRAP_VERSION=chore/v0.4 | ||
[ -f "$BOOTSTRAP" ] && source "$BOOTSTRAP" || source <(curl -fs https://raw.githubusercontent.com/keymanapp/shared-sites/$BOOTSTRAP_VERSION/bootstrap.inc.sh) | ||
## END STANDARD SITE BUILD SCRIPT INCLUDE | ||
|
||
readonly S_KEYMAN_CONTAINER_NAME=s-keyman-website | ||
readonly S_KEYMAN_CONTAINER_DESC=s-keyman-com-app | ||
readonly S_KEYMAN_IMAGE_NAME=s-keyman-website | ||
readonly HOST_S_KEYMAN_COM=s.keyman.com.localhost | ||
|
||
source _common/keyman-local-ports.inc.sh | ||
source _common/docker.inc.sh | ||
|
||
################################ Main script ################################ | ||
|
||
builder_describe \ | ||
"Setup s.keyman.com site to run via Docker." \ | ||
configure \ | ||
clean \ | ||
build \ | ||
start \ | ||
stop \ | ||
test \ | ||
|
||
builder_parse "$@" | ||
|
||
function test_docker_container() { | ||
# Note: ci.yml replicates these | ||
|
||
# TODO: Run unit tests | ||
#docker exec $S_KEYMAN_CONTAINER_DESC sh -c "vendor/bin/phpunit --testdox" | ||
|
||
# Lint .php files for obvious errors | ||
docker exec $S_KEYMAN_CONTAINER_DESC sh -c "find . -name '*.php' | grep -v '/vendor/' | xargs -n 1 -d '\\n' php -l" | ||
|
||
# Link checker not needed. No html files to verify | ||
|
||
# Verify static file generated | ||
if [ ! -f ./metadata/kmwversions.json ]; then | ||
builder_die "Failed to generate static file" | ||
fi | ||
} | ||
|
||
# Custom cleanup of static file | ||
function clean_docker_container_s() { | ||
clean_docker_container $S_KEYMAN_IMAGE_NAME $S_KEYMAN_CONTAINER_NAME | ||
|
||
# Cleanup static file | ||
if [ -f ./metadata/kmwversions.json ]; then | ||
rm ./metadata/kmwversions.json | ||
fi | ||
} | ||
|
||
builder_run_action configure bootstrap_configure | ||
builder_run_action clean clean_docker_container_s | ||
builder_run_action stop stop_docker_container $S_KEYMAN_IMAGE_NAME $S_KEYMAN_CONTAINER_NAME | ||
builder_run_action build build_docker_container $S_KEYMAN_IMAGE_NAME $S_KEYMAN_CONTAINER_NAME | ||
builder_run_action start start_docker_container $S_KEYMAN_IMAGE_NAME $S_KEYMAN_CONTAINER_NAME $S_KEYMAN_CONTAINER_DESC $HOST_S_KEYMAN_COM $PORT_S_KEYMAN_COM | ||
|
||
builder_run_action test test_docker_container |
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.