feature: Added support for FreeBSD, NetBSD, OpenBSD and DragonFly. #58
Workflow file for this run
This file contains 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/**" | |
pull_request: | |
paths-ignore: | |
- "**.md" | |
- "docs/**" | |
env: | |
ROCKSPEC_VERSION: 0.0.4 | |
DEV_ROCKSPEC: lua-uuid-dev-1.rockspec | |
jobs: | |
build: | |
name: Build | |
runs-on: ${{ matrix.os }} | |
defaults: | |
run: | |
shell: pwsh | |
strategy: | |
matrix: | |
lua-version: | |
- 5.1 | |
- 5.2 | |
- 5.3 | |
- 5.4 | |
- luajit | |
os: | |
- windows-latest | |
- ubuntu-latest | |
- macos-latest | |
exclude: | |
- os: macos-latest | |
lua-version: luajit | |
steps: | |
- name: Set environment variable to hold the rockspec name | |
run: | | |
if ("${{ github.repository }}" -eq "luau-project/lua-uuid" -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-uuid-${{ env.ROCKSPEC_VERSION }}-0.rockspec"; | |
} | |
else | |
{ | |
Add-Content "${{ github.env }}" "ROCKSPEC=${{ env.DEV_ROCKSPEC }}"; | |
} | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
path: lua-uuid | |
- name: Install libuuid-dev | |
if: ${{ matrix.os == 'ubuntu-latest' }} | |
run: sudo apt install -y uuid-dev | |
- name: Setup MSVC dev-prompt | |
if: ${{ matrix.os == 'windows-latest' && matrix.lua-version != 'luajit' }} | |
uses: ilammy/msvc-dev-cmd@v1 | |
- name: Setup Lua | |
uses: luarocks/gh-actions-lua@v10 | |
with: | |
luaVersion: ${{ matrix.lua-version }} | |
- name: Setup LuaRocks | |
uses: luarocks/gh-actions-luarocks@v5 | |
- name: Build lua-uuid | |
working-directory: lua-uuid | |
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-uuid | |
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 "$_"; | |
}; | |
msys2-build: | |
name: MSYS2 Build | |
runs-on: windows-latest | |
defaults: | |
run: | |
shell: msys2 {0} | |
strategy: | |
matrix: | |
MSYS2_CONFIG: | |
- { sys: mingw64, env: x86_64 } | |
- { sys: ucrt64, env: ucrt-x86_64 } | |
- { sys: clang64, env: clang-x86_64 } | |
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@v2 | |
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-uuid" ]] && [[ "${{ github.ref_name }}" == "v${{ env.ROCKSPEC_VERSION }}" ]] && [[ "${{ github.ref }}" == "refs/tags/v${{ env.ROCKSPEC_VERSION }}" ]]; | |
then | |
echo "ROCKSPEC=lua-uuid-${{ env.ROCKSPEC_VERSION }}-0.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@v4 | |
with: | |
path: lua-uuid | |
- name: Build lua-uuid | |
working-directory: lua-uuid | |
run: | | |
rockspec="rockspecs/${{ env.ROCKSPEC }}" | |
echo -e "Building rockspec: \e[36m${rockspec}\e[0m" | |
luarocks make ${rockspec} | |
- name: Run samples | |
working-directory: lua-uuid | |
run: | | |
for sample in samples/*.lua; | |
do | |
echo -e "Running sample file: \e[36m${sample}\e[0m" | |
${{ env.LUA_INTERPRETER }} $sample; | |
done; | |
upload-rockspec: | |
name: Upload rockspec | |
runs-on: ubuntu-latest | |
if: ${{ github.repository == 'luau-project/lua-uuid' && startsWith(github.ref, 'refs/tags/') }} | |
needs: | |
- build | |
- msys2-build | |
defaults: | |
run: | |
shell: pwsh | |
steps: | |
- name: Set environment variable to hold the rockspec name | |
run: | | |
if ("${{ github.repository }}" -eq "luau-project/lua-uuid" -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-uuid-${{ env.ROCKSPEC_VERSION }}-0.rockspec"; | |
} | |
else | |
{ | |
Add-Content "${{ github.env }}" "ROCKSPEC=${{ env.DEV_ROCKSPEC }}"; | |
} | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
path: lua-uuid | |
- name: Install libuuid-dev | |
run: sudo apt install -y uuid-dev libssl-dev | |
- name: Setup Lua | |
uses: luarocks/gh-actions-lua@v10 | |
- name: Setup LuaRocks | |
uses: luarocks/gh-actions-luarocks@v5 | |
- name: Install dependencies | |
run: | | |
luarocks install dkjson | |
luarocks install luasocket | |
luarocks install luasec | |
- name: Upload rockspec to LuaRocks | |
working-directory: lua-uuid | |
env: | |
UPLOAD_KEY: ${{ secrets.LUAROCKS_APIKEY }} | |
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 "Uploading rockspec: ${color}${rockspec}"; | |
luarocks upload $rockspec "--api-key=$env:UPLOAD_KEY" --skip-pack |