diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 8a3a314..9a2cbb9 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -4,7 +4,7 @@ name: Publish to LuaRocks on: push: tags: - - "v*.*.*" # Only trigger on semver tags (e.g., v1.0.0) + - "v*.*.*" workflow_dispatch: jobs: @@ -27,8 +27,6 @@ jobs: - name: Install Lux uses: lumen-oss/gh-actions-lux@v1 with: - # Using v0.28.0 for publish (consistent with all workflows) - # The busted/penlight dependency issues are resolved in v0.28.0 version: 0.28.0 - name: Install LuaRocks (for validation) @@ -55,10 +53,8 @@ jobs: fi echo "✓ Rockspec valid: $ROCKSPEC" - rm -f "$ROCKSPEC" # Clean up, lx upload will regenerate + rm -f "$ROCKSPEC" - # Sole LuaRocks publication point - uses lx upload which has built-in JSON - # handling and doesn't require system Lua JSON libraries - name: Upload to LuaRocks run: lx --verbose --lua-version 5.1 upload env: diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index 5d0fa1a..e8ed37e 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -11,76 +11,154 @@ permissions: pull-requests: write jobs: - release: - name: Release + release-please: + name: Release Please runs-on: ubuntu-24.04 + outputs: + release_created: ${{ steps.release.outputs.release_created }} + tag_name: ${{ steps.release.outputs.tag_name }} steps: - uses: googleapis/release-please-action@v4 id: release with: token: ${{ secrets.PAT }} - # release-type: simple is configured in release-please-config.json + build-release: + name: Build Release Artifacts + needs: release-please + if: ${{ needs.release-please.outputs.release_created == 'true' || needs.release-please.outputs.release_created == true }} + strategy: + matrix: + include: + - os: ubuntu-24.04 + name: linux-x86_64 + target: linux + - os: macos-latest + name: macos-arm64 + target: macos + - os: macos-13 + name: macos-x86_64 + target: macos + - os: windows-latest + name: windows-x86_64 + target: windows + runs-on: ${{ matrix.os }} + defaults: + run: + shell: ${{ matrix.target == 'windows' && 'msys2 {0}' || 'bash' }} + steps: - name: Checkout repository - if: ${{ steps.release.outputs.release_created }} uses: actions/checkout@v4 - - name: Install System Dependencies - if: ${{ steps.release.outputs.release_created }} + - name: Setup MSYS2 (Windows) + if: matrix.target == 'windows' + uses: msys2/setup-msys2@v2 + with: + msystem: UCRT64 + update: true + install: >- + git + make + mingw-w64-ucrt-x86_64-gcc + mingw-w64-ucrt-x86_64-cmake + mingw-w64-ucrt-x86_64-lua + mingw-w64-ucrt-x86_64-luarocks + + - name: Install System Dependencies (Linux) + if: matrix.target == 'linux' run: | sudo apt-get update -qq sudo apt-get install -y -qq build-essential cmake luarocks lua5.4 liblua5.4-dev + - name: Install System Dependencies (macOS) + if: matrix.target == 'macos' + run: | + brew install cmake luarocks lua@5.4 + - name: Install Lux - if: ${{ steps.release.outputs.release_created }} uses: lumen-oss/gh-actions-lux@v1 with: - # Using v0.28.0 for consistency with all workflows (busted/penlight issues resolved) version: 0.28.0 - name: Install just - if: ${{ steps.release.outputs.release_created }} run: | - mkdir -p /tmp/just - curl -L https://github.com/casey/just/releases/download/1.48.1/just-1.48.1-x86_64-unknown-linux-musl.tar.gz -o /tmp/just/just.tar.gz - tar -xzf /tmp/just/just.tar.gz -C /tmp/just - sudo mv /tmp/just/just /usr/local/bin/ - rm -rf /tmp/just + if [ "${{ matrix.target }}" = "linux" ]; then + mkdir -p /tmp/just + curl -L https://github.com/casey/just/releases/download/1.48.1/just-1.48.1-x86_64-unknown-linux-musl.tar.gz -o /tmp/just/just.tar.gz + tar -xzf /tmp/just/just.tar.gz -C /tmp/just + sudo mv /tmp/just/just /usr/local/bin/ + rm -rf /tmp/just + elif [ "${{ matrix.target }}" = "macos" ]; then + brew install just + else + mkdir -p /tmp/just + curl -L https://github.com/casey/just/releases/download/1.48.1/just-1.48.1-x86_64-pc-windows-msvc.zip -o /tmp/just/just.zip + unzip /tmp/just/just.zip -d /tmp/just + mv /tmp/just/just.exe /usr/bin/ + rm -rf /tmp/just + fi - name: Build Executable - if: ${{ steps.release.outputs.release_created }} env: LUA_VERSION: "5.4" - LUA_PREFIX: "/usr" - LUA_LIB: "/usr/lib/x86_64-linux-gnu/liblua5.4.a" run: | - just build - sha256sum roda > roda.sha256 + if [ "${{ matrix.target }}" = "linux" ]; then + export LUA_PREFIX="/usr" + export LUA_LIB="/usr/lib/x86_64-linux-gnu/liblua5.4.a" + just build + elif [ "${{ matrix.target }}" = "macos" ]; then + export LUA_PREFIX="$(brew --prefix lua@5.4)" + export LUA_LIB="$LUA_PREFIX/lib/liblua.a" + export MACOSX_DEPLOYMENT_TARGET="11.0" + just build + else + export LUA_PREFIX="/ucrt64" + export LUA_LIB="/ucrt64/lib/liblua.a" + export LUA_INCLUDE="/ucrt64/include" + just --shell bash build + fi + + - name: Package Artifacts + run: | + mkdir -p staging + if [ "${{ matrix.target }}" = "windows" ]; then + cp roda.exe staging/ 2>/dev/null || cp roda staging/roda.exe + cp LICENSE README.md staging/ 2>/dev/null || true + cd staging + zip -r ../roda-${{ matrix.name }}.zip * + cd .. + sha256sum roda-${{ matrix.name }}.zip > roda-${{ matrix.name }}.zip.sha256 + else + cp roda staging/ + cp LICENSE README.md staging/ 2>/dev/null || true + cd staging + tar -czvf ../roda-${{ matrix.name }}.tar.gz * + cd .. + if command -v sha256sum >/dev/null 2>&1; then + sha256sum roda-${{ matrix.name }}.tar.gz > roda-${{ matrix.name }}.tar.gz.sha256 + else + shasum -a 256 roda-${{ matrix.name }}.tar.gz > roda-${{ matrix.name }}.tar.gz.sha256 + fi + fi - name: Generate Rockspec - if: ${{ steps.release.outputs.release_created }} + if: matrix.target == 'linux' run: | lx generate-rockspec - name: Validate Rockspec - if: ${{ steps.release.outputs.release_created }} + if: matrix.target == 'linux' run: | luarocks lint *.rockspec - name: Upload Release Artifacts - if: ${{ steps.release.outputs.release_created }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - gh release upload ${{ steps.release.outputs.tag_name }} roda roda.sha256 *.rockspec - - # LuaRocks publication moved to publish.yml workflow (tag-triggered) - # to avoid dependency issues and simplify debugging. The publish.yml - # workflow uses lx upload which has built-in JSON handling and doesn't - # require system Lua JSON libraries like luarocks upload does. - # - name: Publish to LuaRocks - # if: ${{ steps.release.outputs.release_created }} - # env: - # LUAROCKS_API_KEY: ${{ secrets.LUAROCKS_API_KEY }} - # run: | - # luarocks upload *.rockspec --api-key=${LUAROCKS_API_KEY} + if [ "${{ matrix.target }}" = "linux" ]; then + gh release upload ${{ needs.release-please.outputs.tag_name }} roda-${{ matrix.name }}.tar.gz roda-${{ matrix.name }}.tar.gz.sha256 *.rockspec --clobber + elif [ "${{ matrix.target }}" = "windows" ]; then + gh release upload ${{ needs.release-please.outputs.tag_name }} roda-${{ matrix.name }}.zip roda-${{ matrix.name }}.zip.sha256 --clobber + else + gh release upload ${{ needs.release-please.outputs.tag_name }} roda-${{ matrix.name }}.tar.gz roda-${{ matrix.name }}.tar.gz.sha256 --clobber + fi \ No newline at end of file diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 8de3246..4049d6c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -17,10 +17,6 @@ jobs: - name: Install Lux uses: lumen-oss/gh-actions-lux@v1 with: - # Using v0.28.0 (busted/penlight dependency issues resolved in lux-lib 0.8.0+) - # Previously pinned to v0.18.8 due to busted/penlight transitive dependency issues - # in newer versions (see lumen-oss/lux#722) - # All workflows now use v0.28.0 consistently version: 0.28.0 - name: Install system dependencies @@ -49,7 +45,6 @@ jobs: - name: Install Lux uses: lumen-oss/gh-actions-lux@v1 with: - # See comment in test job above for version upgrade rationale version: 0.28.0 - name: Install just