Skip to content

feat: release v0.1.0#2

Merged
nic-6443 merged 3 commits into
mainfrom
feat/luarocks-release
May 20, 2026
Merged

feat: release v0.1.0#2
nic-6443 merged 3 commits into
mainfrom
feat/luarocks-release

Conversation

@jarvis9443
Copy link
Copy Markdown

@jarvis9443 jarvis9443 commented May 20, 2026

Add LuaRocks publishing support following lua-qjson's release flow.

This publishes the rock as api7-lua-resty-simdjson to avoid the existing lua-resty-simdjson package name on LuaRocks. The installed module path remains resty.simdjson, so users still load it with require("resty.simdjson").

The PR adds the first rockspec, a release workflow that uploads the rockspec to LuaRocks and then creates the GitHub Release, and a CI check that installs the rock locally and loads it through OpenResty.

Tests run locally:

  • luarocks --lua-version=5.1 make rockspec/api7-lua-resty-simdjson-0.1.0-1.rockspec --tree /tmp/lua-resty-simdjson-rock-local
  • eval "$(luarocks --lua-version=5.1 path --tree /tmp/lua-resty-simdjson-rock-local)"; resty -e ...
  • zsh -lic 'switch-runtime apisix && make test'

Summary by CodeRabbit

  • Chores
    • Added an automated release pipeline to publish releases to LuaRocks via manual trigger or when package specs change on main.
    • Added package metadata to make the module available on LuaRocks.
  • Tests
    • Enhanced CI to install Lua toolchain and validate the LuaRocks package installs and functions correctly.
  • New Features
    • Initial rockspec added for v0.1.0 packaging and distribution.

Review Change Stack

Copilot AI review requested due to automatic review settings May 20, 2026 05:42
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 20, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7a278e60-1dca-4ff0-a139-bfcfcb7ca0f9

📥 Commits

Reviewing files that changed from the base of the PR and between 0e139fd and 419762b.

📒 Files selected for processing (1)
  • .github/workflows/release.yml

📝 Walkthrough

Walkthrough

Adds a new rockspec for api7-lua-resty-simdjson, validates installing that rockspec in CI, and introduces a GitHub Actions release workflow that computes a release version, verifies the matching rockspec, creates a GitHub Release, and uploads the rockspec to LuaRocks.

Changes

LuaRocks Package Distribution

Layer / File(s) Summary
LuaRocks rockspec definition
rockspec/api7-lua-resty-simdjson-0.1.0-1.rockspec
Defines package metadata, GitHub source tag, build command, copies Lua FFI bindings, selects native library filename per platform, and installs the shared library to LIBDIR.
Rockspec CI validation
.github/workflows/tests.yml
Adds Lua 5.1 and LuaRocks system packages to CI and a step that finds the versioned rockspec, installs it into a temporary LuaRocks tree, configures paths, and asserts decode/encode by resty.simdjson.
Release workflow and setup
.github/workflows/release.yml
Adds Release workflow with workflow_dispatch (required version) and push on rockspec/**, sets permissions, checks out without persisted credentials, installs Lua 5.1.5, pins LuaRocks, and installs dkjson.
Release version extraction
.github/workflows/release.yml
Shell logic validates dispatch input against semver or parses feat: release vX.Y.Z[-prerelease] commit messages; exports normalized version, version_without_v, and is_prerelease.
Rockspec verification
.github/workflows/release.yml
Inline Python locates matching .rockspec files for the computed version, selects the highest numeric-suffix match, fails if none found, and exports the chosen path.
Token guard, GitHub Release, and LuaRocks upload
.github/workflows/release.yml
Exits when LUAROCKS_TOKEN is missing, creates a GitHub Release via softprops/action-gh-release using computed outputs, writes $HOME/.luarocks/upload_config.lua with the token/server config, and runs luarocks upload for the selected rockspec.

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 6
✅ Passed checks (6 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: release v0.1.0' directly summarizes the main change—adding release automation and publishing the first version to LuaRocks.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
E2e Test Quality Review ✅ Passed PR adds proper E2E test for LuaRocks publishing workflow, testing rockspec validation through OpenResty module loading. Uses real services, direct relevance to objectives, no unrelated changes.
Security Check ✅ Passed No security vulnerabilities found. Token is accessed via environment variable, not logged, written to restricted file (mode 600), and GitHub Actions masks secrets automatically.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/luarocks-release

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
.github/workflows/release.yml (1)

113-131: ⚡ Quick win

Publish to GitHub only after LuaRocks upload succeeds.

Current order can leave a GitHub Release created even when luarocks upload fails, producing partial release state.

🔧 Suggested change
-      - name: Create Release
-        uses: softprops/action-gh-release@v2
-        with:
-          tag_name: ${{ steps.release_env.outputs.version }}
-          name: ${{ steps.release_env.outputs.version }}
-          draft: false
-          prerelease: ${{ steps.release_env.outputs.is_prerelease }}
-
       - name: Upload to LuaRocks
         env:
           LUAROCKS_TOKEN: ${{ secrets.LUAROCKS_TOKEN }}
           ROCKSPEC_FILE: ${{ steps.verify_rockspec.outputs.rockspec_file }}
         shell: bash
         run: |
           mkdir -p "$HOME/.luarocks"
           chmod 700 "$HOME/.luarocks"
           lua -e 'local token = os.getenv("LUAROCKS_TOKEN"); assert(token and token ~= "", "missing LUAROCKS_TOKEN"); local f = assert(io.open(os.getenv("HOME") .. "/.luarocks/upload_config.lua", "w")); f:write(("key = %q\n"):format(token)); f:write("server = \"https://luarocks.org\"\nversion = \"1.0\"\n"); f:close()'
           chmod 600 "$HOME/.luarocks/upload_config.lua"
           luarocks upload "$ROCKSPEC_FILE"
+
+      - name: Create Release
+        uses: softprops/action-gh-release@v2
+        with:
+          tag_name: ${{ steps.release_env.outputs.version }}
+          name: ${{ steps.release_env.outputs.version }}
+          draft: false
+          prerelease: ${{ steps.release_env.outputs.is_prerelease }}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/release.yml around lines 113 - 131, The workflow currently
creates the GitHub Release in the "Create Release" step before running "Upload
to LuaRocks", which can leave a release when the LUArocks upload fails; fix it
by reordering the steps so the "Upload to LuaRocks" step runs before the "Create
Release" step (keep the same step names and inputs like tag_name/name using
steps.release_env.outputs.version and prerelease using
steps.release_env.outputs.is_prerelease), ensuring the
softprops/action-gh-release@v2 invocation only runs after luarocks upload
completes successfully.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/release.yml:
- Around line 9-14: The push-triggered workflow currently hard-fails when the
head commit title doesn't match "feat: release ..." for pushes to branch "main"
with path "rockspec/**"; change the logic so the release-only checks are
conditional/skippable instead of failing the whole job: replace any strict
assertion or failing step that enforces the commit-title pattern with a job- or
step-level conditional (e.g., an if: that checks
contains(github.event.head_commit.message, 'feat: release') or similar) so
non-release commits simply skip the release steps; apply the same change to the
other occurrence that uses the same commit-title gating.
- Line 24: Update all GitHub Action references in the workflow to pinned commit
SHAs instead of floating tags: replace actions/checkout@v4,
actions/setup-node@[...] (the setup-node reference),
actions/upload-artifact@[...] (the upload-artifact reference), and any other
action using `@vX` tags with their specific commit SHAs from their upstream repos;
fetch the canonical commit SHA for each action (from the action's GitHub repo),
substitute the `@tag` with @<full-commit-sha>, and ensure the workflow still
passes — e.g., update the usages for actions/checkout, actions/setup-node,
actions/upload-artifact and the release-related action to pinned SHAs.

---

Nitpick comments:
In @.github/workflows/release.yml:
- Around line 113-131: The workflow currently creates the GitHub Release in the
"Create Release" step before running "Upload to LuaRocks", which can leave a
release when the LUArocks upload fails; fix it by reordering the steps so the
"Upload to LuaRocks" step runs before the "Create Release" step (keep the same
step names and inputs like tag_name/name using steps.release_env.outputs.version
and prerelease using steps.release_env.outputs.is_prerelease), ensuring the
softprops/action-gh-release@v2 invocation only runs after luarocks upload
completes successfully.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 04b5c012-cfc6-40b7-b18a-96871527c3c0

📥 Commits

Reviewing files that changed from the base of the PR and between 6e35b1b and f25a993.

📒 Files selected for processing (3)
  • .github/workflows/release.yml
  • .github/workflows/tests.yml
  • rockspec/lua-resty-simdjson-0.1.0-1.rockspec

Comment thread .github/workflows/release.yml
Comment thread .github/workflows/release.yml Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds LuaRocks packaging + automated release flow for lua-resty-simdjson, and extends CI to validate the rock installs and loads under OpenResty.

Changes:

  • Add initial lua-resty-simdjson rockspec for v0.1.0.
  • Add a GitHub Actions release workflow to create a GitHub release tag and upload the rockspec to LuaRocks.
  • Extend CI to build/install the rock locally and sanity-check require("resty.simdjson") under resty.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
rockspec/lua-resty-simdjson-0.1.0-1.rockspec Introduces the first rockspec and custom make build + install logic.
.github/workflows/tests.yml Installs LuaRocks and adds a job step to build/install the rock and load it in OpenResty.
.github/workflows/release.yml Adds a release workflow to create vX.Y.Z GitHub releases and upload the rockspec to LuaRocks.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread rockspec/api7-lua-resty-simdjson-0.1.0-1.rockspec
Comment thread .github/workflows/tests.yml
Comment thread .github/workflows/release.yml
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.github/workflows/release.yml (1)

114-134: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Create the Git tag/release before uploading the rockspec.

Upload to LuaRocks runs before Create Release. If release/tag creation fails, LuaRocks can publish a rockspec that points to a non-existent source.tag, resulting in broken installs.

🔧 Minimal fix (reorder steps)
-      - name: Upload to LuaRocks
-        env:
-          LUAROCKS_TOKEN: ${{ secrets.LUAROCKS_TOKEN }}
-          ROCKSPEC_FILE: ${{ steps.verify_rockspec.outputs.rockspec_file }}
-        shell: bash
-        run: |
-          mkdir -p "$HOME/.luarocks"
-          chmod 700 "$HOME/.luarocks"
-          touch "$HOME/.luarocks/upload_config.lua"
-          chmod 600 "$HOME/.luarocks/upload_config.lua"
-          lua -e 'local token = os.getenv("LUAROCKS_TOKEN"); assert(token and token ~= "", "missing LUAROCKS_TOKEN"); local f = assert(io.open(os.getenv("HOME") .. "/.luarocks/upload_config.lua", "w")); assert(f:write(("key = %q\n"):format(token))); assert(f:write("server = \"https://luarocks.org\"\nversion = \"1.0\"\n")); assert(f:close())'
-          luarocks upload "$ROCKSPEC_FILE"
-
       - name: Create Release
         uses: softprops/action-gh-release@3bb12739c298aeb8a4eeaf626c5b8d85266b0e65
         with:
           tag_name: ${{ steps.release_env.outputs.version }}
           name: ${{ steps.release_env.outputs.version }}
           draft: false
           prerelease: ${{ steps.release_env.outputs.is_prerelease }}
+
+      - name: Upload to LuaRocks
+        env:
+          LUAROCKS_TOKEN: ${{ secrets.LUAROCKS_TOKEN }}
+          ROCKSPEC_FILE: ${{ steps.verify_rockspec.outputs.rockspec_file }}
+        shell: bash
+        run: |
+          mkdir -p "$HOME/.luarocks"
+          chmod 700 "$HOME/.luarocks"
+          touch "$HOME/.luarocks/upload_config.lua"
+          chmod 600 "$HOME/.luarocks/upload_config.lua"
+          lua -e 'local token = os.getenv("LUAROCKS_TOKEN"); assert(token and token ~= "", "missing LUAROCKS_TOKEN"); local f = assert(io.open(os.getenv("HOME") .. "/.luarocks/upload_config.lua", "w")); assert(f:write(("key = %q\n"):format(token))); assert(f:write("server = \"https://luarocks.org\"\nversion = \"1.0\"\n")); assert(f:close())'
+          luarocks upload "$ROCKSPEC_FILE"
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/release.yml around lines 114 - 134, The workflow uploads
the rockspec before the GitHub release/tag is created (step "Upload to LuaRocks"
precedes "Create Release"), risking a rockspec pointing to a non-existent
source.tag; fix by reordering the steps so "Create Release" runs before "Upload
to LuaRocks" (or otherwise ensure the upload step depends on successful
tag/release creation) so the release/tag exists prior to calling luarocks
upload.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In @.github/workflows/release.yml:
- Around line 114-134: The workflow uploads the rockspec before the GitHub
release/tag is created (step "Upload to LuaRocks" precedes "Create Release"),
risking a rockspec pointing to a non-existent source.tag; fix by reordering the
steps so "Create Release" runs before "Upload to LuaRocks" (or otherwise ensure
the upload step depends on successful tag/release creation) so the release/tag
exists prior to calling luarocks upload.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 6d23ea72-b7b0-4449-8242-2b380712892c

📥 Commits

Reviewing files that changed from the base of the PR and between f25a993 and 0e139fd.

📒 Files selected for processing (3)
  • .github/workflows/release.yml
  • .github/workflows/tests.yml
  • rockspec/api7-lua-resty-simdjson-0.1.0-1.rockspec

Copilot AI review requested due to automatic review settings May 20, 2026 05:57
@jarvis9443
Copy link
Copy Markdown
Author

Adjusted the release order in 419762b so the GitHub Release/tag is created before luarocks upload. That keeps the rockspec source tag valid when LuaRocks accepts the upload.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

Comment thread rockspec/api7-lua-resty-simdjson-0.1.0-1.rockspec
Comment thread .github/workflows/release.yml
Comment thread .github/workflows/release.yml
@nic-6443 nic-6443 merged commit e772066 into main May 20, 2026
11 checks passed
@nic-6443 nic-6443 deleted the feat/luarocks-release branch May 20, 2026 06:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants