Skip to content

fix: add return meta-definition for util.equals (#55) #220

fix: add return meta-definition for util.equals (#55)

fix: add return meta-definition for util.equals (#55) #220

Workflow file for this run

name: release
on:
push:
branches:
- main
jobs:
prepare:
runs-on: ubuntu-latest
outputs:
NEEDS_RELEASE: ${{ steps.prep.outputs.NEEDS_RELEASE }}
VERSION: ${{ steps.prep.outputs.VERSION }}
PRERELEASE: ${{ steps.prep.outputs.PRERELEASE }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: setup eli
uses: alis-is/setup-eli@v1
- name: prepare
id: prep
shell: sh
run: |
PLATFORM=$(uname -m) && echo "PLATFORM=$PLATFORM" >> $GITHUB_OUTPUT
ROOT=$(pwd) && echo "ROOT=$ROOT" >> $GITHUB_OUTPUT
rm -rf release .meta
mkdir -p "$ROOT/release"
VERSION=$(eli -e 'io.write(require"hjson".parse(fs.read_file"config.hjson").version)')
# if VERSION is just 'dev' then we do not need to release
if [ "$VERSION" = "dev" ]; then
NEEDS_RELEASE=false
echo "NEEDS_RELEASE=$NEEDS_RELEASE" >> $GITHUB_OUTPUT
exit 0
fi
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
if git tag -l "$VERSION" | grep "$VERSION"; then
echo "Version $VERSION already exists";
else
NEEDS_RELEASE=true
echo "NEEDS_RELEASE=$NEEDS_RELEASE" >> $GITHUB_OUTPUT
fi
if echo "$VERSION" | grep -E "dev|alpha"; then
PRERELEASE=true
echo "PRERELEASE=$PRERELEASE" >> $GITHUB_OUTPUT
fi
echo "Building eli $VERSION (RELEASE_REQUIRE: $NEEDS_RELEASE)"
build-linux-x86_64:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: build-n-cache
uses: "./.github/template/build-n-cache"
with:
toolchain: zig:x86_64-linux-musl
artifact-id: eli-linux-x86_64
debug-artifact-id: eli-linux-x86_64-debug
build-linux-aarch64:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: build-n-cache
uses: "./.github/template/build-n-cache"
with:
toolchain: zig:aarch64-linux-musl
artifact-id: eli-linux-aarch64
debug-artifact-id: eli-linux-aarch64-debug
build-linux-riscv64:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: build-n-cache
uses: "./.github/template/build-n-cache"
with:
toolchain: zig:riscv64-linux-musl
artifact-id: eli-linux-riscv64
debug-artifact-id: eli-linux-riscv64-debug
build-windows-x86_64:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: build-n-cache
uses: "./.github/template/build-n-cache"
with:
toolchain: zig:x86_64-windows-gnu
artifact-id: eli-windows-x86_64.exe
debug-artifact-id: eli-windows-x86_64-debug.exe
build-windows-aarch64:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: build-n-cache
uses: "./.github/template/build-n-cache"
with:
toolchain: zig:aarch64-windows-gnu
artifact-id: eli-windows-aarch64.exe
debug-artifact-id: eli-windows-aarch64-debug.exe
build-macos-x86_64:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: build-n-cache
uses: "./.github/template/build-n-cache"
with:
toolchain: zig:x86_64-macos-none
artifact-id: eli-macos-x86_64
debug-artifact-id: eli-macos-x86_64-debug
build-macos-aarch64:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: build-n-cache
uses: "./.github/template/build-n-cache"
with:
toolchain: zig:aarch64-macos-none
artifact-id: eli-macos-aarch64
debug-artifact-id: eli-macos-aarch64-debug
# tests
test-linux:
runs-on: ubuntu-latest
needs: [build-linux-x86_64,build-linux-aarch64, build-linux-riscv64]
env:
HTTPBIN_URL: http://localhost:80
services:
httpbin:
image: kennethreitz/httpbin
ports:
- 80:80
steps:
- uses: actions/checkout@v4
- uses: "./.github/template/prepare-test"
- name: test x86_64
uses: addnab/docker-run-action@v3
with:
image: ghcr.io/alis-is/eli-test:latest
run: ./tools/test.sh x86_64
options: -w /root/luabuild -v ${{ github.workspace }}:/root/luabuild -v ${{ github.workspace }}/toolchains:/opt/cross
- name: test aarch64
uses: addnab/docker-run-action@v3
with:
image: ghcr.io/alis-is/eli-test:latest
run: ./tools/test.sh aarch64
options: -w /root/luabuild -v ${{ github.workspace }}:/root/luabuild -v ${{ github.workspace }}/toolchains:/opt/cross
- name: test riscv64
uses: addnab/docker-run-action@v3
with:
image: ghcr.io/alis-is/eli-test:latest
run: ./tools/test.sh riscv64
options: -w /root/luabuild -v ${{ github.workspace }}:/root/luabuild -v ${{ github.workspace }}/toolchains:/opt/cross
test-windows:
runs-on: windows-latest
needs: [build-windows-x86_64, build-windows-aarch64] # we do not test aarch64 because there are no available aarch64 runners
steps:
- uses: actions/checkout@v4
- uses: "./.github/template/prepare-test"
- name: test
shell: pwsh
run: |
.\tools\test.ps1 x86_64
test-macos:
runs-on: macos-latest
needs: [build-macos-x86_64, build-macos-aarch64] # we do not test aarch64 because there are no available aarch64 runners
steps:
- uses: actions/checkout@v4
- uses: "./.github/template/prepare-test"
- name: test
run: |
./tools/test.sh x86_64
test-ami:
runs-on: ubuntu-latest
needs: [build-linux-x86_64]
steps:
- uses: actions/checkout@v4
- uses: "./.github/template/prepare-test"
- uses: actions/checkout@v4
with:
repository: alis-is/ami
path: ami
- name: test ami
run: |
cd ami
../release/eli-linux-x86_64 tests/all.lua
publish:
if: ${{ needs.prepare.outputs.NEEDS_RELEASE == 'true' }}
runs-on: ubuntu-latest
needs: [test-windows, test-linux, test-macos, test-ami, prepare]
steps:
- uses: actions/checkout@v4
- uses: "./.github/template/prepare-test" # downloads artifacts
- name: publish
uses: ncipollo/release-action@v1
with:
artifacts: ./release/*
tag: ${{ needs.prepare.outputs.VERSION }}
commit: ${{ github.sha }}
token: ${{ secrets.GITHUB_TOKEN }}
prerelease: ${{needs.prepare.outputs.PRERELEASE}}