Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bb1a1779c8
|
No files matched your search
@@ -86,6 +86,7 @@ jobs:
|
||||
bash tests/test_maven_test_results.sh
|
||||
bash tests/test_maven_ci_install.sh
|
||||
bash tests/test_browser_install.sh
|
||||
bash tests/test_frontend_build_reuse.sh
|
||||
bash tests/test_snapshot_refresh.sh
|
||||
bash tests/test_maven_settings_output.sh
|
||||
# Create jobs to test the commands of your orbs.
|
||||
|
||||
@@ -10,6 +10,11 @@ description: >
|
||||
- Collects JUnit XML test results
|
||||
- Stores test results and screenshots
|
||||
- Saves Maven cache for future builds
|
||||
parameters:
|
||||
build_before_test:
|
||||
type: boolean
|
||||
default: true
|
||||
description: "Build the React app first; combined jobs already build it with frontend_build"
|
||||
steps:
|
||||
# Ensure no stale Chrome/Driver is shadowing the PATH (your base image had Chrome 109)
|
||||
- run:
|
||||
@@ -52,6 +57,8 @@ steps:
|
||||
# GPG signing will happen later in mvn_jar_deploy when deploying to Maven Central.
|
||||
- run:
|
||||
name: Build app, start server, run tests
|
||||
environment:
|
||||
PARAM_BUILD_BEFORE_TEST: << parameters.build_before_test >>
|
||||
command: <<include(scripts/frontend_test_run.sh)>>
|
||||
|
||||
# Always collect and publish test results & screenshots
|
||||
|
||||
@@ -27,7 +27,8 @@ steps:
|
||||
- git_full_checkout
|
||||
- mvn_manage_version
|
||||
- frontend_build
|
||||
- frontend_test
|
||||
- frontend_test:
|
||||
build_before_test: false
|
||||
- frontend_package
|
||||
- mvn_jar_deploy
|
||||
- git_operations:
|
||||
|
||||
@@ -23,4 +23,5 @@ steps:
|
||||
node_version: << parameters.node_version >>
|
||||
- git_full_checkout
|
||||
- frontend_build
|
||||
- frontend_test
|
||||
- frontend_test:
|
||||
build_before_test: false
|
||||
@@ -15,7 +15,9 @@ set -e
|
||||
|
||||
echo "Building app, starting server, running tests"
|
||||
echo "HTTPS=true" >> ./.env
|
||||
npm run build
|
||||
if [[ "${PARAM_BUILD_BEFORE_TEST:-true}" == true ]]; then
|
||||
npm run build
|
||||
fi
|
||||
export REACT_APP_PROXY_LOCALHOST_PORT=8001
|
||||
export PORT=3001
|
||||
npm run start &
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
#!/bin/bash
|
||||
# Exercise the actual test runner with no server, browser, network or Maven work.
|
||||
set -euo pipefail
|
||||
root=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)
|
||||
scratch=$(mktemp -d)
|
||||
trap 'rm -rf "$scratch"' EXIT
|
||||
mkdir "$scratch/bin"
|
||||
export RUN_LOG="$scratch/calls"
|
||||
cat > "$scratch/bin/npm" <<'STUB'
|
||||
#!/bin/bash
|
||||
printf 'npm %s\n' "$*" >> "$RUN_LOG"
|
||||
if [[ "$*" == 'run build' && ${BUILD_FAIL:-0} == 1 ]]; then exit 12; fi
|
||||
STUB
|
||||
for tool in mvn dockerize; do
|
||||
# shellcheck disable=SC2016
|
||||
printf '#!/bin/bash\nprintf "%s %%s\\n" "$*" >> "$RUN_LOG"\n' "$tool" > "$scratch/bin/$tool"
|
||||
done
|
||||
chmod +x "$scratch/bin/"*
|
||||
export PATH="$scratch/bin:$PATH"
|
||||
cd "$scratch"
|
||||
PARAM_BUILD_BEFORE_TEST=false bash "$root/src/scripts/frontend_test_run.sh" >/dev/null
|
||||
if grep -qx 'npm run build' "$RUN_LOG"; then
|
||||
echo 'FAIL: combined job rebuilt the already-built React app' >&2; exit 1
|
||||
fi
|
||||
grep -q '^mvn .* -B test$' "$RUN_LOG"
|
||||
echo 'PASS: combined job retains tests without a duplicate build'
|
||||
|
||||
: > "$RUN_LOG"
|
||||
bash "$root/src/scripts/frontend_test_run.sh" >/dev/null
|
||||
grep -qx 'npm run build' "$RUN_LOG"
|
||||
grep -q '^mvn .* -B test$' "$RUN_LOG"
|
||||
: > "$RUN_LOG"
|
||||
if BUILD_FAIL=1 bash "$root/src/scripts/frontend_test_run.sh" >/dev/null 2>&1; then
|
||||
echo 'FAIL: required standalone build failure ignored' >&2; exit 1
|
||||
fi
|
||||
if grep -q '^mvn ' "$RUN_LOG"; then exit 1; fi
|
||||
echo 'PASS: standalone command still builds and fails before tests when its build fails'
|
||||
Reference in new issue
Block a user