Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
b31922c
feat(tree-sitter-compact): add declaration-level Compact grammar
0xisk Sep 15, 2026
0d4991b
refactor(compact-tree-sitter): rename the grammar crate
0xisk Sep 15, 2026
ec5cb8a
feat(compact-lint): add the check command
0xisk Sep 15, 2026
a8ac656
feat(compact-lint): add the fix command
0xisk Sep 15, 2026
25b4943
feat(compact-lint): add the fill-constraints command
0xisk Sep 15, 2026
2ad67ef
test(compact-lint): track the seeded cache fixture
0xisk Sep 15, 2026
80691d5
build(compact-lint): ship prebuilt binaries through npm
0xisk Sep 15, 2026
b3c6c8c
build(compact-linter): name the npm package compact-linter
0xisk Sep 15, 2026
71db1e8
build(compact-linter): finish the compact-linter rename
0xisk Sep 15, 2026
46ef29a
ci(rust): stop persisting checkout credentials
0xisk Sep 16, 2026
f06882b
docs(compact-tree-sitter): correct the name field claim
0xisk Sep 16, 2026
e2b329d
test(compact-tree-sitter): skip symlinks in the corpus walk
0xisk Sep 16, 2026
847e376
Merge branch 'feat/tree-sitter-compact' into feat/compact-lint-check
0xisk Sep 16, 2026
334b4a9
fix(compact-lint): resolve explicit paths against cwd
0xisk Sep 16, 2026
9344813
refactor(compact-lint): mark Tag::new must_use
0xisk Sep 16, 2026
3ade154
fix(compact-lint): check constraints under docs = none
0xisk Sep 16, 2026
57a8323
Merge branch 'feat/compact-lint-check' into feat/compact-lint-fix
0xisk Sep 16, 2026
0acfa84
fix(compact-lint): skip inserting a tag a rename supplies
0xisk Sep 16, 2026
e64fef9
fix(compact-lint): validate the fix placeholder
0xisk Sep 16, 2026
c4737e6
fix(compact-lint): validate rename against forbid
0xisk Sep 16, 2026
aa06bbd
fix(compact-lint): write through a unique temp file
0xisk Sep 16, 2026
4802e70
Merge branch 'feat/compact-lint-fix' into feat/compact-lint-fill-cons…
0xisk Sep 16, 2026
f5b467e
docs(compact-lint): tag output fences as text
0xisk Sep 16, 2026
c42ba9b
fix(compact-lint): keep leading parent components
0xisk Sep 16, 2026
cc81edd
Merge branch 'feat/compact-lint-fill-constraints' into build/compact-…
0xisk Sep 16, 2026
7b74838
feat(compact-lint): add the check command
0xisk Sep 15, 2026
68baa98
fix(compact-lint): resolve explicit paths against cwd
0xisk Sep 16, 2026
5ec1584
refactor(compact-lint): mark Tag::new must_use
0xisk Sep 16, 2026
3423bd6
fix(compact-lint): check constraints under docs = none
0xisk Sep 16, 2026
104d9e3
Merge branch 'feat/compact-lint-check' into feat/compact-lint-fix
0xisk Oct 13, 2026
a3e35f6
Merge branch 'main' into feat/compact-lint-fix
0xisk Nov 17, 2026
a907f86
fix(compact-lint): keep the closing */ on a module-name fix
0xisk Nov 17, 2026
8a940ed
fix(compact-lint): move delimiter-line text before inserting
0xisk Nov 17, 2026
8b14e94
fix(compact-lint): write the constraints tag only once
0xisk Nov 17, 2026
fe190a2
Merge branch 'feat/compact-lint-fix' into feat/compact-lint-fill-cons…
0xisk Nov 17, 2026
fd8b639
Merge branch 'main' into feat/compact-lint-fill-constraints
0xisk Nov 17, 2026
87569ed
fix(compact-lint): keep a note when k/rows match
0xisk Nov 17, 2026
948fc68
docs(compact-lint): drop the shared-cache claim
0xisk Nov 17, 2026
d478903
fix(compact-lint): keep edits saved during a fill
0xisk Nov 17, 2026
8a3f1d3
fix(compact-lint): measure under NO_COLOR
0xisk Nov 17, 2026
fe318a2
refactor(compact-lint): share one path normalize
0xisk Nov 17, 2026
f9d2556
fix(compact-lint): measure up to 500 circuits per compile
0xisk Nov 17, 2026
eddda31
Merge branch 'feat/compact-lint-fill-constraints' into build/compact-…
0xisk Nov 17, 2026
fdcda37
Merge branch 'main' into build/compact-lint-release
0xisk Nov 17, 2026
070f457
fix(compact-linter): cache the binary per user
0xisk Nov 17, 2026
d034e0f
fix(compact-linter): never replace published release assets
0xisk Nov 17, 2026
551d97f
fix(compact-linter): reject musl hosts
0xisk Nov 17, 2026
6b0bfd5
ci(compact-linter): keep the binary build token-free
0xisk Nov 17, 2026
d3fdb79
docs: describe the release dependency graph
0xisk Nov 17, 2026
6c2aedb
ci(compact-linter): check the commit after checkout
0xisk Nov 17, 2026
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
234 changes: 215 additions & 19 deletions .github/workflows/release-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,30 +24,31 @@ on:
- compact-builder
- compact-cli
- compact-deployer
- compact-linter
- compact-simulator

jobs:
publish:
name: Publish merged release
# Detection is its own job so the binary matrix and the publish both read the
# same answer.
detect:
name: Detect released package
if: >-
github.event_name == 'workflow_dispatch' ||
(github.event.pull_request.merged == true &&
contains(github.event.pull_request.labels.*.name, 'release'))
runs-on: ubuntu-24.04
environment: compact-npm-prod # Final approval gate before npm publish

permissions:
contents: write # push the version tag
id-token: write # mint the npm OIDC credential (existing packages) and the provenance statement (both paths)
contents: read

steps:
- name: Get github app token
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
id: gh-app-token
with:
app-id: ${{ vars.GH_APP_ID }}
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
outputs:
dir: ${{ steps.pkg.outputs.dir }}
name: ${{ steps.pkg.outputs.name }}
version: ${{ steps.pkg.outputs.version }}
dist_tag: ${{ steps.pkg.outputs.dist_tag }}
sha: ${{ steps.pkg.outputs.sha }}

steps:
# For pull_request runs: checkout the merge commit (deterministic view of
# what was just merged). For manual dispatch: checkout the dispatched ref
# (defaults to main but can be any branch — hotfix, release-prep, etc.).
Expand All @@ -58,7 +59,6 @@ jobs:
with:
fetch-depth: 0
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.merge_commit_sha || github.ref }}
token: ${{ steps.gh-app-token.outputs.token }}

- name: Detect released package
id: pkg
Expand All @@ -74,6 +74,7 @@ jobs:
compact-builder) DIR="builder" ;;
compact-cli) DIR="cli" ;;
compact-deployer) DIR="deployer" ;;
compact-linter) DIR="linter" ;;
compact-simulator) DIR="simulator" ;;
*)
echo "::error::unknown package: $PKG"
Expand All @@ -93,6 +94,7 @@ jobs:
builder) PKG="compact-builder" ;;
cli) PKG="compact-cli" ;;
deployer) PKG="compact-deployer" ;;
linter) PKG="compact-linter" ;;
simulator) PKG="compact-simulator" ;;
*)
echo "::error::unknown package directory: $DIR"
Expand Down Expand Up @@ -131,6 +133,7 @@ jobs:
echo "name=$PKG"
echo "version=$VERSION"
echo "dist_tag=$DIST_TAG"
echo "sha=$(git rev-parse HEAD)"
} >> $GITHUB_OUTPUT
{
echo "### Publishing"
Expand All @@ -140,6 +143,137 @@ jobs:
echo "- Trigger: $EVENT"
} >> $GITHUB_STEP_SUMMARY

# A re-run from a later commit must not publish or attach assets under a tag
# that names another commit. An annotated tag is compared by its peeled commit.
- name: Check an existing tag
env:
TAG: ${{ steps.pkg.outputs.name }}/v${{ steps.pkg.outputs.version }}
run: |
PEELED=$(git ls-remote origin "refs/tags/$TAG^{}" | cut -f1)
DIRECT=$(git ls-remote origin "refs/tags/$TAG" | cut -f1)
TAGGED=${PEELED:-$DIRECT}
HEAD_SHA=$(git rev-parse HEAD)
if [[ -n "$TAGGED" && "$TAGGED" != "$HEAD_SHA" ]]; then
echo "::error::tag $TAG points to $TAGGED, not $HEAD_SHA; dispatch the run from the tag"
exit 1
fi

# compact-linter ships a native binary per target, built on its own runner. The
# npm package downloads them, so they must reach the GitHub release first.
binaries:
name: Build compact-lint for ${{ matrix.target }}
needs: detect
if: needs.detect.outputs.name == 'compact-linter'
runs-on: ${{ matrix.runner }}

permissions:
contents: read

strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
runner: ubuntu-24.04
- target: aarch64-unknown-linux-gnu
runner: ubuntu-24.04-arm
- target: x86_64-apple-darwin
runner: macos-15-intel
- target: aarch64-apple-darwin
runner: macos-15

steps:
- name: Harden Runner
uses: step-security/harden-runner@05e31511f85b41b11d1cf0ef85d0992719546e2c # v2.21.0
with:
egress-policy: audit

# Cargo runs build scripts, so no token stays in .git/config.
- name: Check out target ref
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.merge_commit_sha || github.ref }}
persist-credentials: false

# A dispatched branch can move after detect ran; build only the commit it checked.
- name: Check the commit
env:
DETECTED: ${{ needs.detect.outputs.sha }}
run: |
HEAD_SHA=$(git rev-parse HEAD)
if [[ "$HEAD_SHA" != "$DETECTED" ]]; then
echo "::error::checked out $HEAD_SHA, but detect checked $DETECTED; re-run all jobs"
exit 1
fi

- name: Install the pinned toolchain
run: |
CHANNEL=$(grep -m1 '^channel' rust-toolchain.toml | cut -d'"' -f2)
rustup toolchain install "$CHANNEL" --profile minimal
rustup target add ${{ matrix.target }}
rustup show active-toolchain

- name: Build
run: cargo build --release -p compact-lint --target ${{ matrix.target }}

# Every target is built on its own native runner, so the binary runs here.
- name: Smoke test
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed
run: target/${{ matrix.target }}/release/compact-lint --version

- name: Stage the release asset
run: |
mkdir -p dist
cp target/${{ matrix.target }}/release/compact-lint dist/compact-lint-${{ matrix.target }}

- name: Upload the release asset
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: compact-lint-${{ matrix.target }}
path: dist/compact-lint-${{ matrix.target }}
if-no-files-found: error

publish:
name: Publish merged release
needs: [detect, binaries]
# `binaries` is skipped for every package but compact-linter, and a skipped
# dependency must not skip the publish.
if: >-
always() &&
needs.detect.result == 'success' &&
(needs.binaries.result == 'success' || needs.binaries.result == 'skipped')
runs-on: ubuntu-24.04
environment: compact-npm-prod # Final approval gate before npm publish

permissions:
contents: write # push the version tag and create the GitHub release
id-token: write # mint the npm OIDC credential (existing packages) and the provenance statement (both paths)

steps:
- name: Get github app token
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
id: gh-app-token
with:
app-id: ${{ vars.GH_APP_ID }}
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}

- name: Check out target ref
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.merge_commit_sha || github.ref }}
token: ${{ steps.gh-app-token.outputs.token }}

# A dispatched branch can move after detect ran; build only the commit it checked.
- name: Check the commit
env:
DETECTED: ${{ needs.detect.outputs.sha }}
run: |
HEAD_SHA=$(git rev-parse HEAD)
if [[ "$HEAD_SHA" != "$DETECTED" ]]; then
echo "::error::checked out $HEAD_SHA, but detect checked $DETECTED; re-run all jobs"
exit 1
fi

- name: Setup Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
Expand All @@ -153,11 +287,11 @@ jobs:
run: yarn install --immutable

- name: Build package
run: yarn build --filter=@openzeppelin/${{ steps.pkg.outputs.name }}
run: yarn build --filter=@openzeppelin/${{ needs.detect.outputs.name }}

- name: Create and push tag
env:
TAG: ${{ steps.pkg.outputs.name }}/v${{ steps.pkg.outputs.version }}
TAG: ${{ needs.detect.outputs.name }}/v${{ needs.detect.outputs.version }}
run: |
if git ls-remote --tags --exit-code origin "refs/tags/$TAG" >/dev/null; then
echo "tag $TAG already on origin, leaving it in place"
Expand All @@ -166,13 +300,75 @@ jobs:
git push origin "$TAG"
fi
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved

- name: Download the release binaries
if: needs.detect.outputs.name == 'compact-linter'
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
path: dist
pattern: compact-lint-*
merge-multiple: true

# Asset names only: the installed package looks each digest up by the name
# it downloads.
- name: Write the checksums
if: needs.detect.outputs.name == 'compact-linter'
working-directory: dist
run: |
sha256sum compact-lint-* > checksums.txt
cat checksums.txt

# The npm package downloads these assets on first run, so the release has
# to carry them before the package reaches npm.
- name: Create the GitHub release
if: needs.detect.outputs.name == 'compact-linter'
env:
GH_TOKEN: ${{ steps.gh-app-token.outputs.token }}
TAG: ${{ needs.detect.outputs.name }}/v${{ needs.detect.outputs.version }}
VERSION: ${{ needs.detect.outputs.version }}
DIST_TAG: ${{ needs.detect.outputs.dist_tag }}
run: |
NOTES=$(awk -v v="$VERSION" '
$0 ~ "^## " v "( |$)" { found = 1; next }
found && /^## / { exit }
found { print }
' packages/linter/CHANGELOG.md)
if [[ -z "${NOTES//[[:space:]]/}" ]]; then
NOTES="$TAG"
fi
if gh release view "$TAG" >/dev/null 2>&1; then
# A re-run keeps the published assets and ships their checksums.
ASSETS=$(gh release view "$TAG" --json assets --jq '.assets[].name')
for NAME in checksums.txt $(cd dist && ls compact-lint-*); do
if ! grep -qx "$NAME" <<< "$ASSETS"; then
echo "::error::release $TAG has no $NAME; delete the release and re-run"
exit 1
fi
done
gh release download "$TAG" --pattern checksums.txt --dir dist --clobber
else
ARGS=()
if [[ "$DIST_TAG" == "beta" ]]; then
ARGS+=(--prerelease)
fi
gh release create "$TAG" dist/* \
--title "compact-linter v$VERSION" \
--notes "$NOTES" \
"${ARGS[@]}"
fi

# The launcher verifies a download against the digests it was published with,
# so a release asset replaced later fails the check.
- name: Add the checksums to the package
if: needs.detect.outputs.name == 'compact-linter'
run: cp dist/checksums.txt packages/linter/checksums.txt

# Anything but a clean 200 or 404 fails the run, so a flaky registry can
# never read as "new package" and quietly downgrade an existing package
# from OIDC to token auth.
- name: Check whether the package is already on npm
id: registry
env:
PKG: ${{ steps.pkg.outputs.name }}
PKG: ${{ needs.detect.outputs.name }}
run: |
if ! STATUS=$(curl -sS -o /dev/null -w '%{http_code}' \
--retry 3 --retry-all-errors --max-time 30 \
Expand All @@ -194,9 +390,9 @@ jobs:
# .yarnrc.yml or an .npmrc that could be committed or cached.
- name: Publish to npm
env:
PKG: ${{ steps.pkg.outputs.name }}
DIR: ${{ steps.pkg.outputs.dir }}
DIST_TAG: ${{ steps.pkg.outputs.dist_tag }}
PKG: ${{ needs.detect.outputs.name }}
DIR: ${{ needs.detect.outputs.dir }}
DIST_TAG: ${{ needs.detect.outputs.dist_tag }}
FIRST_PUBLISH: ${{ steps.registry.outputs.first_publish }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
Expand Down
40 changes: 40 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ on:
- compact-builder
- compact-cli
- compact-deployer
- compact-linter
- compact-simulator
version_bump:
description: "Version bump type (pre* strategies are beta-only)"
Expand Down Expand Up @@ -88,6 +89,9 @@ jobs:
"compact-deployer")
echo "dir=deployer" >> $GITHUB_OUTPUT
;;
"compact-linter")
echo "dir=linter" >> $GITHUB_OUTPUT
;;
"compact-simulator")
echo "dir=simulator" >> $GITHUB_OUTPUT
;;
Expand All @@ -96,6 +100,15 @@ jobs:
- name: Setup Environment
uses: ./.github/actions/setup

# compact-linter's version lives in the crate too, and bumping it there
# rewrites Cargo.lock.
- name: Install the pinned toolchain
if: inputs.package == 'compact-linter'
run: |
CHANNEL=$(grep -m1 '^channel' rust-toolchain.toml | cut -d'"' -f2)
rustup toolchain install "$CHANNEL" --profile minimal
rustup show active-toolchain

- name: Run tests for package
run: yarn test --filter=@openzeppelin/${{ inputs.package }}

Expand Down Expand Up @@ -133,6 +146,20 @@ jobs:
echo "- npm dist-tag: $DIST_TAG"
} >> $GITHUB_STEP_SUMMARY

- name: Sync the crate version
if: inputs.package == 'compact-linter'
env:
NEW_VERSION: ${{ steps.version.outputs.new }}
run: |
sed -i "0,/^version = .*/s//version = \"$NEW_VERSION\"/" crates/compact-lint/Cargo.toml
# Resolving the workspace rewrites the crate's own Cargo.lock entry.
cargo metadata --format-version 1 > /tmp/cargo-metadata.json
ACTUAL=$(node -p "JSON.parse(require('fs').readFileSync('/tmp/cargo-metadata.json','utf8')).packages.find((p) => p.name === 'compact-lint').version")
if [[ "$ACTUAL" != "$NEW_VERSION" ]]; then
echo "::error::crates/compact-lint/Cargo.toml is at $ACTUAL, expected $NEW_VERSION"
exit 1
fi

- name: Verify package contents
run: |
cd packages/${{ steps.pkg.outputs.dir }}
Expand All @@ -155,6 +182,7 @@ jobs:
fi

- name: Commit version bump
if: inputs.package != 'compact-linter'
uses: iarekylew00t/verified-bot-commit@42a042b0407248f3c0acac00c389e729e3476e86 # v2.3.5
with:
message: "release: ${{ inputs.package }} v${{ steps.version.outputs.new }}"
Expand All @@ -163,6 +191,18 @@ jobs:
files: |
packages/${{ steps.pkg.outputs.dir }}/package.json

- name: Commit version bump with the crate
if: inputs.package == 'compact-linter'
uses: iarekylew00t/verified-bot-commit@42a042b0407248f3c0acac00c389e729e3476e86 # v2.3.5
with:
message: "release: ${{ inputs.package }} v${{ steps.version.outputs.new }}"
token: ${{ steps.gh-app-token.outputs.token }}
ref: ${{ steps.version.outputs.branch }}
files: |
packages/linter/package.json
crates/compact-lint/Cargo.toml
Cargo.lock

- name: Ensure release label exists
env:
GH_TOKEN: ${{ steps.gh-app-token.outputs.token }}
Expand Down
Loading
Loading