Files
jak-project/.github/workflows/linux-workflow.yaml
T
Hat Kid 0ff6cf4747 actions: add libpulse-dev dependency to fix audio on pipewire systems (#1473)
actions: add libpulse-dev package to dependencies
2022-06-17 22:06:53 -04:00

131 lines
4.5 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 libpulse-dev libxi-dev zip
- 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' && !startsWith(github.ref, 'refs/tags/')
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 \
-DASAN_BUILD=ON
- name: CMake Generation - Clang - No ASAN
if: matrix.compiler == 'clang' && startsWith(github.ref, 'refs/tags/')
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 \
-DASAN_BUILD=OFF
- 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/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