From 844165ff89c0ec7bb50ac65ce010200dba1c8d89 Mon Sep 17 00:00:00 2001 From: Caleb Maclennan Date: Sat, 19 Mar 2022 18:11:43 +0300 Subject: [PATCH 1/7] ci: Drop obsolete Travis configs --- .travis.yml | 54 ----------------------------------------------------- 1 file changed, 54 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index fce8a96..0000000 --- a/.travis.yml +++ /dev/null @@ -1,54 +0,0 @@ -language: erlang - -env: - global: - - LUAROCKS_BASE=luarocks-2.0.13 - matrix: - - LUA=lua5.1 LUA_DEV=liblua5.1-dev LUA_VER=5.1 LUA_SFX=5.1 LUA_INCDIR=/usr/include/lua5.1 - - LUA=lua5.2 LUA_DEV=liblua5.2-dev LUA_VER=5.2 LUA_SFX=5.2 LUA_INCDIR=/usr/include/lua5.2 - - LUA=luajit LUA_DEV=libluajit-5.1-dev LUA_VER=5.1 LUA_SFX=jit LUA_INCDIR=/usr/include/luajit-2.0 - -branches: - only: - - master - -before_install: - - if [ $LUA = "luajit" ]; then - sudo add-apt-repository ppa:mwild1/ppa -y && sudo apt-get update -y; - fi - - sudo apt-get install $LUA - - sudo apt-get install $LUA_DEV - - lua$LUA_SFX -v - # Install a recent luarocks release - - wget http://luarocks.org/releases/$LUAROCKS_BASE.tar.gz - - tar zxvpf $LUAROCKS_BASE.tar.gz - - cd $LUAROCKS_BASE - - ./configure - --lua-version=$LUA_VER --lua-suffix=$LUA_SFX --with-lua-include="$LUA_INCDIR" - - sudo make - - sudo make install - - cd $TRAVIS_BUILD_DIR - - -install: - - export DEBUG=DEBUG - - sudo -E luarocks make luasocket-scm-0.rockspec - -script: - - cd test - - lua$LUA_SFX hello.lua - - lua$LUA_SFX testsrvr.lua > /dev/null & - - lua$LUA_SFX testclnt.lua - - lua$LUA_SFX stufftest.lua - - lua$LUA_SFX excepttest.lua - - lua$LUA_SFX test_bind.lua - - lua$LUA_SFX test_getaddrinfo.lua - - lua$LUA_SFX ltn12test.lua - - lua$LUA_SFX mimetest.lua - - lua$LUA_SFX urltest.lua - - lua$LUA_SFX test_socket_error.lua - -notifications: - email: - on_success: change - on_failure: always From 2cc6f8a55c45ec9b5ad165c150259060d4d70a82 Mon Sep 17 00:00:00 2001 From: Caleb Maclennan Date: Sat, 19 Mar 2022 20:55:11 +0300 Subject: [PATCH 2/7] ci: Add workflow to confirm build completes --- .github/workflows/build.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..8265bb1 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,24 @@ +name: Check build + +on: [ push, pull_request ] + +jobs: + build: + name: Check build + strategy: + fail-fast: false + matrix: + luaVersion: [ "5.4", "5.3", "5.2", "5.1", "luajit", "luajit-openresty"] + runs-on: ubuntu-20.04 + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Setup ‘lua’ + uses: leafo/gh-actions-lua@v9 + with: + luaVersion: ${{ matrix.luaVersion }} + - name: Setup ‘luarocks’ + uses: leafo/gh-actions-luarocks@v4 + - name: Make with Luarocks + run: | + luarocks make --pack-binary-rock -- luasocket-scm-3.rockspec From fdd741da5cd0515e69572e564f2d57f336d2466b Mon Sep 17 00:00:00 2001 From: Caleb Maclennan Date: Sat, 19 Mar 2022 20:58:52 +0300 Subject: [PATCH 3/7] Ci: Run regression tests after successful build --- .github/workflows/build.yml | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8265bb1..64393cc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,10 +1,10 @@ -name: Check build +name: Test build on: [ push, pull_request ] jobs: build: - name: Check build + name: Test build on Linux strategy: fail-fast: false matrix: @@ -19,6 +19,23 @@ jobs: luaVersion: ${{ matrix.luaVersion }} - name: Setup ‘luarocks’ uses: leafo/gh-actions-luarocks@v4 - - name: Make with Luarocks + - name: Make and install locally run: | - luarocks make --pack-binary-rock -- luasocket-scm-3.rockspec + export DEBUG=DEBUG + luarocks --local make -- luasocket-scm-3.rockspec + - name: Run regression tests + run: | + eval $(luarocks --local path) + cd test + lua hello.lua + lua testsrvr.lua > /dev/null & + lua testclnt.lua + lua stufftest.lua + lua excepttest.lua + lua test_bind.lua + lua test_getaddrinfo.lua + lua ltn12test.lua + lua mimetest.lua + lua urltest.lua + lua test_socket_error.lua + kill %1 From 9787c17e589dc1b12c1f96e6bb391a7ff3dd5065 Mon Sep 17 00:00:00 2001 From: Caleb Maclennan Date: Sat, 19 Mar 2022 21:18:54 +0300 Subject: [PATCH 4/7] ci: Expand test matrix to cover Windows and macOS --- .github/workflows/build.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 64393cc..518de63 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,7 +9,8 @@ jobs: fail-fast: false matrix: luaVersion: [ "5.4", "5.3", "5.2", "5.1", "luajit", "luajit-openresty"] - runs-on: ubuntu-20.04 + platform: [ "ubuntu-20.04", "windows-2022", "macos-11" ] + runs-on: ${{ matrix.platform }} steps: - name: Checkout uses: actions/checkout@v3 From 52c72694c2989c38fc9df915dcb34995d1e37404 Mon Sep 17 00:00:00 2001 From: Caleb Maclennan Date: Sat, 19 Mar 2022 21:23:58 +0300 Subject: [PATCH 5/7] ci: Disable unsupported Windows and avoid duplicate runs --- .github/workflows/build.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 518de63..d22e67f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,6 +1,10 @@ name: Test build -on: [ push, pull_request ] +on: + push: + branches: + - master + pull_request: jobs: build: @@ -9,7 +13,7 @@ jobs: fail-fast: false matrix: luaVersion: [ "5.4", "5.3", "5.2", "5.1", "luajit", "luajit-openresty"] - platform: [ "ubuntu-20.04", "windows-2022", "macos-11" ] + platform: [ "ubuntu-20.04", "macos-11" ] # "windows-2022" not supported by gh-actions-lua runs-on: ${{ matrix.platform }} steps: - name: Checkout From f9e1d03f3c6c9fc59dd3b91716debc23aebf947f Mon Sep 17 00:00:00 2001 From: Caleb Maclennan Date: Sat, 19 Mar 2022 22:42:25 +0300 Subject: [PATCH 6/7] ci: Don't bother doing user-local install in ephemeral runner --- .github/workflows/build.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d22e67f..17cad49 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -24,13 +24,12 @@ jobs: luaVersion: ${{ matrix.luaVersion }} - name: Setup ‘luarocks’ uses: leafo/gh-actions-luarocks@v4 - - name: Make and install locally + - name: Make and install run: | export DEBUG=DEBUG - luarocks --local make -- luasocket-scm-3.rockspec + luarocks make -- luasocket-scm-3.rockspec - name: Run regression tests run: | - eval $(luarocks --local path) cd test lua hello.lua lua testsrvr.lua > /dev/null & From bac0b8dc274b46cf37bea02aa7edca8f1011a4b8 Mon Sep 17 00:00:00 2001 From: Caleb Maclennan Date: Thu, 24 Mar 2022 18:14:43 +0300 Subject: [PATCH 7/7] ci: Use reusable workflow for luarocks deploy --- .github/workflows/deploy.yml | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..acd66ea --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,34 @@ +name: Deploy + +on: [ push, workflow_dispatch ] + +jobs: + + affected: + uses: lunarmodules/.github/.github/workflows/list_affected_rockspecs.yml@main + + build: + needs: affected + if: ${{ needs.affected.outputs.rockspecs }} + uses: lunarmodules/.github/.github/workflows/test_build_rock.yml@main + with: + rockspecs: ${{ needs.affected.outputs.rockspecs }} + + upload: + needs: [ affected, build ] + # Only run upload if: + # 1. We are on the canonical repository (no uploads from forks) + # 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. Some rockspecs were changed — this implies the commit changing the rockspec is the same one that gets tagged + if: >- + ${{ + github.repository == 'lunarmodules/luasocket' && + ( 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 }}