Skip to content
Draft
Show file tree
Hide file tree
Changes from all 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
52 changes: 52 additions & 0 deletions .github/workflows/workspace-publish.yml
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.

There are actually two artifacts that we want to produce from this workflow, as part of publishing a release:

  1. The miden-vm executable, which this PR does currently
  2. The core.masp package file, produced by the build script of the miden-core-lib crate. We may need a dedicated Makefile task for this though, since there isn't an easy way to locate the build script output directory without capturing the verbose output of cargo build in JSON form. We could either modify the build script to output the .masp to both OUT_DIR and CARGO_TARGET_DIR/core.masp (so that we have a predictable location to obtain it from), or write a cargo script that links against miden-core-lib and writes the embedded package bytes to disk somewhere. Either way, we'll need that artifact as well.

Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,55 @@ jobs:
verify-main-head: "true"
env:
CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}

# Upload the miden-vm CLI as an artifact on the GitHub release.
# Used by midenup to speed up installs.
upload-artifacts:
name: upload pre-built miden-vm executable artifacts
if: ${{ github.repository_owner == '0xMiden' }}
permissions:
contents: write
id-token: write
attestations: write
strategy:
matrix:
os: [macos-latest, ubuntu-latest]
target: [aarch64-apple-darwin, x86_64-unknown-linux-gnu]
exclude:
- os: macos-latest
target: x86_64-unknown-linux-gnu
- os: ubuntu-latest
target: aarch64-apple-darwin
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@6
with:
fetch-depth: 0
ref: ${{ github.event.release.tag_name }}
persist-credentials: false
- uses: ./.github/actions/cleanup-runner
- name: Install Rust
run: |
rustup update --no-self-update
rustc --version
- name: Add target
run: |
rustup target add ${{ matrix.target }}
- name: Build miden-vm
run: |
BUILD_TARGET=${{ matrix.target }} make exec-dist
- name: Prepare artifact
run: |
mv target/${{ matrix.target }}/optimized/miden-vm miden-vm-${{ matrix.target }}
- name: Attest miden-vm
uses: actions/attest-build-provenance@3
with:
subject-path: miden-vm-${{ matrix.target }}
- name: Upload
env:
RELEASE_TAG: ${{ github.event.release.tag_name }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -e
gh release upload ${RELEASE_TAG} miden-vm-${{ matrix.target }}
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ FEATURES_CONCURRENT_EXEC := --features concurrent,executable
FEATURES_METAL_EXEC := --features concurrent,executable,tracing-forest
FEATURES_LOG_TREE := --features concurrent,executable,tracing-forest

# Target triple used when producing release artifacts. Defaults to the host's triple.
BUILD_TARGET ?= $(shell rustc -vV | grep host | awk '{print $$2}')

# Per-crate default features
FEATURES_air := testing
FEATURES_assembly := testing
Expand Down Expand Up @@ -234,6 +237,10 @@ check-constraints: ## Check core-lib constraint artifacts for drift
exec-info: ## Builds an executable with log tree enabled
cargo build --profile optimized $(FEATURES_LOG_TREE)

.PHONY: exec-dist
exec-dist: ## Builds the CLI for $(BUILD_TARGET) with --locked (for release artifact uploads)
cargo build --profile optimized $(FEATURES_CONCURRENT_EXEC) --target $(BUILD_TARGET) --locked

# --- examples ------------------------------------------------------------------------------------

.PHONY: run-examples
Expand Down
Loading