cargo-matrix 0.4.6

Run feature matrices against cargo commands that support feature lists
#!/usr/bin/env fish
# Stage: trigger the Linux/macOS/Windows native builds on repomon's
# self-hosted runners (see .repomon/release.toml), plus the audit job (see
# .repomon/audit.toml -- fires on the same tag push), by pushing the release
# tag to `origin` (/opt/repos/cargo-matrix.git, repomon-pr-hooked), then wait
# for each job's scp hand-back to land in the staging directory. The Linux
# leg is 2 independent jobs (linux-build-x86_64, linux-build-aarch64) that
# fan out across up to 2 repomon linux runners instead of one job building
# both sequentially.
#
# repomon has no CLI to submit/await a job and no artifact-return channel of
# its own (each job's workspace is deleted right after it finishes, and only
# text logs persist) -- so the last step of each repomon job scp's its
# artifact(s) to $staging_dir itself, and this script just polls for them.
# The audit job hands off a bare "audit.ok" marker the same way, so a
# failing audit blocks the rest of this pipeline too (see audit.toml's
# comment) even though repomon has no cross-workflow dependency mechanism.
#
# Runs for -rcN tags too: this is exactly how you dry-run-verify the
# repomon leg end to end before cutting a real release -- release.fish
# skips every stage after this one for -rc tags.

source (path dirname (status --current-filename))/lib.fish

cd (rel_repo_root)
or rel_die "not inside the cargo-matrix git repo"

rel_resolve_tag
rel_require_cmd ssh
rel_require_cmd git

set -l staging_root /opt/releases/cargo-matrix/staging
set -l staging_dir $staging_root/$RELEASE_TAG
test -d $staging_root
or rel_die "$staging_root does not exist -- do the one-time infra setup first (mkdir -p /opt/releases/cargo-matrix/staging)"

mkdir -p $staging_dir
or rel_die "failed to create $staging_dir"

rel_log "pushing $RELEASE_TAG to origin to trigger repomon's build/audit jobs"
git push origin $RELEASE_TAG
or rel_die "failed to push $RELEASE_TAG to origin"

set -l pkgver $RELEASE_PKGVER
set -l files \
    "cargo-matrix-x86_64-unknown-linux-gnu-v$pkgver.tar.gz" \
    "cargo-matrix-aarch64-unknown-linux-gnu-v$pkgver.tar.gz" \
    "cargo-matrix-aarch64-apple-darwin-v$pkgver.tar.gz" \
    "cargo-matrix-x86_64-apple-darwin-v$pkgver.tar.gz" \
    "cargo-matrix-x86_64-pc-windows-msvc-v$pkgver.zip" \
    "audit.ok"

rel_log "waiting for repomon's linux-build-*/macos-build/windows-build/audit jobs to scp their artifacts into $staging_dir"
rel_log "(watch progress with 'rpmt', or tail ~/.local/share/repomon/logs/cargo-matrix/)"

rel_wait_for_files $staging_dir $files 2400
or rel_die "timed out waiting for repomon artifacts in $staging_dir -- check the repomon daemon/runner logs"

rel_log "collecting repomon artifacts into release-assets/"
rm -rf release-assets
mkdir -p release-assets
for f in $files
    cp $staging_dir/$f release-assets/
    or rel_die "failed to copy $f from $staging_dir"
end

rel_log "release-assets/ contents:"
ls -la release-assets