ci: set fail-fast to false on matrices #33
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| paths-ignore: | |
| - "**.md" | |
| - "docs/**" | |
| - "checksums/*.md" | |
| pull_request: | |
| paths-ignore: | |
| - "**.md" | |
| - "docs/**" | |
| - "checksums/*.md" | |
| env: | |
| ROCKSPEC_VERSION: 0.0.3 | |
| DEV_ROCKSPEC: lua-hash-dev-1.rockspec | |
| jobs: | |
| cplusplus-build: | |
| name: Build C++ | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| shell: pwsh | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| lua-version: | |
| - 5.1.5 | |
| - 5.2.4 | |
| - 5.3.6 | |
| - 5.4.8 | |
| use-clang: | |
| - 'true' | |
| - 'false' | |
| steps: | |
| - name: Validate Lua version | |
| run: | | |
| if (-not ("${{ matrix.lua-version }}" -match "^(\d+)\.(\d+)(\.\d+)*$")) | |
| { | |
| Write-Host "Invalid Lua version (X.Y.Z) expected"; | |
| exit 1; | |
| } | |
| - name: Checkout | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| with: | |
| path: lua-hash | |
| - name: Install dependencies | |
| run: sudo apt install -y libssl-dev libreadline-dev | |
| - name: Install clang | |
| if: ${{ matrix.use-clang == 'true' }} | |
| run: sudo apt install -y clang | |
| - name: Download and extract Lua ${{ matrix.lua-version }} source code, and set environment variables | |
| run: | | |
| $targz = "lua-${{ matrix.lua-version }}.tar.gz"; | |
| $targz_path = Join-Path -Path "${{ runner.temp }}" -ChildPath $targz; | |
| Invoke-WebRequest -Uri "https://lua.org/ftp/${targz}" -OutFile "$targz_path"; | |
| tar -C "${{ runner.temp }}" -xf "$targz_path"; | |
| $lua_source_dir = Join-Path -Path "${{ runner.temp }}" -ChildPath "lua-${{ matrix.lua-version }}"; | |
| if (-not (Test-Path $lua_source_dir)) | |
| { | |
| $color = (0x1b -as [char]) + "[36m"; | |
| Write-Host "Unable to find Lua source code directory: ${color}${lua_source_dir}"; | |
| exit 1; | |
| } | |
| $install_dir = Join-Path -Path "${{ runner.temp }}" -ChildPath "installed-lua-${{ matrix.lua-version }}"; | |
| if ("${{ matrix.use-clang }}" -eq "true") | |
| { | |
| Add-Content "${{ github.env }}" "CC=clang++"; | |
| } | |
| else | |
| { | |
| Add-Content "${{ github.env }}" "CC=g++"; | |
| } | |
| Add-Content "${{ github.env }}" "LUA_SRC_DIR=${lua_source_dir}"; | |
| Add-Content "${{ github.env }}" "LUA_DIR=${install_dir}"; | |
| - name: Build Lua ${{ matrix.lua-version }} | |
| run: | | |
| make -C "${{ env.LUA_SRC_DIR }}" ` | |
| linux ` | |
| "CC=${{ env.CC }}"; | |
| - name: Install Lua ${{ matrix.lua-version }}, and set environment variables | |
| run: | | |
| make -C "${{ env.LUA_SRC_DIR }}" ` | |
| install ` | |
| "INSTALL_TOP=${{ env.LUA_DIR }}"; | |
| $lua_bindir = Join-Path -Path "${{ env.LUA_DIR }}" -ChildPath "bin"; | |
| $lua_incdir = Join-Path -Path "${{ env.LUA_DIR }}" -ChildPath "include"; | |
| Add-Content "${{ github.path }}" "${lua_bindir}"; | |
| Add-Content "${{ github.env }}" "LUA_INCDIR=${lua_incdir}"; | |
| - name: Compile lua-hash | |
| working-directory: lua-hash | |
| run: | | |
| ${{ env.CC }} ` | |
| "-O2" ` | |
| "-Wall" ` | |
| "-c" ` | |
| "-fPIC" ` | |
| "-o" "src/lua-hash.o" ` | |
| "-I${{ env.LUA_INCDIR }}" ` | |
| "-Isrc" ` | |
| "-DLUA_HASH_BUILD_SHARED" ` | |
| "-DLUA_HASH_USE_OPENSSL" ` | |
| "src/lua-hash.c"; | |
| - name: Link lua-hash | |
| working-directory: lua-hash | |
| run: | | |
| ${{ env.CC }} "-shared" ` | |
| "-o" "lua-hash.so" ` | |
| "src/lua-hash.o" ` | |
| "-lcrypto"; | |
| - name: Run samples | |
| working-directory: lua-hash | |
| run: | | |
| Get-ChildItem "samples" -Recurse -File | | |
| Where-Object Extension -EQ ".lua" | | |
| Select-Object -ExpandProperty FullName | | |
| Foreach-Object { | |
| $color = (0x1b -as [char]) + "[36m"; | |
| Write-Host "Running sample file: ${color}$_"; | |
| lua "$_"; | |
| if ($LASTEXITCODE -ne 0) | |
| { | |
| exit 1; | |
| } | |
| }; | |
| clang-build: | |
| name: Clang Build | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| shell: pwsh | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| lua-version: | |
| - 5.1.5 | |
| - 5.2.4 | |
| - 5.3.6 | |
| - 5.4.8 | |
| steps: | |
| - name: Validate Lua version | |
| run: | | |
| if (-not ("${{ matrix.lua-version }}" -match "^(\d+)\.(\d+)(\.\d+)*$")) | |
| { | |
| Write-Host "Invalid Lua version (X.Y.Z) expected"; | |
| exit 1; | |
| } | |
| - name: Checkout | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| with: | |
| path: lua-hash | |
| - name: Install dependencies | |
| run: sudo apt install -y libssl-dev libreadline-dev clang | |
| - name: Download and extract Lua ${{ matrix.lua-version }} source code, and set environment variables | |
| run: | | |
| $targz = "lua-${{ matrix.lua-version }}.tar.gz"; | |
| $targz_path = Join-Path -Path "${{ runner.temp }}" -ChildPath $targz; | |
| Invoke-WebRequest -Uri "https://lua.org/ftp/${targz}" -OutFile "$targz_path"; | |
| tar -C "${{ runner.temp }}" -xf "$targz_path"; | |
| $lua_source_dir = Join-Path -Path "${{ runner.temp }}" -ChildPath "lua-${{ matrix.lua-version }}"; | |
| if (-not (Test-Path $lua_source_dir)) | |
| { | |
| $color = (0x1b -as [char]) + "[36m"; | |
| Write-Host "Unable to find Lua source code directory: ${color}${lua_source_dir}"; | |
| exit 1; | |
| } | |
| $install_dir = Join-Path -Path "${{ runner.temp }}" -ChildPath "installed-lua-${{ matrix.lua-version }}"; | |
| Add-Content "${{ github.env }}" "CC=clang"; | |
| Add-Content "${{ github.env }}" "LUA_SRC_DIR=${lua_source_dir}"; | |
| Add-Content "${{ github.env }}" "LUA_DIR=${install_dir}"; | |
| - name: Build Lua ${{ matrix.lua-version }} | |
| run: | | |
| make -C "${{ env.LUA_SRC_DIR }}" ` | |
| linux ` | |
| "CC=${{ env.CC }}"; | |
| - name: Install Lua ${{ matrix.lua-version }}, and set environment variables | |
| run: | | |
| make -C "${{ env.LUA_SRC_DIR }}" ` | |
| install ` | |
| "INSTALL_TOP=${{ env.LUA_DIR }}"; | |
| $lua_bindir = Join-Path -Path "${{ env.LUA_DIR }}" -ChildPath "bin"; | |
| $lua_incdir = Join-Path -Path "${{ env.LUA_DIR }}" -ChildPath "include"; | |
| Add-Content "${{ github.path }}" "${lua_bindir}"; | |
| Add-Content "${{ github.env }}" "LUA_INCDIR=${lua_incdir}"; | |
| - name: Compile lua-hash | |
| working-directory: lua-hash | |
| run: | | |
| ${{ env.CC }} ` | |
| "-O2" ` | |
| "-Wall" ` | |
| "-c" ` | |
| "-fPIC" ` | |
| "-o" "src/lua-hash.o" ` | |
| "-I${{ env.LUA_INCDIR }}" ` | |
| "-Isrc" ` | |
| "-DLUA_HASH_BUILD_SHARED" ` | |
| "-DLUA_HASH_USE_OPENSSL" ` | |
| "src/lua-hash.c"; | |
| - name: Link lua-hash | |
| working-directory: lua-hash | |
| run: | | |
| ${{ env.CC }} "-shared" ` | |
| "-o" "lua-hash.so" ` | |
| "src/lua-hash.o" ` | |
| "-lcrypto"; | |
| - name: Run samples | |
| working-directory: lua-hash | |
| run: | | |
| Get-ChildItem "samples" -Recurse -File | | |
| Where-Object Extension -EQ ".lua" | | |
| Select-Object -ExpandProperty FullName | | |
| Foreach-Object { | |
| $color = (0x1b -as [char]) + "[36m"; | |
| Write-Host "Running sample file: ${color}$_"; | |
| lua "$_"; | |
| if ($LASTEXITCODE -ne 0) | |
| { | |
| exit 1; | |
| } | |
| }; | |
| build: | |
| name: Build | |
| runs-on: ${{ matrix.os }} | |
| defaults: | |
| run: | |
| shell: pwsh | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| lua-version: | |
| - 5.1 | |
| - 5.2 | |
| - 5.3 | |
| - 5.4 | |
| - luajit | |
| os: | |
| - windows-latest | |
| - windows-11-arm | |
| - ubuntu-latest | |
| - ubuntu-24.04-arm | |
| - macos-latest | |
| exclude: | |
| - os: macos-latest | |
| lua-version: luajit | |
| - os: windows-11-arm | |
| lua-version: luajit | |
| steps: | |
| - name: Set environment variable to hold the rockspec name | |
| run: | | |
| if ("${{ github.repository }}" -eq "luau-project/lua-hash" -and "${{ github.ref_name }}" -eq "v${{ env.ROCKSPEC_VERSION }}" -and "${{ github.ref }}" -eq "refs/tags/v${{ env.ROCKSPEC_VERSION }}") | |
| { | |
| Add-Content "${{ github.env }}" "ROCKSPEC=lua-hash-${{ env.ROCKSPEC_VERSION }}-1.rockspec"; | |
| } | |
| else | |
| { | |
| Add-Content "${{ github.env }}" "ROCKSPEC=${{ env.DEV_ROCKSPEC }}"; | |
| } | |
| - name: Checkout | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| with: | |
| path: lua-hash | |
| - name: Install libssl-dev | |
| if: ${{ runner.os == 'Linux' }} | |
| run: sudo apt install -y libssl-dev | |
| - name: Setup MSVC dev-prompt | |
| if: ${{ runner.os == 'Windows' && matrix.lua-version != 'luajit' }} | |
| uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0 | |
| with: | |
| arch: ${{ runner.arch }} | |
| - name: Setup Lua | |
| uses: luarocks/gh-actions-lua@989f8e6ffba55ce1817e236478c98558e598776c # v11 | |
| with: | |
| luaVersion: ${{ matrix.lua-version }} | |
| buildCache: false | |
| - name: Setup LuaRocks | |
| uses: luarocks/gh-actions-luarocks@7c85eeff60655651b444126f2a78be784e836a0a # v6 | |
| - name: Lint rockspecs | |
| working-directory: lua-hash | |
| run: | | |
| Get-ChildItem . -Recurse -File | | |
| Where-Object Extension -Eq ".rockspec" | | |
| Select-Object -ExpandProperty FullName | | |
| Foreach-Object { | |
| $color = (0x1b -as [char]) + "[36m"; | |
| Write-Host "Linting rockspec: ${color}$_"; | |
| luarocks lint "$_"; | |
| if ($LASTEXITCODE -ne 0) | |
| { | |
| exit 1; | |
| } | |
| } | |
| - name: Build lua-hash | |
| working-directory: lua-hash | |
| run: | | |
| $rockspec = Get-ChildItem . -Recurse -File | | |
| Where-Object Name -EQ "${{ env.ROCKSPEC }}" | | |
| Select-Object -ExpandProperty FullName -First 1; | |
| $color = (0x1b -as [char]) + "[36m"; | |
| Write-Host "Building rockspec file: ${color}${rockspec}"; | |
| luarocks make $rockspec; | |
| - name: Run samples | |
| working-directory: lua-hash | |
| run: | | |
| Get-ChildItem "samples" -Recurse -File | | |
| Where-Object Extension -EQ ".lua" | | |
| Select-Object -ExpandProperty FullName | | |
| Foreach-Object { | |
| $color = (0x1b -as [char]) + "[36m"; | |
| Write-Host "Running sample file: ${color}$_"; | |
| lua "$_"; | |
| if ($LASTEXITCODE -ne 0) | |
| { | |
| exit 1; | |
| } | |
| }; | |
| msys2-build: | |
| name: MSYS2 Build | |
| runs-on: ${{ matrix.MSYS2_CONFIG.os }} | |
| defaults: | |
| run: | |
| shell: msys2 {0} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| MSYS2_CONFIG: | |
| - { sys: mingw64, env: x86_64, os: windows-latest } | |
| - { sys: ucrt64, env: ucrt-x86_64, os: windows-latest } | |
| - { sys: clang64, env: clang-x86_64, os: windows-latest } | |
| - { sys: clangarm64, env: clang-aarch64, os: windows-11-arm } | |
| Lua: | |
| - { version: '5.4', msys2-pkg-name: 'lua', msys2-lua-interpreter: 'lua' } | |
| - { version: '5.3', msys2-pkg-name: 'lua53', msys2-lua-interpreter: 'lua5.3' } | |
| - { version: '5.1', msys2-pkg-name: 'lua51', msys2-lua-interpreter: 'lua5.1' } | |
| - { version: '5.1', msys2-pkg-name: 'luajit', msys2-lua-interpreter: 'luajit' } | |
| env: | |
| LUA_INTERPRETER: /${{ matrix.MSYS2_CONFIG.sys }}/bin/${{ matrix.Lua.msys2-lua-interpreter }} | |
| steps: | |
| - name: Setup MSYS2 | |
| uses: msys2/setup-msys2@40677d36a502eb2cf0fb808cc9dec31bf6152638 # v2.28.0 | |
| with: | |
| msystem: ${{ matrix.MSYS2_CONFIG.sys }} | |
| install: | | |
| base-devel | |
| git | |
| mingw-w64-${{ matrix.MSYS2_CONFIG.env }}-cc | |
| mingw-w64-${{ matrix.MSYS2_CONFIG.env }}-${{ matrix.Lua.msys2-pkg-name }} | |
| mingw-w64-${{ matrix.MSYS2_CONFIG.env }}-lua-luarocks | |
| - name: Set environment variable to hold the rockspec name | |
| run: | | |
| if [[ "${{ github.repository }}" == "luau-project/lua-hash" ]] && [[ "${{ github.ref_name }}" == "v${{ env.ROCKSPEC_VERSION }}" ]] && [[ "${{ github.ref }}" == "refs/tags/v${{ env.ROCKSPEC_VERSION }}" ]]; | |
| then | |
| echo "ROCKSPEC=lua-hash-${{ env.ROCKSPEC_VERSION }}-1.rockspec" >> "${{ github.env }}"; | |
| else | |
| echo "ROCKSPEC=${{ env.DEV_ROCKSPEC }}" >> "${{ github.env }}"; | |
| fi; | |
| - name: Configure LuaRocks | |
| run: | | |
| source /etc/makepkg_mingw.conf | |
| echo "CC=/${{ matrix.MSYS2_CONFIG.sys }}/bin/${CC}" >> "${{ github.env }}" | |
| echo "CFLAGS=${CFLAGS}" >> "${{ github.env }}" | |
| luarocks config lua_version "${{ matrix.Lua.version }}" | |
| luarocks config lua_dir "/${{ matrix.MSYS2_CONFIG.sys }}" | |
| - name: Checkout | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| with: | |
| path: lua-hash | |
| - name: Lint rockspecs | |
| working-directory: lua-hash | |
| run: | | |
| for rockspec in rockspecs/*.rockspec; | |
| do | |
| echo -e "Linting rockspec: \e[36m${rockspec}\e[0m"; | |
| luarocks lint "${rockspec}"; | |
| done; | |
| - name: Build lua-hash | |
| working-directory: lua-hash | |
| run: | | |
| rockspec="rockspecs/${{ env.ROCKSPEC }}"; | |
| echo -e "Building rockspec: \e[36m${rockspec}\e[0m"; | |
| luarocks make ${rockspec}; | |
| - name: Run samples | |
| working-directory: lua-hash | |
| run: | | |
| for sample in samples/*.lua; | |
| do | |
| echo -e "Running sample file: \e[36m${sample}\e[0m" | |
| ${{ env.LUA_INTERPRETER }} $sample; | |
| done; | |
| cygwin-build: | |
| name: Cygwin Build | |
| runs-on: windows-latest | |
| env: | |
| LUAROCKS_VERSION: 3.12.2 | |
| CYGWIN_NOWINPATH: 1 | |
| CHERE_INVOKING: 1 | |
| CYGWIN_INSTALL_DIR: C:\cygwin64 | |
| steps: | |
| - name: Set environment variable to hold the rockspec name | |
| run: | | |
| if ("${{ github.repository }}" -eq "luau-project/lua-hash" -and "${{ github.ref_name }}" -eq "v${{ env.ROCKSPEC_VERSION }}" -and "${{ github.ref }}" -eq "refs/tags/v${{ env.ROCKSPEC_VERSION }}") | |
| { | |
| Add-Content "${{ github.env }}" "ROCKSPEC=lua-hash-${{ env.ROCKSPEC_VERSION }}-1.rockspec"; | |
| } | |
| else | |
| { | |
| Add-Content "${{ github.env }}" "ROCKSPEC=${{ env.DEV_ROCKSPEC }}"; | |
| } | |
| - name: Override git autocrlf to input before checkout | |
| run: git config --global core.autocrlf input | |
| - name: Checkout | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| with: | |
| path: lua-hash | |
| - name: Setup Cygwin | |
| uses: cygwin/cygwin-install-action@f61179d72284ceddc397ed07ddb444d82bf9e559 # v5 | |
| with: | |
| platform: x86_64 | |
| install-dir: ${{ env.CYGWIN_INSTALL_DIR }} | |
| packages: | | |
| coreutils, | |
| wget, | |
| gcc-g++, | |
| make, | |
| lua, | |
| liblua-devel, | |
| unzip, | |
| libssl-devel | |
| - name: Set environment variables to hold Cygwin applications for usage from pwsh | |
| run: | | |
| $bash = Join-Path -Path ${{ env.CYGWIN_INSTALL_DIR }} -ChildPath "bin" | | |
| Join-Path -ChildPath "bash"; | |
| $cygpath = Join-Path -Path ${{ env.CYGWIN_INSTALL_DIR }} -ChildPath "bin" | | |
| Join-Path -ChildPath "cygpath"; | |
| Add-Content "${{ github.env }}" "CYGWIN_BASH=${bash}"; | |
| Add-Content "${{ github.env }}" "CYGWIN_CYGPATH=${cygpath}"; | |
| - name: Download, configure and install LuaRocks | |
| run: | | |
| $color = (0x1b -as [char]) + "[36m"; | |
| Write-Host "Downloading LuaRocks from ${color}https://luarocks.org/releases/luarocks-${{ env.LUAROCKS_VERSION }}.tar.gz"; | |
| ${{ env.CYGWIN_BASH }} -lc "wget https://luarocks.org/releases/luarocks-${{ env.LUAROCKS_VERSION }}.tar.gz -P/tmp"; | |
| Write-Host "Extracting LuaRocks tarball: ${color}/tmp/luarocks-${{ env.LUAROCKS_VERSION }}.tar.gz"; | |
| ${{ env.CYGWIN_BASH }} -lc "tar -C /tmp -xf /tmp/luarocks-${{ env.LUAROCKS_VERSION }}.tar.gz"; | |
| Write-Host "Configuring, making and installing LuaRocks at ${color}/usr"; | |
| ${{ env.CYGWIN_BASH }} -lc "cd /tmp/luarocks-${{ env.LUAROCKS_VERSION }} && ./configure --prefix=/usr && make SHEBANG='#!env lua' && make install"; | |
| Write-Host "Writing a shell entry loading LuaRocks variables to file: ${color}/etc/profile.d/luarocks.sh"; | |
| ${{ env.CYGWIN_BASH }} -lc "echo 'eval `$(luarocks path)' > /etc/profile.d/luarocks.sh"; | |
| - name: Lint rockspecs | |
| working-directory: lua-hash | |
| run: | | |
| ${{ env.CYGWIN_BASH }} -lc "for rockspec in rockspecs/*.rockspec; do echo -e ""Linting rockspec: \e[36m`${rockspec}\e[0m""; luarocks lint ""`${rockspec}""; done"; | |
| - name: Build lua-hash | |
| working-directory: lua-hash | |
| run: | | |
| ${{ env.CYGWIN_BASH }} -lc "rockspec=""rockspecs/${{ env.ROCKSPEC }}""; echo -e ""Building rockspec: \e[36m`${rockspec}\e[0m""; luarocks make `${rockspec};"; | |
| - name: Run samples | |
| working-directory: lua-hash | |
| run: | | |
| ${{ env.CYGWIN_BASH }} -lc "for sample in samples/*.lua; do echo -e ""Running sample file: \e[36m`${sample}\e[0m""; env lua `$sample; done;"; |