From e2b00dc36ee6da4971fdad52387505ea5840d7d4 Mon Sep 17 00:00:00 2001 From: lilyh14 Date: Mon, 19 Jul 2021 12:02:25 -0400 Subject: [PATCH 1/2] Added new action folder for tests Uncommented the test parts of entrypoint.sh. --- mocks/Dockerfile | 3 +++ mocks/Dockerfile.build | 3 +++ mocks/action.yml | 19 ++++++++++++++ mocks/build.sh | 9 +++++++ mocks/entrypoint.sh | 58 ++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 92 insertions(+) create mode 100644 mocks/Dockerfile create mode 100644 mocks/Dockerfile.build create mode 100644 mocks/action.yml create mode 100644 mocks/build.sh create mode 100644 mocks/entrypoint.sh diff --git a/mocks/Dockerfile b/mocks/Dockerfile new file mode 100644 index 00000000..c759f0d6 --- /dev/null +++ b/mocks/Dockerfile @@ -0,0 +1,3 @@ +FROM nionata/casmm-build +COPY entrypoint.sh /entrypoint.sh +ENTRYPOINT ["/entrypoint.sh"] \ No newline at end of file diff --git a/mocks/Dockerfile.build b/mocks/Dockerfile.build new file mode 100644 index 00000000..60b5275b --- /dev/null +++ b/mocks/Dockerfile.build @@ -0,0 +1,3 @@ +FROM node:alpine +RUN apk add docker +RUN yarn global add heroku \ No newline at end of file diff --git a/mocks/action.yml b/mocks/action.yml new file mode 100644 index 00000000..16e140b3 --- /dev/null +++ b/mocks/action.yml @@ -0,0 +1,19 @@ +name: 'Build-Test-Deploy' +description: 'Build, test, and deploy a target image to heroku' +inputs: + image_tag: + description: 'Tag of the github package repo image' + required: true + app_name: + description: 'Target Heroku app name' + required: true + github_token: + description: 'Token for github package repo' + required: true +runs: + using: 'docker' + image: 'Dockerfile' + args: + - ${{ inputs.image_tag }} + - ${{ inputs.app_name }} + - ${{ inputs.github_token }} \ No newline at end of file diff --git a/mocks/build.sh b/mocks/build.sh new file mode 100644 index 00000000..7ffa93f9 --- /dev/null +++ b/mocks/build.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +docker build -f Dockerfile.build -t nionata/casmm-build . +docker push nionata/casmm-build + +# GitHub Actions doesn't allow you to use public gpr images, for now use dockerhub +# - https://github.community/t/docker-pull-from-public-github-package-registry-fail-with-no-basic-auth-credentials-error/16358/40 +# docker build -f Dockerfile.build -t docker.pkg.github.com/stem-c/casmm/build . +# docker push docker.pkg.github.com/stem-c/casmm/build \ No newline at end of file diff --git a/mocks/entrypoint.sh b/mocks/entrypoint.sh new file mode 100644 index 00000000..8bca7ec6 --- /dev/null +++ b/mocks/entrypoint.sh @@ -0,0 +1,58 @@ +#!/bin/sh + +set -e + +if [[ "$#" != 3 ]]; +then + echo "Expecting 3 arguments, got $#!" + exit 0 +fi; + +image_tag=$1 +app_name=$2 +github_token=$3 + +gpr_base="docker.pkg.github.com/stem-c/casmm" +heroku_base="registry.heroku.com/$app_name" + +# Log into gpr +echo "$github_token" | docker login docker.pkg.github.com -u "$GITHUB_ACTOR" --password-stdin + +# Name and build server image +gpr_server="$gpr_base/server" +heroku_server="$heroku_base/web" + +docker pull "$gpr_server" || true +docker build -t "$gpr_server:$image_tag" -t "$gpr_server:latest" -t "$heroku_server" --cache-from "$gpr_server" . + +# Name and build compile image +gpr_compile="$gpr_base/compile" +heroku_compile="$heroku_base/compile" + +docker pull "$gpr_compile" || true +docker build -t "$gpr_compile:$image_tag" -t "$gpr_compile:latest" -t "$heroku_compile" --cache-from "$gpr_compile" -f ./compile/Dockerfile ./compile + +# Test + docker-compose up -d + ready=false + do + ready=docker-compose logs | grep "strapi ready" + while ("$ready" = false) + cd test + yarn functional + yarn integration + yarn performance + +# Push gpr images +docker push "$gpr_server" +docker push "$gpr_compile" + +# Login to heroku container registry +heroku container:login + +# Push heroku image +docker push "$heroku_server" +docker push "$heroku_compile" + +# Deploy app +heroku container:release -a "$app_name" web compile \ No newline at end of file From c9a2ed57f9983b63f726a8bebc167586e8d71464 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 19 Jul 2021 16:03:08 +0000 Subject: [PATCH 2/2] Bump ws from 7.3.0 to 7.5.3 Bumps [ws](https://github.com/websockets/ws) from 7.3.0 to 7.5.3. - [Release notes](https://github.com/websockets/ws/releases) - [Commits](https://github.com/websockets/ws/compare/7.3.0...7.5.3) --- updated-dependencies: - dependency-name: ws dependency-type: indirect ... Signed-off-by: dependabot[bot] --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index cfceab2e..93c28a85 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4467,9 +4467,9 @@ write-file-atomic@^3.0.0: typedarray-to-buffer "^3.1.5" ws@^7.2.3: - version "7.3.0" - resolved "https://registry.yarnpkg.com/ws/-/ws-7.3.0.tgz#4b2f7f219b3d3737bc1a2fbf145d825b94d38ffd" - integrity sha512-iFtXzngZVXPGgpTlP1rBqsUK82p9tKqsWRPg5L56egiljujJT3vGAYnHANvFxBieXrTFavhzhxW52jnaWV+w2w== + version "7.5.3" + resolved "https://registry.yarnpkg.com/ws/-/ws-7.5.3.tgz#160835b63c7d97bfab418fc1b8a9fced2ac01a74" + integrity sha512-kQ/dHIzuLrS6Je9+uv81ueZomEwH0qVYstcAQ4/Z93K8zeko9gtAbttJWzoC5ukqXY1PpoouV3+VSOqEAFt5wg== xml-name-validator@^3.0.0: version "3.0.0"