Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .github/workflows/installer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@ on:
paths:
- bin/installer.sh
- .github/workflows/installer.yml
- .github/workflows/release.yml
push:
branches:
- main
paths:
- bin/installer.sh
- .github/workflows/installer.yml
- .github/workflows/release.yml

concurrency:
group: ${{ github.workflow }}-${{ github.ref || github.event.pull_request.number || github.sha }}
Expand Down Expand Up @@ -76,6 +78,17 @@ jobs:
which midenup
midenup --version

# Exercise the opt-out flags: the binary must land in the requested directory, no
# verification may run, and `midenup init` must not create MIDENUP_HOME.
- name: Install with all opt-out flags
run: |
install_path="$(mktemp -d 2>/dev/null || mktemp -d -t 'install-path')"
export MIDENUP_HOME="${RUNNER_TEMP}/no-init-home"
bin/installer.sh --install-path "${install_path}" --no-init --no-verify --ignore-attestation --no-cargo-fallback 2>&1 | tee "${RUNNER_TEMP}/installer.log"
test -x "${install_path}/midenup"
if grep -q 'Verifying' "${RUNNER_TEMP}/installer.log"; then echo "verification ran despite opt-out flags"; exit 1; fi
if [ -e "${MIDENUP_HOME}" ]; then echo "init ran despite --no-init"; exit 1; fi

# Dummy job to have a stable name for the "all tests pass" requirement
tests-pass:
name: Install scripts test pass
Expand Down
35 changes: 35 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -367,3 +367,38 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cargo make release finalize --plan "${RUNNER_TEMP}/plan.json"

# Install from the release that was just published, the way the README tells users to.
# This is the only check that reaches the installer through its published asset URL, and
# the only one that runs against the artifacts of this release rather than the previous one.
smoke:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would run this as a separate workflow entirely (I'd literally just call it smoke.yml), triggered when a release is published (not when created as a draft, but when it is published from draft), and maybe when the manifest gets published as well.

Running this as part of the release workflow means that the whole workflow will be considered failed if this smoke job fails for any reason (even spurious ones), however the reality is that by the point it runs, the release itself succeeded and was published both to crates.io, and to GitHub (the draft release is published and made immutable). At that point, any issues with the released artifacts will require a new release to address - basically, it isn't actionable at that point.

Using a separate workflow means we can run it not only upon releases being published without interfering with the release workflow itself; but when the manifest changes as well, and run a broader set of smoke tests that way.

name: install from release
needs: [finalize]
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest]
runs-on: ${{ matrix.os }}
permissions:
contents: read
artifact-metadata: read
steps:
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: release-plan
path: ${{ runner.temp }}

- name: Run the published installer
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
tag="$(jq -r '.intent.tags[] | select(.unit == "main") | .name' "${RUNNER_TEMP}/plan.json")"
echo "Installing midenup ${tag}"
curl --retry 10 -L --proto '=https' --tlsv1.2 -sSf -O \
"https://github.com/0xMiden/midenup/releases/download/${tag}/installer.sh"
bash installer.sh --version "${tag}"

- name: Verify `midenup` installation
run: |
which midenup
midenup --version
7 changes: 4 additions & 3 deletions .release/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ changelog = "CHANGELOG.md"
changelog-headings = ["Added", "Changed", "Fixed", "Migration and breaking changes"]
latest = true
# The release workflow's matrix builds `${binary}-${target}.tar.gz` for the midenup binary
# across two targets. They route here.
assets = ["midenup-*.tar.gz"]
required-assets = ["midenup-*.tar.gz"]
# across two targets, and uploads `bin/installer.sh` so users can fetch it from the release.
# They route here.
assets = ["midenup-*.tar.gz", "installer.sh"]
required-assets = ["midenup-*.tar.gz", "installer.sh"]


# Repository infrastructure, never published.
Expand Down
4 changes: 2 additions & 2 deletions bin/installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ do_verify_attestation() {
}

install_via_cargo() {
case "${0:-}" in
case "${1:-}" in
"") cargo install --force --locked --bin midenup --no-track midenup ;;
*) cargo install --force --locked --bin midenup --no-track --version "$0" midenup;;
*) cargo install --force --locked --bin midenup --no-track --version "$1" midenup;;
esac
}

Expand Down
Loading