mirror of
https://github.com/open-goal/jak-project
synced 2026-05-23 06:54:31 -04:00
8fefd298fd
* git: ignore vs build dir * cmake: ditch `clang-cl` on windows in favor of actual `clang` * build: suppress a significant number of warnings * build: adjust workflows and vendor nasm * docs: update docs to remove `clang-cl` mentions * build: fix some copy-paste mistakes in the linux build * build: remove C++20 compat warnings as that is useful if we want to upgrade
148 lines
4.8 KiB
YAML
148 lines
4.8 KiB
YAML
name: Linux
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
tags:
|
|
- v*
|
|
pull_request:
|
|
branches:
|
|
- master
|
|
|
|
jobs:
|
|
build:
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [ubuntu-20.04]
|
|
compiler: [clang, gcc]
|
|
|
|
name: ${{ matrix.compiler }}
|
|
runs-on: ${{ matrix.os }}
|
|
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
|
|
|
|
# TODO - separate clang and gcc into separate workflows
|
|
|
|
steps:
|
|
- name: Checkout Repository
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Install Package Dependencies
|
|
run: >
|
|
sudo apt install build-essential cmake
|
|
clang gcc g++ lcov make nasm libxrandr-dev
|
|
libxinerama-dev libxcursor-dev libpulse-dev
|
|
libxi-dev zip
|
|
|
|
- name: Setup Buildcache
|
|
uses: mikehardy/buildcache-action@v1.3.0
|
|
with:
|
|
cache_key: ${{ matrix.os }}-${{ matrix.compiler }}
|
|
|
|
# TODO - CMake - replace with presets!
|
|
- name: CMake Generation - Clang - ASAN
|
|
if: matrix.compiler == 'clang'
|
|
env:
|
|
CC: clang
|
|
CXX: clang++
|
|
run: |
|
|
ls -l ${{ github.workspace }}/buildcache/bin/buildcache
|
|
cmake -B build \
|
|
-DCMAKE_BUILD_TYPE=Release \
|
|
-DASAN_BUILD=ON \
|
|
-DCMAKE_C_COMPILER_LAUNCHER=${{ github.workspace }}/buildcache/bin/buildcache \
|
|
-DCMAKE_CXX_COMPILER_LAUNCHER=${{ github.workspace }}/buildcache/bin/buildcache
|
|
|
|
# TODO - CMake - replace with presets!
|
|
- name: CMake Generation - Clang - Statically Linked
|
|
if: matrix.compiler == 'clang' && startsWith(github.ref, 'refs/tags/')
|
|
env:
|
|
CC: clang
|
|
CXX: clang++
|
|
run: |
|
|
cmake -B build \
|
|
-DCMAKE_BUILD_TYPE=Release \
|
|
-DSTATICALLY_LINK=ON \
|
|
-DCMAKE_C_COMPILER_LAUNCHER=${{ github.workspace }}/buildcache/bin/buildcache \
|
|
-DCMAKE_CXX_COMPILER_LAUNCHER=${{ github.workspace }}/buildcache/bin/buildcache
|
|
|
|
- name: CMake Generation - GCC
|
|
if: matrix.compiler == 'gcc'
|
|
env:
|
|
CC: gcc
|
|
CXX: g++
|
|
run: |
|
|
cmake -B build \
|
|
-DCMAKE_BUILD_TYPE=Release \
|
|
-DCODE_COVERAGE=ON \
|
|
-DCMAKE_C_COMPILER_LAUNCHER=${{ github.workspace }}/buildcache/bin/buildcache \
|
|
-DCMAKE_CXX_COMPILER_LAUNCHER=${{ github.workspace }}/buildcache/bin/buildcache
|
|
|
|
- name: Build Project
|
|
working-directory: ./build
|
|
run: make -j$((`nproc`+1))
|
|
|
|
- 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 }}
|
|
coverage-reports: ./build/goalc-test_coverage.info
|
|
|
|
- name: Upload artifact
|
|
# NOTE - the GCC executables are huge as they've been compiled with coverage support
|
|
if: matrix.compiler == 'clang'
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: opengoal-${{ matrix.os }}-${{ matrix.compiler }}
|
|
path: |
|
|
./build/**/*.so
|
|
./build/**/*.a
|
|
./build/decompiler/decompiler
|
|
./build/decompiler/extractor
|
|
./build/game/gk
|
|
./build/sound/sndplay
|
|
./build/goalc/goalc
|
|
./build/tools/dgo_packer
|
|
./build/tools/dgo_unpacker
|
|
./build/tools/memory_dump_tolls
|
|
./build/tools/level_tools/level_dump
|
|
|
|
# ---- 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/out
|
|
./.github/scripts/releases/extract_build_linux.sh ./ci-artifacts/out ./
|
|
cd ci-artifacts/out
|
|
tar czf ../linux.tar.gz .
|
|
|
|
- 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: gz
|
|
TAG_TO_SEARCH_FOR: ${{ github.REF }}
|
|
run: |
|
|
cd ./.github/scripts/releases/upload-release-artifacts
|
|
npm ci
|
|
node index.js
|