diff --git a/.ci/install-luarocks.sh b/.ci/install-luarocks.sh deleted file mode 100755 index 4ead29d..0000000 --- a/.ci/install-luarocks.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env bash - -version=$LUAROCKS_VERSION -luarocks_tarball=https://luarocks.github.io/luarocks/releases/luarocks-$version.tar.gz - -set -e - -# Do we already have the correct LuaRocks built? -if [ -d "$HOME/luarocks/bin" ]; then - installed_version=$($HOME/luarocks/bin/luarocks --version | head -1 | awk '{print $2}') - echo "Need LuaRocks $version" - echo "Found LuaRocks $installed_version" - - if [ "$installed_version" = "$version" ]; then - echo "Using cached LuaRocks directory" - exit 0 - fi -fi - -echo "Installing LuaRocks $version" - -mkdir -p "$HOME/luarocks" - -curl -L $luarocks_tarball | tar xz -cd luarocks-$version -./configure --prefix="$HOME/luarocks" "$@" -make -j${JOBS} && make install - -# Clean-up build directory -cd ../ -rm -rf luarocks-$version diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f4c8f6b..18fc880 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,79 +1,38 @@ -name: CI +name: "Unix build" -on: [ push, pull_request ] +on: [push, pull_request] jobs: - CI-Linux-LuaJIT: - name: "Linux x64 with LuaJIT" - runs-on: ubuntu-22.04 + test: + runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Install dependencies - run: | - # Use the official APT repositories from OpenResty to install LuaJIT - curl -sSL "https://openresty.org/package/pubkey.gpg" | sudo gpg --dearmor -o /usr/share/keyrings/openresty.gpg - echo "deb [signed-by=/usr/share/keyrings/openresty.gpg] https://openresty.org/package/ubuntu $(lsb_release -sc) main" | \ - sudo tee /etc/apt/sources.list.d/openresty.list > /dev/null - # Install dependencies - sudo apt-get update - sudo apt-get install --no-install-recommends openresty libvips-dev - - - name: Install LuaRocks - env: - LUAROCKS_VERSION: 3.9.2 - run: - .ci/install-luarocks.sh - --with-lua=/usr/local/openresty/luajit/ - --with-lua-include=/usr/local/openresty/luajit/include/luajit-2.1 - - - name: Prepare environment - run: | - echo "/usr/local/openresty/luajit/bin:$HOME/luarocks/bin" >> $GITHUB_PATH - - - name: Install Lua modules - run: make dev - - - name: Lint with luacheck - run: make lint - - - name: Test with busted - run: make test - - CI-Linux-Lua-54: - name: "Linux x64 with Lua 5.4" - runs-on: ubuntu-22.04 + strategy: + fail-fast: false + matrix: + luaVersion: ["5.1", "5.2", "5.3", "5.4", "luajit-2.1.0-beta3", "luajit-openresty"] steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Install dependencies - run: | - sudo apt install lua5.4 liblua5.4-dev libvips-dev + - uses: actions/checkout@v4 - - name: Install LuaRocks - env: - LUAROCKS_VERSION: 3.9.2 - run: - .ci/install-luarocks.sh - --with-lua=/usr/ - --with-lua-include=/usr/include/lua5.4 + - uses: leafo/gh-actions-lua@v9 + with: + luaVersion: ${{ matrix.luaVersion }} - - name: Prepare environment - run: | - echo "/usr/bin:$HOME/luarocks/bin" >> $GITHUB_PATH + - uses: leafo/gh-actions-luarocks@v4 - - name: Install Lua modules - run: make dev + - name: Lua dependencies + run: | + luarocks install busted + luarocks install luacheck + if [[ ${{ matrix.luaVersion }} == 5.* ]]; then luarocks install luaffi-tkl; fi - - name: Install ffi - run: make ffi + - name: Install libvips + run: | + sudo apt install --no-install-recommends libvips-dev - - name: Lint with luacheck - run: make lint + - name: Busted tests + run: | + busted . - - name: Test with busted - run: make test + - name: Linting tests + luacheck .