Skip to content

use tbc variables (#45) #149

use tbc variables (#45)

use tbc variables (#45) #149

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 }}
steps:
- uses: actions/checkout@v3
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)')
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
echo "Building eli $VERSION (RELEASE_REQUIRE: $NEEDS_RELEASE)"
build-linux-x86_64:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
- 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@v3
with:
submodules: true
- 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@v3
with:
submodules: true
- 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@v3
with:
submodules: true
- 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@v3
with:
submodules: true
- 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@v3
with:
submodules: true
- 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@v3
with:
submodules: true
- 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@v3
- 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@v3
- 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@v3
- uses: "./.github/template/prepare-test"
- name: test
run: |
./tools/test.sh x86_64
publish:
if: ${{ needs.prepare.outputs.NEEDS_RELEASE == 'true' }}
runs-on: ubuntu-latest
needs: [test-windows, test-linux, test-macos, prepare]
steps:
- uses: actions/checkout@v3
- 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 }}