51 lines
2.0 KiB
Bash
Executable File
51 lines
2.0 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)
|
|
python3 -m unittest discover -s tests/operations -v
|
|
rm -rf -- build/release
|
|
./gradlew --no-daemon --console=plain test bootJar -Pproduction=true "$@"
|
|
./tools/test-frontend
|
|
mkdir -p build/reports/production build/release
|
|
# The first Gradle invocation already completed the full JVM suite; do not repeat it here.
|
|
./gradlew --no-daemon --console=plain firefoxAcceptance productionAcceptance -Pproduction=true -x test
|
|
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
|