Files
jak-project/.github/workflows/linux-workflow.yaml
T
Tyler Wilding e74bd3b32b ci: Add an automated release process (#1262)
* ci: bring over some of my code to enable the process

* ci: cleanup builds a bit and add release stuff

* ci: fix paths and such after debugging

* ci: fix flowchart

* cmake: easily toggle between building everything dyn or statically linked

* ci: build release artifacts statically linked

* ci: fix some issues after testing once again, linux binaries are still too big
2022-03-29 22:47:08 -04:00

124 lines
4.3 KiB
YAML

name: Linux
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches:
- master
tags:
- v*
pull_request:
branches:
- master
jobs:
build:
strategy:
# Prevent one build from failing everything (although maybe those should be included as experimental builds instead)
fail-fast: false
matrix:
os: [ubuntu-20.04]
compiler: [clang, gcc]
name: ${{ matrix.compiler }}
runs-on: ${{ matrix.os }}
# Set some sort of timeout in the event of run-away builds. We are limited on concurrent jobs so, get rid of them.
timeout-minutes: 45
env: # overrides: https://github.com/mbitsnbites/buildcache/blob/master/doc/configuration.md
BUILDCACHE_MAX_CACHE_SIZE: 1000000000 # 1gb
BUILDCACHE_COMPRESS_FORMAT: ZSTD
BUILDCACHE_COMPRESS_LEVEL: 19
BUILDCACHE_DIRECT_MODE: true
BUILDCACHE_LOG_FILE: ${{ github.workspace }}/buildcache.log
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Checkout Submodules
run: git submodule update --init --recursive -j 2
- name: Get Common Package Dependencies
run: sudo apt install build-essential cmake clang gcc g++ lcov make nasm libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev
- name: Get Clang
if: matrix.compiler == 'clang'
run: sudo apt install clang
- name: Setup Buildcache
uses: mikehardy/buildcache-action@v1.2.2
with:
cache_key: ${{ matrix.os }}-${{ matrix.compiler }}
- name: CMake Generation - Clang
if: matrix.compiler == 'clang'
run: |
export CC=clang
export CXX=clang++
cmake -B build \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_FOR_RELEASE=ON \
-DCMAKE_C_COMPILER_LAUNCHER="${{ github.workspace }}"/buildcache/bin/buildcache \
-DCMAKE_CXX_COMPILER_LAUNCHER="${{ github.workspace }}"/buildcache/bin/buildcache \
-DCODE_COVERAGE=ON -DASAN_BUILD=ON
- name: CMake Generation - GCC
if: matrix.compiler == 'gcc'
run: |
export CC=gcc
export CXX=g++
cmake -B build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_COMPILER_LAUNCHER="${{ github.workspace }}"/buildcache/bin/buildcache \
-DCMAKE_CXX_COMPILER_LAUNCHER="${{ github.workspace }}"/buildcache/bin/buildcache \
-DCODE_COVERAGE=ON
- name: Build Project
working-directory: ./build
run: make -j4
- name: Run Tests
if: matrix.compiler == 'clang'
run: ./test.sh
- name: Run Tests - With Coverage
if: matrix.compiler == 'gcc'
run: ./test_code_coverage.sh
- name: Submit Coverage Report to Codacy
if: ${{ matrix.compiler }} == 'gcc'
uses: codacy/codacy-coverage-reporter-action@v1
continue-on-error: true
with:
project-token: ${{ secrets.CODACY_PROJECT_KEY }}
# lcov report
coverage-reports: ./build/goalc-test_coverage.info
# ---- Release / Tagging related steps ----
- name: Prepare Build Artifacts
if: github.repository == 'open-goal/jak-project' && startsWith(github.ref, 'refs/tags/') && matrix.compiler == 'clang'
run: |
mkdir -p ./ci-artifacts/
cp ./build/decompiler/decompiler ./ci-artifacts/linux-decompiler.bin
cp ./build/game/gk ./ci-artifacts/linux-gk.bin
cp ./build/goalc/goalc ./ci-artifacts/linux-goalc.bin
chmod +x ./ci-artifacts/*.bin
strip --strip-debug ./ci-artifacts/linux-decompiler.bin
strip --strip-debug ./ci-artifacts/linux-gk.bin
strip --strip-debug ./ci-artifacts/linux-goalc.bin
ls -l ./ci-artifacts/
- name: Upload Assets and Potential Publish Release
if: github.repository == 'open-goal/jak-project' && startsWith(github.ref, 'refs/tags/') && matrix.compiler == 'clang'
env:
GITHUB_TOKEN: ${{ secrets.BOT_PAT }}
ASSET_DIR: ${{ github.WORKSPACE }}/ci-artifacts
ASSET_EXTENSION: bin
TAG_TO_SEARCH_FOR: ${{ github.REF }}
run: |
cd ./.github/scripts/releases/upload-release-artifacts
npm ci
node index.js