overhaul build system and move all ci to github actions #59
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: | |
pull_request: | |
concurrency: # Cancels pending runs when a PR gets updated. | |
group: ${{ github.head_ref || github.run_id }}-${{ github.actor }} | |
cancel-in-progress: true | |
jobs: | |
build-unix: | |
runs-on: ${{ matrix.runner }} | |
strategy: | |
fail-fast: false | |
matrix: | |
runner: [ubuntu-latest, macos-latest] | |
arch: [x86_64, i686] | |
build_type: [tiny, regular] | |
lua_engine: [LuaJIT, Lua] | |
exclude: | |
- runner: macos-latest | |
arch: i686 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Prepare | |
run: | | |
echo "target=$(uname -s)_${{ matrix.arch }}" >> $GITHUB_ENV | |
chmod +x packaging/hbb && sudo mv packaging/hbb /usr/local/bin/hbb | |
- name: Configure | |
shell: hbb {0} | |
run: | | |
CFLAGS=${CFLAGS//-fvisibility=hidden} | |
CFLAGS=${CFLAGS//-g} | |
make ${{ matrix.build_type }} WITH_LUA_ENGINE=${{ matrix.lua_engine }} | |
- name: Build | |
shell: hbb {0} | |
run: make | |
- name: Test | |
shell: hbb {0} | |
run: | | |
make test | |
- name: Upload Build Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: luvi-${{ env.target }}-${{ matrix.lua_engine }}-${{ matrix.build_type }} | |
path: build/luvi | |
build-linux-arm: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
arch: [armv6, armv7, aarch64] | |
build_type: [tiny, regular] | |
lua_engine: [LuaJIT, Lua] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Reload Cache | |
uses: actions/cache@v3 | |
with: | |
path: .ccache | |
key: ccache-Linux_${{ matrix.arch }}-${{ matrix.build_type}}-${{ matrix.lua_engine }}-${{ github.actor }}-${{ github.run_id }} | |
restore-keys: | | |
ccache-Linux_${{ matrix.arch }}-${{ matrix.build_type}}-${{ matrix.lua_engine }}-${{ github.actor }}- | |
- name: Prepare | |
run: | | |
sudo apt install -y ccache | |
export CCACHE_DIR=$PWD/.ccache | |
echo "CCACHE_DIR=$CCACHE_DIR" >> $GITHUB_ENV | |
ccache -z | |
- uses: uraimo/run-on-arch-action@v2 | |
name: Build | |
with: | |
distro: stretch | |
arch: ${{ matrix.arch }} | |
dockerRunArgs: | | |
-v $PWD/.ccache:/.ccache | |
shell: /bin/bash | |
install: | | |
apt-get update -q -y | |
apt-get install -q -y build-essential perl git cmake ccache | |
run: | | |
export CCACHE_DIR=/.ccache | |
/usr/sbin/update-ccache-symlinks | |
export PATH="/usr/lib/ccache:$PATH" | |
make ${{ matrix.build_type }} WITH_LUA_ENGINE=${{ matrix.lua_engine }} | |
make | |
make test | |
- name: Report | |
run: | | |
ccache -s -v | |
ccache -X 9 | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: luvi-Linux_${{ matrix.arch }}-${{ matrix.lua_engine }}-${{ matrix.build_type }} | |
path: build/luvi | |
build-windows: | |
runs-on: windows-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
arch: [i686, x86_64] | |
build_type: [tiny, regular] | |
env: | |
ARCH: ${{ matrix.arch }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Prepare NASM | |
uses: ilammy/setup-nasm@v1 | |
- name: Configure | |
run: ./make ${{ matrix.build_type }} | |
- name: Build | |
run: ./make | |
- name: Test | |
run: ./make test | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: luvi-Windows_${{ matrix.arch }}-${{ matrix.build_type }} | |
path: | | |
build/Release/luvi.exe | |
build/Release/luvi.lib | |
build/Release/luvi_renamed.lib | |
release: | |
runs-on: ubuntu-latest | |
needs: [build-unix, build-linux-arm, build-windows] | |
if: startsWith(github.ref, 'refs/tags/') | |
steps: | |
- name: Download Build Artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
path: build | |
- name: Prepare | |
run: | | |
mkdir artifacts | |
for target in build/*; do | |
for file in $target/*; do | |
file_name=$(basename $file) | |
target_name=$(basename $target) | |
name=${file_name/luvi/$target_name} | |
mv $file artifacts/$name | |
done | |
done | |
- name: Upload Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: artifacts/* |