From bf58fb7e26e7cbce4b4dbf6854540987a55f6bd8 Mon Sep 17 00:00:00 2001 From: Caleb Maclennan Date: Fri, 22 Apr 2022 10:31:57 +0300 Subject: [PATCH 1/3] ci: Reuse deploy workflow from lunarmodules --- .github/workflows/deploy.yml | 81 ++++++++++-------------------------- 1 file changed, 22 insertions(+), 59 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 8ad4a33..6cc84c8 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,71 +1,34 @@ name: Deploy -on: - push: - paths: - - rockspecs/*.rockspec +on: [ push, workflow_dispatch ] jobs: affected: - runs-on: ubuntu-20.04 - outputs: - rockspecs: '["${{ steps.changed-files.outputs.all_modified_files }}"]' - steps: - - name: Checkout - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - id: changed-files - uses: tj-actions/changed-files@v1.0.2 - with: - files: rockspecs/*.rockspec - separator: '", "' + uses: lunarmodules/.github/.github/workflows/list_affected_rockspecs.yml@main build: needs: affected if: ${{ needs.affected.outputs.rockspecs }} - strategy: - fail-fast: false - matrix: - # Upstream Issue: https://github.com/leafo/gh-actions-luarocks/issues/8 - luaVersion: ["5.4", "5.3", "5.2", "5.1"] #, "luajit", "luajit-openresty"] - # Upstream Issue: https://github.com/leafo/gh-actions-luarocks/issues/8 - luarocksVersion: ["3.1.3"] # , "2.4.2"] - rockspec: ${{ fromJSON(needs.affected.outputs.rockspecs) }} - runs-on: ubuntu-20.04 - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Setup ‘lua’ - uses: leafo/gh-actions-lua@v8 - with: - luaVersion: ${{ matrix.luaVersion }} - - name: Setup ‘luarocks’ - uses: leafo/gh-actions-luarocks@v4 - with: - luarocksVersion: ${{ matrix.luarocksVersion }} - - name: Confirm rockspec builds - run: | - luarocks --lua-version ${{ matrix.luaVersion }} --local build -- ${{ matrix.rockspec }} + uses: lunarmodules/.github/.github/workflows/test_build_rock.yml@main + with: + rockspecs: ${{ needs.affected.outputs.rockspecs }} upload: - needs: [affected, build] - if: ${{ needs.affected.outputs.rockspecs && github.ref == 'refs/heads/master' && github.repository == 'sile-typesetter/cassowary.lua' }} - strategy: - fail-fast: false - matrix: - rockspec: ${{ fromJSON(needs.affected.outputs.rockspecs) }} - runs-on: ubuntu-20.04 - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Setup ‘lua’ - uses: leafo/gh-actions-lua@v8 - - name: Setup ‘luarocks’ - uses: leafo/gh-actions-luarocks@v4 - - name: Setup dependencies - run: | - luarocks install dkjson - - run: | - luarocks upload --force --api-key ${{ secrets.LUAROCKS_APIKEY }} -- ${{ matrix.rockspec }} + needs: [ affected, build ] + # Only run upload if: + # 1. Some rockspecs were changed — this implies the commit changing the rockspec is the same one that gets tagged + # 2. The current commit is either tagged or on the default branch (the workflow will upload dev/scm rockspecs any + # time they are touched, tagged ones whenever the edited rockspec and tag match) + # 3. We are on the canonical repository (no uploads from forks) + if: >- + ${{ + github.repository == 'sile-typesetter/cassowary.lua' && + ( github.ref_name == 'master' || startsWith(github.ref, 'refs/tags/') ) && + needs.affected.outputs.rockspecs + }} + uses: lunarmodules/.github/.github/workflows/upload_to_luarocks.yml@main + with: + rockspecs: ${{ needs.affected.outputs.rockspecs }} + secrets: + apikey: ${{ secrets.LUAROCKS_APIKEY }} From 1427eee4893b97964e229f206ff5527b05cc5d55 Mon Sep 17 00:00:00 2001 From: Caleb Maclennan Date: Fri, 22 Apr 2022 10:32:20 +0300 Subject: [PATCH 2/3] ci: Cleanup and normalize workflow systax --- .github/workflows/busted.yml | 10 +++++----- .github/workflows/luacheck.yml | 2 +- .github/workflows/luarocks.yml | 32 ++++++++++++++++++-------------- 3 files changed, 24 insertions(+), 20 deletions(-) diff --git a/.github/workflows/busted.yml b/.github/workflows/busted.yml index 05b3808..0968dc6 100644 --- a/.github/workflows/busted.yml +++ b/.github/workflows/busted.yml @@ -1,6 +1,6 @@ name: Busted -on: [push, pull_request] +on: [ push, pull_request ] jobs: @@ -8,14 +8,14 @@ jobs: strategy: fail-fast: false matrix: - luaVersion: ["5.4", "5.3", "5.2", "5.1", "luajit", "luajit-openresty"] - penlightVersion: ["1.9.2", "1.8.0", "1.6.0", "1.5.4"] + luaVersion: [ "5.4", "5.3", "5.2", "5.1", "luajit", "luajit-openresty" ] + penlightVersion: [ "1.9.2", "1.8.0", "1.6.0", "1.5.4" ] runs-on: ubuntu-20.04 steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Setup ‘lua’ - uses: leafo/gh-actions-lua@v8 + uses: leafo/gh-actions-lua@v9 with: luaVersion: ${{ matrix.luaVersion }} - name: Setup ‘luarocks’ diff --git a/.github/workflows/luacheck.yml b/.github/workflows/luacheck.yml index 2f20456..2e2def7 100644 --- a/.github/workflows/luacheck.yml +++ b/.github/workflows/luacheck.yml @@ -1,6 +1,6 @@ name: Luacheck -on: [push, pull_request] +on: [ push, pull_request ] jobs: diff --git a/.github/workflows/luarocks.yml b/.github/workflows/luarocks.yml index ca4d981..67e301b 100644 --- a/.github/workflows/luarocks.yml +++ b/.github/workflows/luarocks.yml @@ -1,21 +1,25 @@ name: Luarocks -on: [push, pull_request] +on: [ push, pull_request ] jobs: - luarocks: + # More extensive testing gets done when a rockspec is touched, this just + # makes sure expected files didn't shift without updating the rockspec + build: + name: Test bulid on Linux runs-on: ubuntu-20.04 steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Setup ‘lua’ - uses: leafo/gh-actions-lua@v8 - - name: Setup ‘luarocks’ - uses: leafo/gh-actions-luarocks@v4 - - name: Luarocks lint - run: | - luarocks --local lint -- cassowary-scm-0.rockspec - - name: Luarocks make - run: | - luarocks --local make -- cassowary-scm-0.rockspec + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Setup ‘lua’ + uses: leafo/gh-actions-lua@v9 + - name: Setup ‘luarocks’ + uses: leafo/gh-actions-luarocks@v4 + - name: Luarocks lint + run: | + luarocks lint -- cassowary-scm-0.rockspec + - name: Luarocks make + run: | + luarocks make -- cassowary-scm-0.rockspec From 443387a9a9d1b1e6f97a6b1b73b20d9c286f1d10 Mon Sep 17 00:00:00 2001 From: Caleb Maclennan Date: Fri, 22 Apr 2022 10:53:21 +0300 Subject: [PATCH 3/3] ci: Add latest Penlight to testing matrix, drop unnecessary versions This now only includes the newest, the oldest supported, and interim releases with significant (non whitespace) changes to the pl.class() system which is the main thing relevant to this project. --- .github/workflows/busted.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/busted.yml b/.github/workflows/busted.yml index 0968dc6..85ccef6 100644 --- a/.github/workflows/busted.yml +++ b/.github/workflows/busted.yml @@ -9,7 +9,7 @@ jobs: fail-fast: false matrix: luaVersion: [ "5.4", "5.3", "5.2", "5.1", "luajit", "luajit-openresty" ] - penlightVersion: [ "1.9.2", "1.8.0", "1.6.0", "1.5.4" ] + penlightVersion: [ "1.12.0", "1.9.2", "1.8.0", "1.6.0", "1.5.4" ] runs-on: ubuntu-20.04 steps: - name: Checkout