Remote builds: unpack with the current time (cargo must not reuse stale objects from a cached target), export blobs as committed, build at low priority
git archive stamps files with the commit time, older than the cached build in the shared target dir: a changed source looked unchanged and the build reused stale objects (seen as a missing module after a pointer bump).
This commit is contained in:
parent
d6300aee3a
commit
c92e99b4bd
2 changed files with 8 additions and 3 deletions
|
|
@ -68,7 +68,8 @@ export function exportCommitted({ root, file, exclude = [], log = () => {} }) {
|
|||
// `exclude` (paths of the app repo the build never reads, e.g. screenshots) keeps the upload small.
|
||||
const skip = part.path ? [] : ['--', '.', ...exclude.map(path => `:(exclude)${path}`)];
|
||||
const args = ['archive', '--format=tar', ...(part.prefix ? [`--prefix=${part.prefix}`] : []), '-o', join(staging, tarName), part.ref, ...skip];
|
||||
const archived = run('git', ['-C', part.repo, ...args]);
|
||||
// Blobs as committed: the developer's core.autocrlf must not decide the line endings of the build.
|
||||
const archived = run('git', ['-C', part.repo, '-c', 'core.autocrlf=false', ...args]);
|
||||
if (archived.status !== 0) fail(`git archive ${part.path ?? 'app'} at ${part.ref.slice(0, 12)} failed: ${(archived.stderr || '').trim().split('\n')[0]} (is that commit in the local repository?)`);
|
||||
// Relative names and cwd: a drive letter in an argument reads as a remote host to GNU tar.
|
||||
mkdirSync(join(staging, 'tree'), { recursive: true });
|
||||
|
|
@ -112,8 +113,10 @@ SRC="$WORK/src"
|
|||
OUT="$WORK/out"
|
||||
cd "$WORK"
|
||||
rm -rf "$SRC" "$OUT"
|
||||
# -m: files get the time of unpacking. git archive stamps every file with its commit time, which is older
|
||||
# than the cached build in CARGO_TARGET_DIR: cargo would take a changed source for unchanged and reuse stale objects.
|
||||
mkdir -p "$SRC" "$OUT"
|
||||
tar -xzf "$WORK/source-${sha.slice(0, 12)}.tgz" -C "$SRC"
|
||||
tar -xzmf "$WORK/source-${sha.slice(0, 12)}.tgz" -C "$SRC"
|
||||
cd "$SRC"
|
||||
rustup target add aarch64-apple-darwin x86_64-apple-darwin
|
||||
${prepareCommand}
|
||||
|
|
@ -153,7 +156,7 @@ cd "$HOME"
|
|||
mkdir -p "$WORK"
|
||||
rm -rf "$SRC"
|
||||
mkdir -p "$SRC"
|
||||
tar -xzf "$(wslpath -u ${shq(tarball)} 2>/dev/null || echo ${shq(tarball)})" -C "$SRC"
|
||||
tar -xzmf "$(wslpath -u ${shq(tarball)} 2>/dev/null || echo ${shq(tarball)})" -C "$SRC"
|
||||
cd "$SRC"
|
||||
${prepareCommand}
|
||||
cd ${shq(desktopDir)}
|
||||
|
|
|
|||
|
|
@ -78,6 +78,7 @@ test('mac script: rustup first, ad-hoc universal build through build-env, update
|
|||
const script = macBuildScript(MAC);
|
||||
assert.match(script, /export PATH="\$HOME\/\.cargo\/bin:\$PATH"/);
|
||||
assert.match(script, /renice -n 10/);
|
||||
assert.match(script, /tar -xzmf /); // unpacking time, not commit time: cargo must see the sources as new
|
||||
assert.match(script, /rustup target add aarch64-apple-darwin x86_64-apple-darwin/);
|
||||
assert.match(script, /waybetter\.mjs" build-env -- bunx tauri build --target universal-apple-darwin --bundles app,dmg --ci/);
|
||||
assert.match(script, /"createUpdaterArtifacts":false/);
|
||||
|
|
@ -93,6 +94,7 @@ test('linux script: clean PATH (no Windows programs), AppImage and deb through b
|
|||
const script = linuxBuildScript({ ...MAC, tarball: 'C:\\t\\source.tgz', outDir: 'C:\\o\\linux' });
|
||||
assert.match(script, /export PATH="\$HOME\/\.bun\/bin:\$HOME\/\.cargo\/bin:\/usr\/local\/sbin/);
|
||||
assert.doesNotMatch(script, /\/mnt\/c/);
|
||||
assert.match(script, /tar -xzmf /);
|
||||
assert.match(script, /--bundles appimage,deb --ci/);
|
||||
assert.match(script, /App_1\.2\.3_amd64\.AppImage/);
|
||||
assert.match(script, /wslpath -u 'C:\\t\\source\.tgz'/);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue