Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

overhaul build system and move all ci to github actions #273

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
237 changes: 168 additions & 69 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,86 +1,185 @@
name: CI

on: [push, pull_request]
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:
runs-on: ${{ matrix.os }}
build-unix:
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest]
build_type: [tiny, regular-asm]
runner: [ubuntu-latest, macos-latest]
arch: [x86_64, i686]
build_type: [tiny, regular]
lua_engine: [LuaJIT, Lua]
env:
BUILD_TYPE: ${{ matrix.build_type }}
WITH_LUA_ENGINE: ${{ matrix.lua_engine }}
exclude:
- runner: macos-latest
arch: i686

steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Configure
run: WITHOUT_AMALG=1 make ${BUILD_TYPE} WITH_LUA_ENGINE=${WITH_LUA_ENGINE}
- name: Prepare
run: |
echo "target=$(uname -s)_${{ matrix.arch }}" >> $GITHUB_ENV

- name: Build
run: make
chmod +x packaging/hbb && sudo mv packaging/hbb /usr/local/bin/hbb

- name: Test
run: make test
- name: Configure
shell: hbb {0}
run: |
CFLAGS=${CFLAGS//-fvisibility=hidden}
CFLAGS=${CFLAGS//-g}

deploy-linux:
if: startsWith(github.ref, 'refs/tags/')
needs: [build]
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@v2
with:
submodules: recursive

- name: Fetch
run: git fetch --unshallow --no-recurse-submodules

- name: Build
run: make linux-build

- name: Github Release
id: create_release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: |
luvi-regular-Linux_x86_64
luvi-tiny-Linux_x86_64
luvi-regular-Linux_i686
luvi-tiny-Linux_i686
draft: false
prerelease: false

deploy-macos:
- 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/')
needs: [build]
runs-on: macos-latest

steps:
- uses: actions/checkout@v2
with:
submodules: recursive

- name: Fetch
run: git fetch --unshallow --no-recurse-submodules

- name: Build
run: make travis-publish

- name: Github Release
id: create_release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: |
luvi-regular-Darwin_x86_64
luvi-tiny-Darwin_x86_64
luvi-src-*.tar.gz
draft: false
prerelease: false
- 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/*
7 changes: 4 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
build
luvi-src.tar.gz
build*
*.tar.gz
logs
luvi.exe
VERSION
VERSION
Loading