mirror of
https://github.com/wekan/wekan.git
synced 2026-11-24 09:59:47 -05:00
The v13.18 release run: every wekan and wekan-gantt-gpl snap uploaded,
then sat in the Snap Store's "Status: processing" for hours. snapcraft
polls that with no limit, so GitHub cancelled the jobs at timeout-minutes
(2 h native, 6 h Launchpad). snap-upload-retry.sh now gives one upload
30 minutes (SNAP_UPLOAD_PROCESSING_BUDGET). A revision the store accepted
is left for the store to release to the channels sent with it, with a
warning, instead of uploading it again; an upload cut off before the
store accepted it is retried.
Bun android-arm64 died on a Termux mirror mid-sync ("File has unexpected
size ... Mirror sync in progress?") and Bun freebsd-x64 on an unreachable
FreeBSD package mirror. Termux installs (Bun, Android bundles) and the
i386 libraries of single-file now go through releases/apt-install.sh,
which learned Termux's prefix and lack of sudo. Every BSD VM prepare
retries its package install 5 times and says why when it gives up.
Thanks to xet7 !
96 lines
5.5 KiB
JavaScript
96 lines
5.5 KiB
JavaScript
'use strict';
|
|
// Execute the affected workflow boundaries without Docker, credentials or uploads.
|
|
const assert = require('node:assert/strict');
|
|
const fs = require('node:fs');
|
|
const path = require('node:path');
|
|
const { spawnSync } = require('node:child_process');
|
|
const { pathToFileURL } = require('node:url');
|
|
const root = path.resolve(__dirname, '..');
|
|
const tmp = fs.mkdtempSync(path.join(root, '.tools/tmp/build-log-tests-'));
|
|
const read = file => fs.readFileSync(path.join(root, file), 'utf8');
|
|
function step(file, title) {
|
|
const body = read(file).split(` - name: ${title}\n`)[1].split('\n - ')[0];
|
|
return body.split(' run: |\n')[1].split('\n').map(l => l.slice(10)).join('\n');
|
|
}
|
|
function executable(file, source) {
|
|
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
fs.writeFileSync(file, source, { mode: 0o755 });
|
|
}
|
|
// Termux's apt-get lives under its own prefix, where apt-install.sh finds it.
|
|
const termuxBin = path.join(tmp, 'data/data/com.termux/files/usr/bin');
|
|
const env = { ...process.env, PATH: [path.join(tmp, 'bin'), termuxBin, process.env.PATH].join(path.delimiter),
|
|
GITHUB_ENV: path.join(tmp, 'github-env'), TARGET: 'android-arm64', TARGET_PLATFORM: 'android',
|
|
TARGET_ARCH: 'arm64', RELEASE_TAG: 'v12.37', TERMUX_ARCH: 'aarch64' };
|
|
try {
|
|
fs.mkdirSync(path.join(tmp, 'bundle'));
|
|
// Mirror Termux's env -i at its privilege boundary; no real container is run.
|
|
executable(path.join(tmp, 'bin/docker'), `#!/usr/bin/env python3
|
|
import os, subprocess, sys
|
|
args = sys.argv[1:]
|
|
index = next(i for i, arg in enumerate(args) if arg.startswith('termux/termux-docker:'))
|
|
sys.exit(subprocess.run(args[index+1:], env={'PATH': os.environ['PATH']}).returncode)
|
|
`);
|
|
executable(path.join(termuxBin, 'apt-get'), '#!/bin/sh\nexit 0\n');
|
|
// The step installs through the real helper (v13.18 Termux mirror retry).
|
|
executable(path.join(tmp, 'releases/apt-install.sh'), read('releases/apt-install.sh'));
|
|
executable(path.join(tmp, 'releases/bun/build-target.sh'), `#!/bin/bash
|
|
set -eu
|
|
[ "$TARGET" = android-arm64 ]
|
|
[ "$TARGET_PLATFORM" = android ]
|
|
[ "$TARGET_ARCH" = arm64 ]
|
|
[ "$RELEASE_TAG" = v12.37 ]
|
|
[ "$DO_NOT_TRACK" = 1 ]
|
|
echo metadata-preserved
|
|
`);
|
|
const android = step('.github/workflows/bun.yml', 'Native Android Bionic build and smoke tests');
|
|
const runAndroid = code => spawnSync('bash', ['-ec', code], { cwd: tmp, env, encoding: 'utf8' });
|
|
const positive = runAndroid(android);
|
|
assert.equal(positive.status, 0, positive.stdout + positive.stderr);
|
|
assert.match(positive.stdout, /metadata-preserved/);
|
|
const control = android.replace(/ env \\\n[\s\S]*?DO_NOT_TRACK=1 bash -ec/, ' bash -ec');
|
|
assert.notEqual(control, android);
|
|
assert.notEqual(runAndroid(control).status, 0, 'Docker -e alone must reproduce the lost environment');
|
|
|
|
// The i386 bundle was attached 13 minutes before AppImage incorrectly skipped it.
|
|
executable(path.join(tmp, 'bin/gh'), `#!/usr/bin/env python3
|
|
import os, sys
|
|
assert sys.argv.count('--repo') == 1
|
|
if os.environ['ASSET_CASE'] == 'error': sys.exit(9)
|
|
if os.environ['ASSET_CASE'] == 'present': print('wekan-12.37-i386.zip', flush=True)
|
|
# Large multi-write response catches early-closing grep/pipefail regressions.
|
|
for i in range(20000): print('other-asset-' + str(i))
|
|
`);
|
|
const gate = step('.github/workflows/AppImage.yml', 'Skip this arch if its release bundle is not published yet');
|
|
// The step's env: block, as the runner would set it (the values reach the
|
|
// script through env since the workflow hardening).
|
|
const gateEnv = { NEEDS_RELEASE_VERSION: '12.37', NEEDS_RELEASE_TAG: 'v12.37',
|
|
MATRIX_BUNDLE_ARCH: 'i386', GITHUB_CTX_REPOSITORY: 'wekan/wekan' };
|
|
for (const kind of ['present', 'missing', 'error']) {
|
|
fs.writeFileSync(env.GITHUB_ENV, '');
|
|
const result = spawnSync('bash', ['-ec', gate], { cwd: tmp, env: { ...env, ...gateEnv, ASSET_CASE: kind }, encoding: 'utf8' });
|
|
assert.equal(result.status === 0, kind !== 'error', result.stdout + result.stderr);
|
|
assert.equal(fs.readFileSync(env.GITHUB_ENV, 'utf8').includes('BUILD_THIS=false'), kind === 'missing');
|
|
}
|
|
|
|
// Probes must exit after a successful require, rebuild on load errors and
|
|
// terminate an addon stuck inside native initialization (no event-loop timer).
|
|
const probeTest = path.join(tmp, 'probe.mjs');
|
|
fs.writeFileSync(path.join(tmp, 'ok.cjs'), 'setInterval(() => {}, 1000);');
|
|
fs.writeFileSync(path.join(tmp, 'bad.cjs'), 'throw new Error("bad native addon");');
|
|
fs.writeFileSync(path.join(tmp, 'hung.cjs'), 'while (true) {}');
|
|
fs.writeFileSync(probeTest, `import { probeAddon, run } from ${JSON.stringify(pathToFileURL(path.join(root, 'releases/bun/rebuild.mjs')).href)};
|
|
import assert from 'node:assert/strict';
|
|
assert.equal(probeAddon(process.execPath, './ok.cjs', process.cwd(), 2000), true);
|
|
assert.equal(probeAddon(process.execPath, './bad.cjs', process.cwd(), 2000), false);
|
|
assert.equal(probeAddon(process.execPath, './hung.cjs', process.cwd(), 200), false);
|
|
assert.throws(() => run(process.execPath, ['-e', 'while(true) {}'], process.cwd(), {}, 200), /ETIMEDOUT/);
|
|
`);
|
|
const probes = spawnSync(process.execPath, [probeTest], { cwd: tmp, encoding: 'utf8', timeout: 8000 });
|
|
assert.equal(probes.status, 0, probes.stdout + probes.stderr);
|
|
assert.match(read('releases/bun/build-target.sh'), /node releases\/bun\/run-native-check.mjs/);
|
|
assert.match(read('releases/bun/run-native-check.mjs'), /180000/);
|
|
console.log('Android env reset, AppImage asset detection, and hung addon regression tests passed.');
|
|
} finally {
|
|
fs.rmSync(tmp, { recursive: true, force: true });
|
|
}
|