diff --git a/.github/workflows/frontend_tests.yml b/.github/workflows/frontend_tests.yml index 31155b40..405b359c 100644 --- a/.github/workflows/frontend_tests.yml +++ b/.github/workflows/frontend_tests.yml @@ -56,7 +56,7 @@ jobs: path: pr/ cypress-run: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v3 @@ -88,7 +88,7 @@ jobs: working-directory: ./spiffworkflow-backend run: ./keycloak/bin/wait_for_keycloak 5 - name: Cypress run - uses: cypress-io/github-action@v4 + uses: cypress-io/github-action@v5 with: working-directory: ./spiffworkflow-frontend browser: chrome diff --git a/.github/workflows/release_builds.yml b/.github/workflows/release_builds.yml index ef1c3b99..d2154ddb 100644 --- a/.github/workflows/release_builds.yml +++ b/.github/workflows/release_builds.yml @@ -115,3 +115,32 @@ jobs: push: true tags: ${{ steps.meta.outputs.tags }} 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 diff --git a/bin/run_arena_with_docker_compose b/bin/run_arena_with_docker_compose new file mode 100755 index 00000000..8a479a3a --- /dev/null +++ b/bin/run_arena_with_docker_compose @@ -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 diff --git a/spiffworkflow-backend/bin/wait_for_server_to_be_up b/spiffworkflow-backend/bin/wait_for_server_to_be_up index 4c845613..04cff3aa 100755 --- a/spiffworkflow-backend/bin/wait_for_server_to_be_up +++ b/spiffworkflow-backend/bin/wait_for_server_to_be_up @@ -7,14 +7,12 @@ function error_handler() { trap 'error_handler ${LINENO} $?' ERR set -o errtrace -o errexit -o nounset -o pipefail -max_attempts="${1:-}" -if [[ -z "$max_attempts" ]]; then - max_attempts=100 -fi +max_attempts="${1:-100}" +port="${2:-7000}" echo "waiting for backend to come up..." 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 >&2 echo "ERROR: Server not up after $max_attempts attempts. There is probably a problem" exit 1 @@ -22,3 +20,4 @@ while [[ "$(curl -s -o /dev/null -w '%{http_code}' http://localhost:7000/v1.0/st attempts=$(( attempts + 1 )) sleep 1 done +echo "backend up" diff --git a/spiffworkflow-backend/keycloak/bin/wait_for_keycloak b/spiffworkflow-backend/keycloak/bin/wait_for_keycloak index d7018465..1002fb67 100755 --- a/spiffworkflow-backend/keycloak/bin/wait_for_keycloak +++ b/spiffworkflow-backend/keycloak/bin/wait_for_keycloak @@ -7,14 +7,12 @@ function error_handler() { trap 'error_handler ${LINENO} $?' ERR set -o errtrace -o errexit -o nounset -o pipefail -max_attempts="${1:-}" -if [[ -z "$max_attempts" ]]; then - max_attempts=100 -fi +max_attempts="${1:-100}" +port="${2:-7002}" -echo "waiting for backend to come up..." +echo "waiting for keycloak to come up..." 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 >&2 echo "ERROR: Server not up after $max_attempts attempts. There is probably a problem" exit 1 @@ -22,3 +20,4 @@ while [[ "$(curl -s -o /dev/null -w '%{http_code}' http://localhost:7002/realms/ attempts=$(( attempts + 1 )) sleep 1 done +echo "keycloak up" diff --git a/spiffworkflow-frontend/bin/wait_for_frontend_to_be_up b/spiffworkflow-frontend/bin/wait_for_frontend_to_be_up index 95181103..6f16d9af 100755 --- a/spiffworkflow-frontend/bin/wait_for_frontend_to_be_up +++ b/spiffworkflow-frontend/bin/wait_for_frontend_to_be_up @@ -7,14 +7,12 @@ function error_handler() { trap 'error_handler ${LINENO} $?' ERR set -o errtrace -o errexit -o nounset -o pipefail -max_attempts="${1:-}" -if [[ -z "$max_attempts" ]]; then - max_attempts=100 -fi +max_attempts="${1:-100}" +port="${2:-7001}" -echo "waiting for backend to come up..." +echo "waiting for frontend to come up..." 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 >&2 echo "ERROR: Server not up after $max_attempts attempts. There is probably a problem" exit 1 @@ -22,3 +20,4 @@ while [[ "$(curl -s -o /dev/null -w '%{http_code}' http://localhost:7001)" != "2 attempts=$(( attempts + 1 )) sleep 1 done +echo "frontend up"