diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..17cad49 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,45 @@ +name: Test build + +on: + push: + branches: + - master + pull_request: + +jobs: + build: + name: Test build on Linux + strategy: + fail-fast: false + matrix: + luaVersion: [ "5.4", "5.3", "5.2", "5.1", "luajit", "luajit-openresty"] + platform: [ "ubuntu-20.04", "macos-11" ] # "windows-2022" not supported by gh-actions-lua + runs-on: ${{ matrix.platform }} + 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 and install + run: | + export DEBUG=DEBUG + luarocks make -- luasocket-scm-3.rockspec + - name: Run regression tests + run: | + 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 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 }} 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