Skip to content

Commit db39ea1

Browse files
authored
Merge pull request #3 from 0xMiden/next
v0.4.1
2 parents ae9f6a5 + f7b3f2e commit db39ea1

38 files changed

+999
-608
lines changed

.github/workflows/ci.yml

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- next
7+
paths-ignore:
8+
- "**.md"
9+
- "**.txt"
10+
pull_request:
11+
paths-ignore:
12+
- "**.md"
13+
- "**.txt"
14+
15+
env:
16+
# Set the new value when the cache grows too much and we hit the runner's disk space limit
17+
# via https://github.com/rust-lang/docs.rs/pull/2433
18+
RUST_CACHE_KEY: rust-cache-20251006
19+
20+
permissions:
21+
contents: read
22+
23+
jobs:
24+
lint:
25+
name: lint
26+
runs-on: ubuntu-latest
27+
steps:
28+
- &checkout
29+
uses: actions/checkout@v5
30+
with:
31+
fetch-depth: 0
32+
persist-credentials: false
33+
- &install-rust
34+
name: Install Rust
35+
run: |
36+
rustup update --no-self-update
37+
rustc --version
38+
- &cache-rust
39+
name: Cache Cargo
40+
uses: Swatinem/rust-cache@v2
41+
with:
42+
# Use a common cache for the basic compilation/formatter/clippy checks
43+
shared-key: ${{ github.workflow }}-shared
44+
prefix-key: ${{ env.RUST_CACHE_KEY }}
45+
save-if: ${{ github.ref == 'refs/heads/next' }}
46+
- &install-cargo-make
47+
name: Install cargo-make
48+
run: |
49+
if ! cargo make --version 2>/dev/null; then
50+
cargo install cargo-make --force
51+
fi
52+
- name: Clippy
53+
run: |
54+
cargo make clippy
55+
56+
check_format:
57+
name: check formatting
58+
runs-on: ubuntu-latest
59+
# Run this job after the linter, so the cache is hot
60+
needs: [lint]
61+
# But run this check even if the lint check failed
62+
if: ${{ always() }}
63+
steps:
64+
- *checkout
65+
- *install-rust
66+
- name: Cache Cargo
67+
uses: Swatinem/rust-cache@v2
68+
with:
69+
# Use a common cache for the basic compilation/formatter/clippy checks
70+
shared-key: ${{ github.workflow }}-shared
71+
prefix-key: ${{ env.RUST_CACHE_KEY }}
72+
# But do not save this cache, just use it
73+
save-if: false
74+
- *install-cargo-make
75+
- name: Check Formatting
76+
run: |
77+
cargo make check-format
78+
79+
unit_tests:
80+
name: unit tests
81+
runs-on: ubuntu-latest
82+
steps:
83+
- *checkout
84+
- *install-rust
85+
- name: Cache Cargo
86+
uses: Swatinem/rust-cache@v2
87+
with:
88+
# NOTE: We use a different cache for the tests, so they can be run in parallel, but we
89+
# also share the cache for the tests for efficiency
90+
shared-key: ${{ github.workflow }}-shared-tests
91+
prefix-key: ${{ env.RUST_CACHE_KEY }}
92+
save-if: ${{ github.ref == 'refs/heads/next' }}
93+
- *install-cargo-make
94+
- name: Check
95+
# We run `cargo check` to verify that the workspace compiles correctly before attempting
96+
# to execute the tests. This produces easier to read output if a compilation error occurs
97+
run: |
98+
cargo make check --tests
99+
- name: Test
100+
run: |
101+
cargo make test
102+
103+
check_release:
104+
name: release checks
105+
runs-on: ubuntu-latest
106+
steps:
107+
- *checkout
108+
- *install-rust
109+
- name: Cache Cargo
110+
uses: Swatinem/rust-cache@v2
111+
with:
112+
# NOTE: We use a different cache for the these release checks
113+
shared-key: ${{ github.workflow }}-shared-release-checks
114+
prefix-key: ${{ env.RUST_CACHE_KEY }}
115+
save-if: ${{ github.ref == 'refs/heads/next' }}
116+
- *install-cargo-make
117+
- name: Build all targets in release configuration
118+
run: |
119+
cargo make build --release --all-targets

.github/workflows/release.yml

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
# Our release workflow is as follows:
2+
#
3+
# 1. Merging to `main` will create a new release PR containing any unreleased changes
4+
# 2. The release PR gets merged to `main` when we are ready to publish the release
5+
# 3. The crates are published to crates.io, a new git tag is created, as well as a GitHub release
6+
# 4. A job is run to pre-build the executable for our supported targets and upload them to the
7+
# release.
8+
name: release
9+
10+
on:
11+
push:
12+
branches:
13+
- main
14+
15+
jobs:
16+
publish:
17+
name: publish any unpublished packages
18+
runs-on: ubuntu-latest
19+
if: ${{ github.repository_owner == '0xMiden' }}
20+
permissions:
21+
contents: write
22+
outputs:
23+
releases: ${{ steps.publish.outputs.releases }}
24+
releases_created: ${{ steps.publish.outputs.releases_created }}
25+
steps:
26+
- &checkout
27+
uses: actions/checkout@v5
28+
with:
29+
fetch-depth: 0
30+
persist-credentials: false
31+
- &install-rust
32+
name: Install Rust
33+
run: |
34+
rustup update --no-self-update
35+
rustc --version
36+
- name: Publish
37+
id: publish
38+
uses: release-plz/action@v0.5
39+
with:
40+
command: release
41+
env:
42+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
44+
45+
upload-artifacts:
46+
name: upload pre-built miden-debug executable artifacts
47+
runs-on: ubuntu-latest
48+
needs: publish
49+
if: ${{ github.repository_owner == '0xMiden' && needs.publish.outputs.releases_created == 'true' }}
50+
permissions:
51+
contents: write
52+
strategy:
53+
matrix:
54+
target: [aarch64-apple-darwin, x86_64-unknown-linux-gnu]
55+
steps:
56+
- *checkout
57+
- *install-rust
58+
- name: Add target
59+
run: |
60+
rustup target add ${{ matrix.target }}
61+
- name: Install cargo-make
62+
run: |
63+
if ! cargo make --version 2>/dev/null; then
64+
cargo install cargo-make --force
65+
fi
66+
- name: build
67+
run: cargo make miden-debug --release --target ${{ matrix.target }}
68+
- name: upload
69+
env:
70+
RELEASES: ${{ needs.publish.outputs.releases }}
71+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
72+
run: |
73+
set -e
74+
echo "RELEASES:"
75+
echo "=================="
76+
echo "${RELEASES}" | jq -rM
77+
echo "=================="
78+
release_version=$(echo "${RELEASES}" | jq -r '.[0].version')
79+
release_tag=$(echo "${RELEASES}" | jq -r '.[0].tag')
80+
mv target/${{ matrix.target }}/release/miden-debug miden-debug-${{ matrix.target }}
81+
gh release upload ${release_tag} miden-debug-${{ matrix.target }}
82+
83+
release:
84+
name: prepare the next release
85+
runs-on: ubuntu-latest
86+
if: ${{ github.repository_owner == '0xMiden' }}
87+
permissions:
88+
contents: write
89+
pull-requests: write
90+
concurrency:
91+
group: release-plz-${{ github.ref }}
92+
cancel-in-progress: false
93+
steps:
94+
- *checkout
95+
- *install-rust
96+
- name: Create release PR
97+
uses: release-plz/action@v0.5
98+
with:
99+
command: release-pr
100+
env:
101+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
102+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

.gitignore

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
target/
2-
bin/midenc
3-
bin/litcheck
2+
bin/miden-debug
43
.crates.toml
54
.crates2.json
65

@@ -18,7 +17,3 @@ node_modules/
1817
*DS_Store
1918
*.iml
2019
book/
21-
22-
# Ignore Rust bindings generated by `wit-bindgen` due to unstable comments
23-
# ("* with" option printing from a HashMap)
24-
**/src/bindings.rs

0 commit comments

Comments
 (0)