Merge pull request #140 from sartography/feature/add_quickstart_ci_test

Feature/add quickstart ci test
This commit is contained in:
jasquat 2023-02-16 15:56:33 -05:00 committed by GitHub
commit f9b0bb9234
6 changed files with 59 additions and 19 deletions

View File

@ -56,7 +56,7 @@ jobs:
path: pr/ path: pr/
cypress-run: cypress-run:
runs-on: ubuntu-20.04 runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v3
@ -88,7 +88,7 @@ jobs:
working-directory: ./spiffworkflow-backend working-directory: ./spiffworkflow-backend
run: ./keycloak/bin/wait_for_keycloak 5 run: ./keycloak/bin/wait_for_keycloak 5
- name: Cypress run - name: Cypress run
uses: cypress-io/github-action@v4 uses: cypress-io/github-action@v5
with: with:
working-directory: ./spiffworkflow-frontend working-directory: ./spiffworkflow-frontend
browser: chrome browser: chrome

View File

@ -115,3 +115,32 @@ jobs:
push: true push: true
tags: ${{ steps.meta.outputs.tags }} tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }} labels: ${{ steps.meta.outputs.labels }}
quickstart-guide-test:
runs-on: ubuntu-latest
needs: [create_frontend_docker_container, create_backend_docker_container, create_demo-proxy]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Apps
run: ./bin/run_arena_with_docker_compose
- name: wait_for_backend
working-directory: ./spiffworkflow-backend
run: ./bin/wait_for_server_to_be_up 5 8000
- name: wait_for_frontend
working-directory: ./spiffworkflow-frontend
run: ./bin/wait_for_frontend_to_be_up 5 8001
- name: Cypress run
uses: cypress-io/github-action@v5
with:
working-directory: ./spiffworkflow-frontend
browser: chrome
# just run one test to make sure we didn't completely break it
spec: cypress/e2e/process_groups.cy.js
env:
# pass GitHub token to allow accurately detecting a build vs a re-run build
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CYPRESS_SPIFFWORKFLOW_FRONTEND_AUTH_WITH_KEYCLOAK: "false"
CYPRESS_SPIFFWORKFLOW_FRONTEND_USERNAME: "admin"
CYPRESS_SPIFFWORKFLOW_FRONTEND_PASSWORD: "admin"
SPIFFWORKFLOW_FRONTEND_PORT: 8001

View File

@ -0,0 +1,14 @@
#!/usr/bin/env bash
function error_handler() {
>&2 echo "Exited with BAD EXIT CODE '${2}' in ${0} script at line: ${1}."
exit "$2"
}
trap 'error_handler ${LINENO} $?' ERR
set -o errtrace -o errexit -o nounset -o pipefail
mkdir -p spiffworkflow
cd spiffworkflow
wget https://raw.githubusercontent.com/sartography/spiff-arena/main/docker-compose.yml
docker compose pull
docker compose up -d

View File

@ -7,14 +7,12 @@ function error_handler() {
trap 'error_handler ${LINENO} $?' ERR trap 'error_handler ${LINENO} $?' ERR
set -o errtrace -o errexit -o nounset -o pipefail set -o errtrace -o errexit -o nounset -o pipefail
max_attempts="${1:-}" max_attempts="${1:-100}"
if [[ -z "$max_attempts" ]]; then port="${2:-7000}"
max_attempts=100
fi
echo "waiting for backend to come up..." echo "waiting for backend to come up..."
attempts=0 attempts=0
while [[ "$(curl -s -o /dev/null -w '%{http_code}' http://localhost:7000/v1.0/status)" != "200" ]]; do while [[ "$(curl -s -o /dev/null -w '%{http_code}' "http://localhost:${port}/v1.0/status")" != "200" ]]; do
if [[ "$attempts" -gt "$max_attempts" ]]; then if [[ "$attempts" -gt "$max_attempts" ]]; then
>&2 echo "ERROR: Server not up after $max_attempts attempts. There is probably a problem" >&2 echo "ERROR: Server not up after $max_attempts attempts. There is probably a problem"
exit 1 exit 1
@ -22,3 +20,4 @@ while [[ "$(curl -s -o /dev/null -w '%{http_code}' http://localhost:7000/v1.0/st
attempts=$(( attempts + 1 )) attempts=$(( attempts + 1 ))
sleep 1 sleep 1
done done
echo "backend up"

View File

@ -7,14 +7,12 @@ function error_handler() {
trap 'error_handler ${LINENO} $?' ERR trap 'error_handler ${LINENO} $?' ERR
set -o errtrace -o errexit -o nounset -o pipefail set -o errtrace -o errexit -o nounset -o pipefail
max_attempts="${1:-}" max_attempts="${1:-100}"
if [[ -z "$max_attempts" ]]; then port="${2:-7002}"
max_attempts=100
fi
echo "waiting for backend to come up..." echo "waiting for keycloak to come up..."
attempts=0 attempts=0
while [[ "$(curl -s -o /dev/null -w '%{http_code}' http://localhost:7002/realms/master/.well-known/openid-configuration)" != "200" ]]; do while [[ "$(curl -s -o /dev/null -w '%{http_code}' "http://localhost:${port}/realms/master/.well-known/openid-configuration")" != "200" ]]; do
if [[ "$attempts" -gt "$max_attempts" ]]; then if [[ "$attempts" -gt "$max_attempts" ]]; then
>&2 echo "ERROR: Server not up after $max_attempts attempts. There is probably a problem" >&2 echo "ERROR: Server not up after $max_attempts attempts. There is probably a problem"
exit 1 exit 1
@ -22,3 +20,4 @@ while [[ "$(curl -s -o /dev/null -w '%{http_code}' http://localhost:7002/realms/
attempts=$(( attempts + 1 )) attempts=$(( attempts + 1 ))
sleep 1 sleep 1
done done
echo "keycloak up"

View File

@ -7,14 +7,12 @@ function error_handler() {
trap 'error_handler ${LINENO} $?' ERR trap 'error_handler ${LINENO} $?' ERR
set -o errtrace -o errexit -o nounset -o pipefail set -o errtrace -o errexit -o nounset -o pipefail
max_attempts="${1:-}" max_attempts="${1:-100}"
if [[ -z "$max_attempts" ]]; then port="${2:-7001}"
max_attempts=100
fi
echo "waiting for backend to come up..." echo "waiting for frontend to come up..."
attempts=0 attempts=0
while [[ "$(curl -s -o /dev/null -w '%{http_code}' http://localhost:7001)" != "200" ]]; do while [[ "$(curl -s -o /dev/null -w '%{http_code}' "http://localhost:${port}")" != "200" ]]; do
if [[ "$attempts" -gt "$max_attempts" ]]; then if [[ "$attempts" -gt "$max_attempts" ]]; then
>&2 echo "ERROR: Server not up after $max_attempts attempts. There is probably a problem" >&2 echo "ERROR: Server not up after $max_attempts attempts. There is probably a problem"
exit 1 exit 1
@ -22,3 +20,4 @@ while [[ "$(curl -s -o /dev/null -w '%{http_code}' http://localhost:7001)" != "2
attempts=$(( attempts + 1 )) attempts=$(( attempts + 1 ))
sleep 1 sleep 1
done done
echo "frontend up"