From 9e22f32dd442d7c95766aca54ceea9833efa4f9d Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Thu, 17 Feb 2022 01:14:56 -0300 Subject: tests: remove Travis CI, add Github Actions --- .github/workflows/test.yml | 104 ++++++++++++++++++++++++++ .travis.yml | 177 --------------------------------------------- README.md | 2 +- makedist | 4 +- spec/README.md | 8 +- spec/util/test_env.lua | 12 +-- 6 files changed, 117 insertions(+), 190 deletions(-) create mode 100644 .github/workflows/test.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..3ddd5f18 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,104 @@ +name: test + +on: [push] + +jobs: + ############################################################################## + ShellLint: + runs-on: "ubuntu-latest" + + steps: + - uses: actions/checkout@master + + - name: Prep + run: | + sudo apt-get install -y shellcheck + + - name: Shellcheck + run: | + shellcheck ./configure + + ############################################################################## + LuaLint: + runs-on: "ubuntu-latest" + + steps: + - uses: actions/checkout@master + + - uses: leafo/gh-actions-lua@v8.0.0 + with: + luaVersion: "5.4" + + - uses: leafo/gh-actions-luarocks@v4.0.0 + + - name: Prep + run: | + luarocks install luacheck + + - name: Luacheck + run: | + luacheck . + + ############################################################################## + TestMatrix: + strategy: + matrix: + lua-version: ["5.3", "luajit"] + os: ["ubuntu-latest", "macos-latest"] + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@master + + - uses: leafo/gh-actions-lua@v8.0.0 + with: + luaVersion: ${{ matrix.lua-version }} + + - uses: leafo/gh-actions-luarocks@v4.0.0 + + - name: Prep + run: | + luarocks install busted + luarocks install cluacov + luarocks install luacheck + luarocks install busted-htest + + - name: Luacheck + run: | + luacheck . + + - name: Unit Test + run: | + eval $(luarocks path) + busted -o htest --exclude-tags=git,integration --verbose -Xhelper "lua_dir=$(luarocks config variables.LUA_DIR),ci" + busted -o htest --exclude-tags=git,integration --verbose -Xhelper "lua_dir=$(luarocks config variables.LUA_DIR),ci,env=full" + + - name: Integration Test + run: | + eval $(luarocks path) + busted -o htest --exclude-tags=ssh,gpg,git,unit --verbose -Xhelper "lua_dir=$(luarocks config variables.LUA_DIR),ci" + busted -o htest --exclude-tags=ssh,gpg,git,unit --verbose -Xhelper "lua_dir=$(luarocks config variables.LUA_DIR),ci,env=full" + + - name: Coverage + run: | + eval $(luarocks path) + luacov -c testrun/luacov.config + ( cd testrun/ && bash <(curl -s https://codecov.io/bash) ) + grep "Summary" -B1 -A1000 testrun/luacov.report.out + + ############################################################################## + SmokeTest: + runs-on: "ubuntu-latest" + steps: + - uses: actions/checkout@master + + - uses: leafo/gh-actions-lua@v8.0.0 + with: + luaVersion: "5.3" + + - name: Smoke Test + run: | + ./configure + ./makedist dev + ./smoke_test.sh luarocks-dev.tar.gz + diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index b1872483..00000000 --- a/.travis.yml +++ /dev/null @@ -1,177 +0,0 @@ -language: python - -cache: - directories: - - lua_install - - testrun/testing_cache-5.1 - - testrun/testing_cache-5.2 - - testrun/testing_cache-5.3 - - testrun/testing_cache-2.1 - - testrun/testing_server-5.1 - - testrun/testing_server-5.2 - - testrun/testing_server-5.3 - - testrun/testing_server-2.1 - - testrun/binary-samples - -smoke_script: &smoke_script - - export BRANCH=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then echo $TRAVIS_BRANCH; else echo $TRAVIS_PULL_REQUEST_BRANCH; fi) - - ./makedist $BRANCH - - ./smoke_test.sh luarocks-$BRANCH.tar.gz - -lint_script: &lint_script - - luacheck . - -unit_script: &unit_script - - busted -o htest --exclude-tags=git,integration --verbose -Xhelper "lua_dir=$PWD/lua_install,travis" - - busted -o htest --exclude-tags=git,integration --verbose -Xhelper "lua_dir=$PWD/lua_install,travis,env=full" - -integration_script: &integration_script - - lua -v - - if [ "$TRAVIS_OS_NAME" = "linux" ]; then shellcheck ./configure; fi - - ./configure --with-lua=lua_install - - ./makedist dev - - ./smoke_test.sh luarocks-dev.tar.gz - - busted -o htest --exclude-tags=gpg,git,unit --verbose -Xhelper "lua_dir=$PWD/lua_install,travis" - - busted -o htest --exclude-tags=gpg,git,unit --verbose -Xhelper "lua_dir=$PWD/lua_install,travis,env=full" - -jobs: - include: - # Smoke tests for release branches - - stage: smoke - if: branch =~ ^[0-9].* - script: *smoke_script - os: linux - env: - - LUA="lua=5.3" - - stage: smoke - if: branch =~ ^[0-9].* - script: *smoke_script - os: osx - language: generic - env: - - LUA="luajit=2.1" - # Lint with Luacheck - - stage: Lint with Luacheck - script: *lint_script - os: linux - env: - - LUA="lua=5.3" - # Unit tests for linux - - stage: Unit on Linux - script: *unit_script - os: linux - env: - - LUA="lua=5.1" - - stage: Unit on Linux - script: *unit_script - os: linux - env: - - LUA="lua=5.2" - - stage: Unit on Linux - script: *unit_script - os: linux - env: - - LUA="lua=5.3" - - stage: Unit on Linux - script: *unit_script - os: linux - env: - - LUA="luajit=2.1" - # Integration tests for linux - - stage: Integration on Linux - script: *integration_script - os: linux - env: - - LUA="lua=5.1" - - stage: Integration on Linux - script: *integration_script - os: linux - env: - - LUA="lua=5.2" - - stage: Integration on Linux - script: *integration_script - os: linux - env: - - LUA="lua=5.3" - - stage: Integration on Linux - script: *integration_script - os: linux - env: - - LUA="luajit=2.1" - # Unit tests for mac - - stage: Unit on Mac - script: *unit_script - os: osx - env: - - LUA="lua=5.1" - language: generic - - stage: Unit on Mac - script: *unit_script - os: osx - env: - - LUA="lua=5.2" - language: generic - - stage: Unit on Mac - script: *unit_script - os: osx - env: - - LUA="lua=5.3" - language: generic - - stage: Unit on Mac - script: *unit_script - os: osx - env: - - LUA="luajit=2.1" - language: generic - # Integration tests for mac - - stage: Integration on Mac - script: *integration_script - os: osx - env: - - LUA="lua=5.1" - language: generic - - stage: Integration on Mac - script: *integration_script - os: osx - env: - - LUA="lua=5.2" - language: generic - - stage: Integration on Mac - script: *integration_script - os: osx - env: - - LUA="lua=5.3" - language: generic - - stage: Integration on Mac - script: *integration_script - os: osx - env: - - LUA="luajit=2.1" - language: generic - -before_install: - - if [ ! -f lua_install/bin/luarocks ]; then pip install hererocks; fi - - if [ ! -f lua_install/bin/luarocks ]; then hererocks lua_install -r^ --$LUA; fi - - export PATH=$PATH:$PWD/lua_install/bin # Add directory with all installed binaries to PATH - -install: - - if [ ! -f lua_install/bin/busted ]; then luarocks install busted; fi - - if [ ! -f lua_install/bin/luacov ]; then luarocks install cluacov; fi - - if [ ! -f lua_install/bin/luacheck ]; then luarocks install luacheck; fi - - luarocks install busted-htest - -after_success: - - luacov -c $TRAVIS_BUILD_DIR/testrun/luacov.config - - cd $TRAVIS_BUILD_DIR/testrun/ && bash <(curl -s https://codecov.io/bash) - - grep "Summary" -B1 -A1000 $TRAVIS_BUILD_DIR/testrun/luacov.report.out - -notifications: - email: - on_success: change - on_failure: change - webhooks: - urls: - - https://webhooks.gitter.im/e/3320fc3f28abbb06e1d8 - on_success: change - on_failure: always - on_start: never diff --git a/README.md b/README.md index ce8dc29d..ce251b90 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ A package manager for Lua modules. -[![Build Status](https://travis-ci.com/luarocks/luarocks.svg?branch=master)](https://travis-ci.com/luarocks/luarocks) +[![Build Status](https://github.com/luarocks/luarocks/actions/workflows/main.yml/badge.svg)](https://github.com/luarocks/luarocks/actions) [![Build Status](https://ci.appveyor.com/api/projects/status/4x4630tcf64da48i/branch/master?svg=true)](https://ci.appveyor.com/project/hishamhm/luarocks/branch/master) [![Coverage Status](https://codecov.io/gh/luarocks/luarocks/coverage.svg?branch=master)](https://codecov.io/gh/luarocks/luarocks/branch/master) [![Join the chat at https://gitter.im/luarocks/luarocks](https://badges.gitter.im/luarocks/luarocks.svg)](https://gitter.im/luarocks/luarocks) diff --git a/makedist b/makedist index 2ffa3780..8abde3c4 100755 --- a/makedist +++ b/makedist @@ -137,7 +137,7 @@ mkdir "release-windows" mv "$out" "release-windows/$out-win32" cd "release-unix/$out" -rm -rf makedist install.bat win32 .travis.yml .gitignore appveyor* .appveyor +rm -rf makedist install.bat win32 .github .gitignore appveyor* .appveyor cd .. tar czvpf ../"$out.tar.gz" "$out" rm -f ../"$out.tar.gz.asc" @@ -145,7 +145,7 @@ cd .. rm -rf "release-unix" cd "release-windows/$out-win32" -rm -rf makedist Makefile GNUmakefile configure .travis.yml .gitignore test appveyor* .appveyor +rm -rf makedist Makefile GNUmakefile configure .github .gitignore test appveyor* .appveyor cd .. zip -r ../"$out-win32.zip" "$out-win32" rm -f ../"$out-win32.zip.asc" diff --git a/spec/README.md b/spec/README.md index 46372b19..b55550e6 100644 --- a/spec/README.md +++ b/spec/README.md @@ -3,14 +3,14 @@ ## Overview -Test suite for LuaRocks project with Busted unit testing framework(http://olivinelabs.com/busted/). +Test suite for LuaRocks project with Busted unit testing framework(http://olivinelabs.com/busted/). * Contains unit & integration tests * Easy setup for your purpose on command line or from configuration file ## Dependencies -* Lua >= 5.1 +* Lua >= 5.1 * Busted with dependencies ## Usage @@ -26,8 +26,8 @@ LuaRocks folder or specify with *-C* flag. env=, (default:"minimal") type what kind of environment to use ["minimal", "full"] noreset, Don't reset environment after each test clean, remove existing testing environment -appveyor, add just if running on TravisCI -travis, add just if running on TravisCI +appveyor, add just if running on Appveyor +ci, add just if running on Unix CI os=, type your OS ["linux", "os x", "windows"] ``` --------------------------------------------------------------------------------------------- diff --git a/spec/util/test_env.lua b/spec/util/test_env.lua index c40921cc..737d90a5 100644 --- a/spec/util/test_env.lua +++ b/spec/util/test_env.lua @@ -17,7 +17,7 @@ ARGUMENTS default: "minimal"). noreset Don't reset environment after each test clean Remove existing testing environment. - travis Add if running on TravisCI. + ci Add if running on Unix CI. appveyor Add if running on Appveyor. os= Set OS ("linux", "osx", or "windows"). lua_dir= Path of Lua installation (default "/usr/local") @@ -238,8 +238,8 @@ function test_env.set_args() test_env.TEST_ENV_CLEAN = true elseif argument == "verbose" then test_env.VERBOSE = true - elseif argument == "travis" then - test_env.TRAVIS = true + elseif argument == "ci" then + test_env.CI = true elseif argument == "appveyor" then test_env.APPVEYOR = true elseif argument:find("^os=") then @@ -273,13 +273,13 @@ function test_env.set_args() local system = execute_output("uname -s") if system == "Linux" then test_env.TEST_TARGET_OS = "linux" - if test_env.TRAVIS then + if test_env.CI then test_env.OPENSSL_INCDIR = "/usr/include" test_env.OPENSSL_LIBDIR = "/usr/lib/x86_64-linux-gnu" end elseif system == "Darwin" then test_env.TEST_TARGET_OS = "osx" - if test_env.TRAVIS then + if test_env.CI then test_env.OPENSSL_INCDIR = "/usr/local/opt/openssl/include" test_env.OPENSSL_LIBDIR = "/usr/local/opt/openssl/lib" end @@ -643,7 +643,7 @@ end function test_env.setup_specs(extra_rocks) -- if global variable about successful creation of testing environment doesn't exist, build environment if not test_env.setup_done then - if test_env.TRAVIS then + if test_env.CI then if not test_env.exists(os.getenv("HOME") .. "/.ssh/id_rsa.pub") then execute_bool("ssh-keygen -t rsa -P \"\" -f ~/.ssh/id_rsa") execute_bool("cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys") -- cgit v1.2.3-55-g6feb