Skip to content

Commit 56393fb

Browse files
author
harmont monorepo sync
committed
Sync from harmont monorepo @ f15836450c1d7d869d2bbfafecb2c2c7f639526d
0 parents  commit 56393fb

255 files changed

Lines changed: 20780 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitattributes

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Files marked export-ignore are stripped from the public mirror by
2+
# scripts/build-cli-mirror.sh. The script is the source of truth; these
3+
# markers exist so a human reading the file sees the intent.
4+
CLAUDE.md export-ignore
5+
**/CLAUDE.md export-ignore

.github/workflows/examples.yml

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
name: examples
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
permissions:
8+
contents: read
9+
10+
# Cancel superseded runs on rapid pushes — 17-leg matrix is expensive.
11+
concurrency:
12+
group: examples-${{ github.ref }}
13+
cancel-in-progress: true
14+
15+
env:
16+
CARGO_TERM_COLOR: always
17+
18+
jobs:
19+
# Fail fast if the matrix list has drifted from examples/. Cheaper than
20+
# waiting for 17 legs to finish and finding out a new example was added
21+
# but never wired into CI.
22+
validate-matrix:
23+
runs-on: ubuntu-latest
24+
timeout-minutes: 2
25+
steps:
26+
- uses: actions/checkout@v4
27+
- name: Diff examples/ against matrix slugs
28+
run: |
29+
on_disk="$(ls examples | grep -v '^README\.md$' | sort)"
30+
in_matrix="$(awk '/^ example:$/{flag=1;next}/^ steps:$/{flag=0}flag' .github/workflows/examples.yml \
31+
| sed -n 's/^\s*- //p' | sort)"
32+
if [ "$on_disk" != "$in_matrix" ]; then
33+
echo "matrix list out of sync with examples/ directory" >&2
34+
diff <(printf '%s\n' "$on_disk") <(printf '%s\n' "$in_matrix") >&2 || true
35+
exit 1
36+
fi
37+
38+
run-example:
39+
needs: validate-matrix
40+
name: ${{ matrix.example }}
41+
runs-on: ubuntu-latest
42+
timeout-minutes: 20
43+
strategy:
44+
fail-fast: false
45+
matrix:
46+
example:
47+
- c
48+
- cpp
49+
- csharp
50+
- go
51+
- haskell
52+
- java
53+
- kotlin
54+
- nextjs
55+
- ocaml
56+
- perl
57+
- php-laravel
58+
- python-uv
59+
- react
60+
- ruby
61+
- rust
62+
- typescript
63+
- zig
64+
steps:
65+
- uses: actions/checkout@v4
66+
67+
- uses: dtolnay/rust-toolchain@stable
68+
69+
- uses: Swatinem/rust-cache@v2
70+
with:
71+
# All matrix legs share the same hm binary; one cache key for the
72+
# whole workflow is sufficient.
73+
shared-key: examples-hm
74+
75+
- uses: actions/setup-python@v5
76+
with:
77+
python-version: '3.11'
78+
79+
- name: Install harmont-py
80+
run: |
81+
git clone --depth 1 https://github.com/harmont-dev/harmont-py /tmp/harmont-py
82+
pip install /tmp/harmont-py
83+
84+
- name: Build hm
85+
run: cargo build --release -p harmont-cli
86+
87+
- name: Run example via hm run --local
88+
working-directory: examples/${{ matrix.example }}
89+
env:
90+
# The CLI shells out to `python3 -m harmont` to render the
91+
# pipeline; the system Python on the runner is what setup-python
92+
# just installed.
93+
HM_NONINTERACTIVE: '1'
94+
run: ../../target/release/hm run --local

.github/workflows/release.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
permissions:
9+
contents: read
10+
11+
env:
12+
CARGO_TERM_COLOR: always
13+
14+
jobs:
15+
crates-io:
16+
name: Publish to crates.io
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v4
20+
- uses: dtolnay/rust-toolchain@stable
21+
- uses: Swatinem/rust-cache@v2
22+
23+
- name: Set version from tag
24+
run: |
25+
VERSION="${GITHUB_REF_NAME#v}"
26+
echo "VERSION=$VERSION" >> "$GITHUB_ENV"
27+
sed -i "0,/version = \"0.0.0-dev\"/s//version = \"$VERSION\"/" crates/hm-plugin-protocol/Cargo.toml
28+
sed -i "0,/version = \"0.0.0-dev\"/s//version = \"$VERSION\"/" crates/hm-plugin-sdk/Cargo.toml
29+
sed -i "0,/version = \"0.0.0-dev\"/s//version = \"$VERSION\"/" crates/hm/Cargo.toml
30+
# Rewrite workspace.dependencies pins so dependents resolve to the
31+
# tagged version (cargo publish strips path deps; the version field
32+
# is what consumers will receive).
33+
sed -i "s|hm-plugin-protocol = { path = \"crates/hm-plugin-protocol\", version = \"0.0.0-dev\" }|hm-plugin-protocol = { path = \"crates/hm-plugin-protocol\", version = \"$VERSION\" }|" Cargo.toml
34+
sed -i "s|hm-plugin-sdk = { path = \"crates/hm-plugin-sdk\", version = \"0.0.0-dev\" }|hm-plugin-sdk = { path = \"crates/hm-plugin-sdk\", version = \"$VERSION\" }|" Cargo.toml
35+
cargo check --workspace --exclude hm-fixtures
36+
37+
- name: Publish hm-plugin-protocol
38+
run: |
39+
if curl -sf "https://crates.io/api/v1/crates/hm-plugin-protocol/$VERSION" > /dev/null 2>&1; then
40+
echo "hm-plugin-protocol@$VERSION already published, skipping"
41+
else
42+
cargo publish -p hm-plugin-protocol --token ${{ secrets.CRATES_IO_TOKEN }} --allow-dirty
43+
fi
44+
45+
- name: Wait for crates.io index
46+
run: sleep 30
47+
48+
- name: Publish hm-plugin-sdk
49+
run: |
50+
if curl -sf "https://crates.io/api/v1/crates/hm-plugin-sdk/$VERSION" > /dev/null 2>&1; then
51+
echo "hm-plugin-sdk@$VERSION already published, skipping"
52+
else
53+
cargo publish -p hm-plugin-sdk --token ${{ secrets.CRATES_IO_TOKEN }} --allow-dirty
54+
fi
55+
56+
- name: Wait for crates.io index
57+
run: sleep 30
58+
59+
- name: Publish harmont-cli
60+
run: |
61+
if curl -sf "https://crates.io/api/v1/crates/harmont-cli/$VERSION" > /dev/null 2>&1; then
62+
echo "harmont-cli@$VERSION already published, skipping"
63+
else
64+
cargo publish -p harmont-cli --token ${{ secrets.CRATES_IO_TOKEN }} --allow-dirty
65+
fi

0 commit comments

Comments
 (0)