61 lines
2.5 KiB
Bash
Executable File
61 lines
2.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# One ordered pipeline: JVM tests -> production JAR -> JVM smoke -> release artifact.
|
|
set -euo pipefail
|
|
root=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)
|
|
cd "$root"
|
|
: "${JAVA_HOME:?JAVA_HOME must name the pinned JDK installation}"
|
|
# Capture the source revision before the build, not after a potentially long compile.
|
|
export WERKJOURNAL_BUILD_COMMIT
|
|
WERKJOURNAL_BUILD_COMMIT=$(git rev-parse HEAD)
|
|
# The second engine repeats the very scenarios the Chromium suite has just run, so a branch
|
|
# build may leave it out: that halves the browser and application JVMs competing for this
|
|
# host and keeps the pull-request gate under ten minutes. The trunk build runs everything,
|
|
# because it is the gate the deployment itself passes through.
|
|
suites=(test bootJar firefoxAcceptance productionAcceptance)
|
|
if [ "${1-}" = "--without-firefox" ]; then
|
|
shift
|
|
suites=(test bootJar productionAcceptance)
|
|
fi
|
|
|
|
python3 -m unittest discover -s tests/operations -v
|
|
rm -rf -- build/release
|
|
mkdir -p build/reports/production build/release
|
|
# One invocation for the whole JVM pipeline. Both acceptance tasks already depend on test and
|
|
# bootJar, so the suite still runs exactly once and the second Gradle start-up is gone.
|
|
./gradlew --no-daemon --console=plain "${suites[@]}" -Pproduction=true "$@"
|
|
./tools/test-frontend
|
|
python3 - <<'PY'
|
|
import hashlib
|
|
import json
|
|
import os
|
|
from pathlib import Path
|
|
import shutil
|
|
import subprocess
|
|
|
|
source = Path('build/libs/werkjournal.jar')
|
|
smoke = json.loads(Path('build/reports/production/smoke.json').read_text())
|
|
if smoke.get('result') != 'PASS':
|
|
raise SystemExit('JVM smoke check did not pass')
|
|
commit = os.environ['WERKJOURNAL_BUILD_COMMIT']
|
|
target = Path('build/release/werkjournal.jar')
|
|
shutil.copy2(source, target)
|
|
files = [target]
|
|
def checksum(path):
|
|
with path.open('rb') as stream:
|
|
return hashlib.file_digest(stream, 'sha256').hexdigest()
|
|
manifest = {
|
|
'schemaVersion': 1,
|
|
'commit': commit,
|
|
'ancestors': subprocess.check_output(['git', 'rev-list', commit + '^@'], text=True).splitlines(),
|
|
'version': smoke['info']['version'],
|
|
'sha256': checksum(target),
|
|
'files': {path.name: checksum(path) for path in files},
|
|
'runtime': 'java-25',
|
|
'buildLibc': subprocess.check_output(['getconf', 'GNU_LIBC_VERSION'], text=True).strip(),
|
|
}
|
|
Path('build/release/manifest.json').write_text(json.dumps(manifest, indent=2) + '\n')
|
|
PY
|
|
|
|
# A successful CI run includes deployment; local verification leaves it disabled.
|
|
./tools/ci-deploy
|