mirror of
https://github.com/wekan/wekan.git
synced 2026-11-24 20:45:00 -05:00
wekan/FerretDB now releases ferretdb-sqlite-<arch> beside ferretdb-<arch>: the same FerretDB with only the SQLite handler, about 5 MB smaller, and SQLite is all a WeKan bundle, image, snap or .spk runs. releases/ferretdb-asset.sh is the one place that chooses: the newest release that has ferretdb-sqlite-<arch>, and, until one does, the full ferretdb-<arch> of the newest release, which has the SQLite handler too. It says in the log which one it took and why, downloads it, verifies it against its .sha256sum, and returns FERRET_ASSET, FERRET_TAG, FERRET_URL and FERRET_SHA for the provenance table (also through $GITHUB_ENV, cached per job so the check and embed steps agree). Every FerretDB download goes through it: the amd64, arm64, win64, win-arm64, win32, mac-arm64, mac-x64 and extra-architecture jobs of release-all.yml (the Docker images, snap, AppImage, Flatpak, single-file and macOS/Windows packages are made from those bundles), repack-bundle-for-arch.sh for release-all-missing.yml, bsd.yml, check-arch-binaries.sh, build-release-bundle.sh and test-download-urls.sh. require-binaries.sh checks the resume-login floor against the release the helper chose. The provenance rows record that release and URL instead of /latest/. No release workflow builds FerretDB: sandstorm-src/build-deps.sh takes the prebuilt ferretdb-sqlite-amd64 by default (FERRETDB_SOURCE=download), and sandstorm.yml and release-all.yml's build-sandstorm no longer set FERRETDB_SOURCE=build; building from source stays a local option. The default docker-compose.yml downloads ferretdb-sqlite-<arch> (FERRETDB_BINARY, falling back to ferretdb-<arch> for a release without it); the PostgreSQL, MySQL, MariaDB and SAP HANA compose files keep the full binary. tests/ferretdbSqliteAsset.test.cjs drives the helper against a fake GitHub (newest, older and no release with the SQLite-only binary, .exe names, a pinned tag, FERRETDB_VARIANT=full, checksum match and mismatch, a missing platform, bad names) and checks that every download site uses it, that no workflow builds FerretDB and that only the SQLite compose file takes the SQLite-only binary. The tests that pinned the old URLs follow the helper. Thanks to xet7 !
111 lines
3.6 KiB
JavaScript
111 lines
3.6 KiB
JavaScript
'use strict';
|
|
|
|
const assert = require('node:assert/strict');
|
|
const fs = require('node:fs');
|
|
const path = require('node:path');
|
|
|
|
const root = path.resolve(__dirname, '..');
|
|
const read = relative => fs.readFileSync(path.join(root, relative), 'utf8');
|
|
const workflow = read('.github/workflows/release-all.yml');
|
|
const resolver = read('releases/resolve-node-source.sh');
|
|
const checks = read('releases/check-arch-binaries.sh');
|
|
const repack = read('releases/repack-bundle-for-arch.sh');
|
|
const composeVariants = [
|
|
'docker-compose.yml',
|
|
'docker-compose-ferretdb-v1-postgresql.yml',
|
|
'docker-compose-ferretdb-v1-mysql.yml',
|
|
'docker-compose-ferretdb-v1-mariadb.yml',
|
|
'docker-compose-ferretdb-v1-sap-hana.yml',
|
|
];
|
|
|
|
for (const [name, source] of [
|
|
['release workflow', workflow],
|
|
['architecture preflight', checks],
|
|
['architecture repack', repack],
|
|
]) {
|
|
assert.doesNotMatch(
|
|
source,
|
|
/wekan\/FerretDB\/releases\/download\/v\d/,
|
|
`${name} must not pin an old FerretDB release`,
|
|
);
|
|
assert.doesNotMatch(
|
|
source,
|
|
/wekan\/mongo-tools-patches\/releases\/download\/v\d/,
|
|
`${name} must not pin old MongoDB Database Tools`,
|
|
);
|
|
}
|
|
|
|
// The FerretDB URL lives in releases/ferretdb-asset.sh now (the SQLite-only
|
|
// ferretdb-sqlite-<arch>, or the full one of the newest release until a
|
|
// release has it); the workflow is checked for calling it, and the helper for
|
|
// starting from the newest release rather than a pinned one.
|
|
assert.match(
|
|
workflow,
|
|
/releases\/ferretdb-asset\.sh" amd64 -o \.build\/bundle\/ferretdb/,
|
|
'the primary bundle must fetch FerretDB through the helper',
|
|
);
|
|
assert.match(
|
|
read('releases/ferretdb-asset.sh'),
|
|
/latest="\$\(bash "\$here\/ferretdb-latest-tag\.sh"/,
|
|
'the helper must start from the newest FerretDB release',
|
|
);
|
|
// The workflow fetches the tools through releases/fetch-mongo-tools.sh (one
|
|
// program, mongo-tools-<platform>, instead of eight), so the newest-release
|
|
// URL lives in that helper now; the workflow is checked for calling it.
|
|
assert.match(
|
|
workflow,
|
|
/releases\/fetch-mongo-tools\.sh" \.build\/bundle amd64/,
|
|
'the primary workflow must fetch the database tools through the helper',
|
|
);
|
|
assert.match(
|
|
read('releases/fetch-mongo-tools.sh'),
|
|
/wekan\/mongo-tools-patches\/releases\/latest\/download/,
|
|
'the primary workflow must fetch the newest database-tool release',
|
|
);
|
|
assert.doesNotMatch(
|
|
read('releases/fetch-mongo-tools.sh'),
|
|
/wekan\/mongo-tools-patches\/releases\/download\/v\d/,
|
|
'the database-tool helper must not pin an old release',
|
|
);
|
|
assert.match(
|
|
resolver,
|
|
/index\.json, which lists every release newest first/,
|
|
'Node resolution must begin with the newest maintained Node release',
|
|
);
|
|
assert.match(
|
|
resolver,
|
|
/PATCHES="https:\/\/github\.com\/wekan\/node-patches\/releases\/download"/,
|
|
'fallback Node binaries must come from node-patches releases',
|
|
);
|
|
assert.match(
|
|
resolver,
|
|
/url="\$\{PATCHES\}\/\$\{V\}\/\$\{asset\}"/,
|
|
'node-patches must use the newest Node version currently being considered',
|
|
);
|
|
|
|
for (const file of composeVariants) {
|
|
const compose = read(file);
|
|
assert.match(
|
|
compose,
|
|
/RELEASE_FILE=\/data\/bin\/ferretdb\.release/,
|
|
`${file} must remember which FerretDB release its volume contains`,
|
|
);
|
|
assert.match(
|
|
compose,
|
|
/CACHED_RELEASE=.*RELEASE_FILE/,
|
|
`${file} must compare the cached binary with the requested release`,
|
|
);
|
|
assert.match(
|
|
compose,
|
|
/(?:ferretdb-.*|\$\$\{ASSET\})\.sha256sum/,
|
|
`${file} must verify the downloaded FerretDB binary`,
|
|
);
|
|
assert.match(
|
|
compose,
|
|
/mv "\$\$BIN\.new" "\$\$BIN"/,
|
|
`${file} must replace a verified download atomically`,
|
|
);
|
|
}
|
|
|
|
console.log('releaseBinaryFreshness: 31 assertions passed');
|