Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
81c5086ee4
|
||
|
|
30a49c9c97 | ||
|
|
93ee1b4752 |
No files matched your search
@@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Fixed
|
||||
- Maven compile, verify and frontend test steps pass `--update-snapshots`, so SNAPSHOT dependencies restored from the pom-checksum-keyed `~/.m2` cache are re-checked against the remote on every build instead of going stale
|
||||
|
||||
### Added
|
||||
- Auto-publish `dev:snapshot` on develop branch pushes
|
||||
- Auto-publish production releases on main branch pushes with semantic version bumping
|
||||
|
||||
@@ -14,4 +14,7 @@
|
||||
set -e
|
||||
|
||||
echo "Running Maven Compile with optimized settings"
|
||||
mvn -s /tmp/circleci/mvn-settings.xml -T4 --no-transfer-progress compile
|
||||
## --update-snapshots: the ~/.m2 cache is keyed only on the pom checksum, so
|
||||
## without it a SNAPSHOT dependency restored from cache is never re-checked
|
||||
## (Maven's daily update policy) and builds run against stale snapshots.
|
||||
mvn -s /tmp/circleci/mvn-settings.xml --update-snapshots -T4 --no-transfer-progress compile
|
||||
@@ -21,4 +21,7 @@ export PORT=3001
|
||||
npm run start &
|
||||
dockerize -wait tcp://localhost:3001 -timeout 3m
|
||||
export QQQ_SELENIUM_HEADLESS=true
|
||||
mvn -s /tmp/circleci/mvn-settings.xml --no-transfer-progress -B test
|
||||
## --update-snapshots: the ~/.m2 cache is keyed only on the pom checksum, so
|
||||
## without it a SNAPSHOT dependency restored from cache is never re-checked
|
||||
## (Maven's daily update policy) and builds run against stale snapshots.
|
||||
mvn -s /tmp/circleci/mvn-settings.xml --update-snapshots --no-transfer-progress -B test
|
||||
@@ -23,4 +23,7 @@ set -e
|
||||
###################################################
|
||||
## Compile Maven project with optimized settings ##
|
||||
###################################################
|
||||
mvn -s /tmp/circleci/mvn-settings.xml -T4 --no-transfer-progress compile
|
||||
## --update-snapshots: the ~/.m2 cache is keyed only on the pom checksum, so
|
||||
## without it a SNAPSHOT dependency restored from cache is never re-checked
|
||||
## (Maven's daily update policy) and builds run against stale snapshots.
|
||||
mvn -s /tmp/circleci/mvn-settings.xml --update-snapshots -T4 --no-transfer-progress compile
|
||||
@@ -23,4 +23,7 @@ set -e
|
||||
########################################################
|
||||
## Run Maven verify lifecycle with optimized settings ##
|
||||
########################################################
|
||||
mvn -s /tmp/circleci/mvn-settings.xml -T4 --no-transfer-progress verify
|
||||
## --update-snapshots: the ~/.m2 cache is keyed only on the pom checksum, so
|
||||
## without it a SNAPSHOT dependency restored from cache is never re-checked
|
||||
## (Maven's daily update policy) and builds run against stale snapshots.
|
||||
mvn -s /tmp/circleci/mvn-settings.xml --update-snapshots -T4 --no-transfer-progress verify
|
||||
@@ -19,7 +19,7 @@
|
||||
set +x
|
||||
set -euo pipefail
|
||||
|
||||
if [[ "${QQQ_NPM_TRUSTED_PUBLISHING:-false}" == "true" ]]; then
|
||||
if [[ "${QQQ_NPM_TRUSTED_PUBLISHING:-false}" == "true" || "${QQQ_NPM_TRUSTED_PUBLISHING:-false}" == "1" ]]; then
|
||||
NPM_CLI_VERSION=$(npm --version)
|
||||
node - "$NPM_CLI_VERSION" <<'NODE'
|
||||
const atLeast = (actual, minimum) => {
|
||||
|
||||
+3
-1
@@ -17,6 +17,7 @@ set -e
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
TEST_SCRIPT="$SCRIPT_DIR/test_calculate_version.sh"
|
||||
SETTINGS_TEST_SCRIPT="$SCRIPT_DIR/test_maven_settings_output.sh"
|
||||
SNAPSHOT_TEST_SCRIPT="$SCRIPT_DIR/test_snapshot_refresh.sh"
|
||||
VERBOSE=false
|
||||
CI_MODE=false
|
||||
|
||||
@@ -73,7 +74,7 @@ main() {
|
||||
## CI mode: minimal output, focus on results ##
|
||||
###############################################
|
||||
echo "Running tests in CI mode..."
|
||||
if { "$TEST_SCRIPT" $test_args && bash "$SETTINGS_TEST_SCRIPT"; } > /tmp/test_output.log 2>&1; then
|
||||
if { "$TEST_SCRIPT" $test_args && bash "$SETTINGS_TEST_SCRIPT" && bash "$SNAPSHOT_TEST_SCRIPT"; } > /tmp/test_output.log 2>&1; then
|
||||
echo "✅ All tests passed!"
|
||||
exit 0
|
||||
else
|
||||
@@ -88,6 +89,7 @@ main() {
|
||||
###################################
|
||||
"$TEST_SCRIPT" $test_args
|
||||
bash "$SETTINGS_TEST_SCRIPT"
|
||||
bash "$SNAPSHOT_TEST_SCRIPT"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ NPM = shutil.which('npm')
|
||||
|
||||
|
||||
class PublishTests(unittest.TestCase):
|
||||
def run_publish(self, version='1.0.0-RC.1', trusted=True, project_config=False, **overrides):
|
||||
def run_publish(self, version='1.0.0-RC.1', trusted=True, project_config=False, trusted_mode=None, **overrides):
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
root = Path(directory)
|
||||
bin_dir = root / 'bin'
|
||||
@@ -29,7 +29,7 @@ if sys.argv[1:] == ['--version']:
|
||||
print(os.environ.get('TEST_NPM_VERSION', '11.19.0'))
|
||||
else:
|
||||
assert sys.argv[1] == 'publish', 'Unexpected npm command'
|
||||
if os.environ['QQQ_NPM_TRUSTED_PUBLISHING'] == 'true':
|
||||
if os.environ['QQQ_NPM_TRUSTED_PUBLISHING'] in ['true', '1']:
|
||||
assert os.environ.get('NPM_ID_TOKEN') == 'synthetic-oidc-token'
|
||||
assert all(not os.environ.get(name) for name in ['NPM_TOKEN', 'NODE_AUTH_TOKEN', 'NPM_AUTH_TOKEN'])
|
||||
assert os.environ['NPM_CONFIG_USERCONFIG'] != os.environ['NPM_CONFIG_GLOBALCONFIG']
|
||||
@@ -62,7 +62,8 @@ sys.exit(subprocess.run([os.environ['TEST_REAL_NODE'], *sys.argv[1:]], input=sou
|
||||
executable.write_text(contents)
|
||||
executable.chmod(0o755)
|
||||
env = dict(os.environ, PATH=str(bin_dir) + os.pathsep + os.environ['PATH'],
|
||||
QQQ_NPM_TRUSTED_PUBLISHING=str(trusted).lower(), TEST_REAL_NODE=NODE, TEST_REAL_NPM=NPM,
|
||||
QQQ_NPM_TRUSTED_PUBLISHING=str(trusted).lower() if trusted_mode is None else trusted_mode,
|
||||
TEST_REAL_NODE=NODE, TEST_REAL_NPM=NPM,
|
||||
NPM_TOKEN='synthetic-old-token', NODE_AUTH_TOKEN='synthetic-old-token',
|
||||
NPM_AUTH_TOKEN='synthetic-old-token', **overrides)
|
||||
result = subprocess.run(['bash', '-x', str(SCRIPT)], cwd=root, env=env,
|
||||
@@ -82,6 +83,14 @@ sys.exit(subprocess.run([os.environ['TEST_REAL_NODE'], *sys.argv[1:]], input=sou
|
||||
self.assertEqual(args, ['publish', '--access', 'public', '--tag', tag])
|
||||
self.assertEqual(oidc, trusted)
|
||||
|
||||
def test_circleci_boolean_environment_values(self):
|
||||
for mode, expected_oidc in [('1', True), ('0', False)]:
|
||||
with self.subTest(mode=mode):
|
||||
result, args, oidc = self.run_publish(trusted_mode=mode)
|
||||
self.assertEqual(result.returncode, 0, result.stderr)
|
||||
self.assertEqual(args, ['publish', '--access', 'public', '--tag', 'rc'])
|
||||
self.assertEqual(oidc, expected_oidc)
|
||||
|
||||
def test_oidc_failure_or_empty_token_stops_publication(self):
|
||||
for overrides in [{'TEST_OIDC_STATUS': '7'}, {'TEST_OIDC_VALUE': ''}]:
|
||||
with self.subTest(overrides=overrides):
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
#!/bin/bash
|
||||
# Asserts that every Maven build/test entry point refreshes SNAPSHOT dependencies.
|
||||
# The ~/.m2 cache is keyed only on the pom checksum, so without --update-snapshots
|
||||
# a cached SNAPSHOT is never re-checked within Maven's daily update window.
|
||||
set -u
|
||||
cd "$(dirname "$0")/.." || exit 1
|
||||
fail=0
|
||||
for f in src/scripts/mvn_build_compile.sh src/scripts/mvn_verify.sh src/scripts/frontend_build_compile.sh src/scripts/frontend_test_run.sh; do
|
||||
if grep -E '^mvn ' "$f" | grep -q -- '--update-snapshots'; then
|
||||
echo "PASS $f"
|
||||
else
|
||||
echo "FAIL $f: mvn invocation lacks --update-snapshots"; fail=1
|
||||
fi
|
||||
done
|
||||
exit $fail
|
||||
Reference in new issue
Block a user