From 3f4a5564b2643d884594a15ddc233c9c4abe3780 Mon Sep 17 00:00:00 2001 From: Thijs Schreijer Date: Thu, 9 Nov 2023 19:48:16 +0100 Subject: chore(ci): switch to github actions --- .github/workflows/lint.yml | 38 ++++++++++++ .github/workflows/unix_build.yml | 59 +++++++++++++++++++ .travis.yml | 34 ----------- .travis/platform.sh | 15 ----- .travis/setenv_lua.sh | 3 - .travis/setup_lua.sh | 122 --------------------------------------- appveyor.yml | 29 ++++++++++ 7 files changed, 126 insertions(+), 174 deletions(-) create mode 100644 .github/workflows/lint.yml create mode 100644 .github/workflows/unix_build.yml delete mode 100644 .travis.yml delete mode 100644 .travis/platform.sh delete mode 100644 .travis/setenv_lua.sh delete mode 100644 .travis/setup_lua.sh create mode 100644 appveyor.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..4a4516b --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,38 @@ +name: Lint + +concurrency: + # for PR's cancel the running task, if another commit is pushed + group: ${{ github.workflow }} ${{ github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + +on: + # build on PR and push-to-main. This works for short-lived branches, and saves + # CPU cycles on duplicated tests. + # For long-lived branches that diverge, you'll want to run on all pushes, not + # just on push-to-main. + pull_request: {} + push: + branches: + - main + + +jobs: + lint: + runs-on: ubuntu-20.04 + steps: + - name: Checkout + uses: actions/checkout@v3 + + - uses: leafo/gh-actions-lua@v8 + with: + luaVersion: "5.4" + + - uses: leafo/gh-actions-luarocks@v4 + + - name: dependencies + run: | + luarocks install luacheck + + - name: lint + run: | + luacheck . diff --git a/.github/workflows/unix_build.yml b/.github/workflows/unix_build.yml new file mode 100644 index 0000000..ba8164a --- /dev/null +++ b/.github/workflows/unix_build.yml @@ -0,0 +1,59 @@ +name: "Unix build" + +concurrency: + # for PR's cancel the running task, if another commit is pushed + group: ${{ github.workflow }} ${{ github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + +on: + # build on PR and push-to-main. This works for short-lived branches, and saves + # CPU cycles on duplicated tests. + # For long-lived branches that diverge, you'll want to run on all pushes, not + # just on push-to-main. + pull_request: {} + push: + branches: + - main + + +jobs: + test: + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: false + matrix: + os: ['ubuntu-20.04', 'macos-11.0'] + luaVersion: + - "5.1" + - "5.2" + - "5.3" + - "5.4" + - "luajit-2.1.0-beta3" + - "luajit-openresty" + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - uses: leafo/gh-actions-lua@v8 + with: + luaVersion: ${{ matrix.luaVersion }} + + - uses: leafo/gh-actions-luarocks@v4 + + - name: dependencies + run: | + luarocks install busted + luarocks make + + - name: test + run: | + busted --Xoutput "--color" + + # - name: Report test coverage + # if: success() + # continue-on-error: true + # run: luacov-coveralls + # env: + # COVERALLS_REPO_TOKEN: ${{ github.token }} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index e6bfa23..0000000 --- a/.travis.yml +++ /dev/null @@ -1,34 +0,0 @@ -language: c - -sudo: false - -os: - - linux - - osx - -env: - global: - - LUAROCKS=2.3.0 - matrix: - - LUA=lua5.1 - - LUA=lua5.2 - - LUA=lua5.3 - - LUA=luajit - - LUA=luajit2.0 - - LUA=luajit2.1 - -before_install: - - source .travis/setenv_lua.sh - -install: - - luarocks install busted - - luarocks make luasystem-scm-0.rockspec - -script: busted spec - -branches: - only: - - master - -notifications: - email: false diff --git a/.travis/platform.sh b/.travis/platform.sh deleted file mode 100644 index 7259a7d..0000000 --- a/.travis/platform.sh +++ /dev/null @@ -1,15 +0,0 @@ -if [ -z "${PLATFORM:-}" ]; then - PLATFORM=$TRAVIS_OS_NAME; -fi - -if [ "$PLATFORM" == "osx" ]; then - PLATFORM="macosx"; -fi - -if [ -z "$PLATFORM" ]; then - if [ "$(uname)" == "Linux" ]; then - PLATFORM="linux"; - else - PLATFORM="macosx"; - fi; -fi diff --git a/.travis/setenv_lua.sh b/.travis/setenv_lua.sh deleted file mode 100644 index 8d8c825..0000000 --- a/.travis/setenv_lua.sh +++ /dev/null @@ -1,3 +0,0 @@ -export PATH=${PATH}:$HOME/.lua:$HOME/.local/bin:${TRAVIS_BUILD_DIR}/install/luarocks/bin -bash .travis/setup_lua.sh -eval `$HOME/.lua/luarocks path` diff --git a/.travis/setup_lua.sh b/.travis/setup_lua.sh deleted file mode 100644 index 6dcc0c6..0000000 --- a/.travis/setup_lua.sh +++ /dev/null @@ -1,122 +0,0 @@ -#! /bin/bash - -# A script for setting up environment for travis-ci testing. -# Sets up Lua and Luarocks. -# LUA must be "lua5.1", "lua5.2" or "luajit". -# luajit2.0 - master v2.0 -# luajit2.1 - master v2.1 - -set -eufo pipefail - -LUAJIT_VERSION="2.0.4" -LUAJIT_BASE="LuaJIT-$LUAJIT_VERSION" - -source .travis/platform.sh - -LUA_HOME_DIR=$TRAVIS_BUILD_DIR/install/lua - -LR_HOME_DIR=$TRAVIS_BUILD_DIR/install/luarocks - -mkdir $HOME/.lua - -LUAJIT="no" - -if [ "$PLATFORM" == "macosx" ]; then - if [ "$LUA" == "luajit" ]; then - LUAJIT="yes"; - fi - if [ "$LUA" == "luajit2.0" ]; then - LUAJIT="yes"; - fi - if [ "$LUA" == "luajit2.1" ]; then - LUAJIT="yes"; - fi; -elif [ "$(expr substr $LUA 1 6)" == "luajit" ]; then - LUAJIT="yes"; -fi - -mkdir -p "$LUA_HOME_DIR" - -if [ "$LUAJIT" == "yes" ]; then - - if [ "$LUA" == "luajit" ]; then - curl --location https://github.com/LuaJIT/LuaJIT/archive/v$LUAJIT_VERSION.tar.gz | tar xz; - else - git clone https://github.com/LuaJIT/LuaJIT.git $LUAJIT_BASE; - fi - - cd $LUAJIT_BASE - - if [ "$LUA" == "luajit2.1" ]; then - git checkout v2.1; - # force the INSTALL_TNAME to be luajit - perl -i -pe 's/INSTALL_TNAME=.+/INSTALL_TNAME= luajit/' Makefile - fi - - make && make install PREFIX="$LUA_HOME_DIR" - - ln -s $LUA_HOME_DIR/bin/luajit $HOME/.lua/luajit - ln -s $LUA_HOME_DIR/bin/luajit $HOME/.lua/lua; - -else - - if [ "$LUA" == "lua5.1" ]; then - curl http://www.lua.org/ftp/lua-5.1.5.tar.gz | tar xz - cd lua-5.1.5; - elif [ "$LUA" == "lua5.2" ]; then - curl http://www.lua.org/ftp/lua-5.2.4.tar.gz | tar xz - cd lua-5.2.4; - elif [ "$LUA" == "lua5.3" ]; then - curl http://www.lua.org/ftp/lua-5.3.2.tar.gz | tar xz - cd lua-5.3.2; - fi - - # Build Lua without backwards compatibility for testing - perl -i -pe 's/-DLUA_COMPAT_(ALL|5_2)//' src/Makefile - make $PLATFORM - make INSTALL_TOP="$LUA_HOME_DIR" install; - - ln -s $LUA_HOME_DIR/bin/lua $HOME/.lua/lua - ln -s $LUA_HOME_DIR/bin/luac $HOME/.lua/luac; - -fi - -cd $TRAVIS_BUILD_DIR - -lua -v - -LUAROCKS_BASE=luarocks-$LUAROCKS - -curl --location http://luarocks.org/releases/$LUAROCKS_BASE.tar.gz | tar xz - -cd $LUAROCKS_BASE - -if [ "$LUA" == "luajit" ]; then - ./configure --lua-suffix=jit --with-lua-include="$LUA_HOME_DIR/include/luajit-2.0" --prefix="$LR_HOME_DIR"; -elif [ "$LUA" == "luajit2.0" ]; then - ./configure --lua-suffix=jit --with-lua-include="$LUA_HOME_DIR/include/luajit-2.0" --prefix="$LR_HOME_DIR"; -elif [ "$LUA" == "luajit2.1" ]; then - ./configure --lua-suffix=jit --with-lua-include="$LUA_HOME_DIR/include/luajit-2.1" --prefix="$LR_HOME_DIR"; -else - ./configure --with-lua="$LUA_HOME_DIR" --prefix="$LR_HOME_DIR" -fi - -make build && make install - -ln -s $LR_HOME_DIR/bin/luarocks $HOME/.lua/luarocks - -cd $TRAVIS_BUILD_DIR - -luarocks --version - -rm -rf $LUAROCKS_BASE - -if [ "$LUAJIT" == "yes" ]; then - rm -rf $LUAJIT_BASE; -elif [ "$LUA" == "lua5.1" ]; then - rm -rf lua-5.1.5; -elif [ "$LUA" == "lua5.2" ]; then - rm -rf lua-5.2.4; -elif [ "$LUA" == "lua5.3" ]; then - rm -rf lua-5.3.2; -fi diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000..596c846 --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,29 @@ +# this fails for some reason. Disabled for now. + +shallow_clone: true + +environment: + matrix: + - LUA: "lua 5.1" + - LUA: "lua 5.2" + - LUA: "lua 5.3" + - LUA: "lua 5.4" + - LUA: "luajit 2.0" + - LUA: "luajit 2.0 --compat 5.2" + - LUA: "luajit 2.1" + - LUA: "luajit 2.1 --compat 5.2" + +before_build: + - set PATH=C:\Python27\Scripts;%PATH% + - pip install --upgrade certifi + - FOR /F "tokens=* USEBACKQ" %%F IN (`python -c "import certifi;print(certifi.where())"`) DO ( SET SSL_CERT_FILE=%%F ) + - pip install hererocks + - hererocks here --%LUA% -rlatest + - call here\bin\activate + - luarocks install busted + +build_script: + - luarocks make + +test_script: + - busted -- cgit v1.2.3-55-g6feb