mirror of
https://github.com/open-goal/jak-project
synced 2026-07-11 15:28:58 -04:00
build: get rid of clang-cl in favor of actual clang among other things (#1589)
* 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
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
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:
|
||||
@@ -15,7 +13,6 @@ on:
|
||||
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]
|
||||
@@ -23,7 +20,6 @@ jobs:
|
||||
|
||||
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
|
||||
@@ -33,63 +29,66 @@ jobs:
|
||||
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: 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: 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.2.2
|
||||
uses: mikehardy/buildcache-action@v1.3.0
|
||||
with:
|
||||
cache_key: ${{ matrix.os }}-${{ matrix.compiler }}
|
||||
|
||||
- name: CMake Generation - Clang
|
||||
if: matrix.compiler == 'clang' && !startsWith(github.ref, 'refs/tags/')
|
||||
# TODO - CMake - replace with presets!
|
||||
- name: CMake Generation - Clang - ASAN
|
||||
if: matrix.compiler == 'clang'
|
||||
env:
|
||||
CC: clang
|
||||
CXX: clang++
|
||||
run: |
|
||||
export CC=clang
|
||||
export CXX=clang++
|
||||
ls -l ${{ github.workspace }}/buildcache/bin/buildcache
|
||||
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
|
||||
-DASAN_BUILD=ON \
|
||||
-DCMAKE_C_COMPILER_LAUNCHER=${{ github.workspace }}/buildcache/bin/buildcache \
|
||||
-DCMAKE_CXX_COMPILER_LAUNCHER=${{ github.workspace }}/buildcache/bin/buildcache
|
||||
|
||||
- name: CMake Generation - Clang - No ASAN
|
||||
# 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: |
|
||||
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
|
||||
-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: |
|
||||
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
|
||||
-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 -j4
|
||||
run: make -j$((`nproc`+1))
|
||||
|
||||
- name: Run Tests
|
||||
if: matrix.compiler == 'clang'
|
||||
@@ -105,9 +104,27 @@ jobs:
|
||||
continue-on-error: true
|
||||
with:
|
||||
project-token: ${{ secrets.CODACY_PROJECT_KEY }}
|
||||
# lcov report
|
||||
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'
|
||||
|
||||
@@ -39,45 +39,52 @@ jobs:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Checkout Submodules
|
||||
run: git submodule update --init --recursive -j 2
|
||||
|
||||
- name: Install Dependencies
|
||||
run: Choco-Install -PackageName nasm
|
||||
- name: Install NASM
|
||||
run: choco install ${{ github.workspace }}/third-party/nasm/nasm.2.15.05.nupkg
|
||||
|
||||
- name: Setup Buildcache
|
||||
uses: mikehardy/buildcache-action@v1.2.2
|
||||
uses: mikehardy/buildcache-action@v1.3.0
|
||||
with:
|
||||
cache_key: ${{ matrix.os }}-${{ matrix.compiler }}
|
||||
|
||||
# TODO - eventually fight with this to get it to use Ninja and such
|
||||
- name: CMake Generation
|
||||
shell: cmd # ideally id like everything to be powershell but running this bat file is finicky
|
||||
run: |
|
||||
if "${{ matrix.compiler }}" == "clang" (
|
||||
call "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvars64.bat"
|
||||
cmake -B build -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DBUILD_FOR_RELEASE=ON -DCMAKE_C_COMPILER="C:/Program Files/LLVM/bin/clang-cl.exe" -DCMAKE_CXX_COMPILER="C:/Program Files/LLVM/bin/clang-cl.exe" .
|
||||
) else (
|
||||
call "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvars64.bat"
|
||||
cmake -B build -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER_LAUNCHER="${{ github.workspace }}"/buildcache/bin/buildcache.exe -DCMAKE_CXX_COMPILER_LAUNCHER="${{ github.workspace }}"/buildcache/bin/buildcache.exe .
|
||||
)
|
||||
- uses: ilammy/msvc-dev-cmd@v1
|
||||
|
||||
# TODO - separate workflows!
|
||||
|
||||
- name: CMake Generation - Clang
|
||||
shell: cmd
|
||||
if: matrix.compiler == 'clang'
|
||||
run: cmake -B build --preset=Release-clang -DCMAKE_C_COMPILER_LAUNCHER=${{ github.workspace }}/buildcache/bin/buildcache.exe -DCMAKE_CXX_COMPILER_LAUNCHER=${{ github.workspace }}/buildcache/bin/buildcache.exe .
|
||||
|
||||
- name: CMake Generation - Clang - Statically Linked
|
||||
shell: cmd
|
||||
if: matrix.compiler == 'clang' && startsWith(github.ref, 'refs/tags/')
|
||||
run: cmake -B build --preset=Release-clang-static -DCMAKE_C_COMPILER_LAUNCHER=${{ github.workspace }}/buildcache/bin/buildcache.exe -DCMAKE_CXX_COMPILER_LAUNCHER=${{ github.workspace }}/buildcache/bin/buildcache.exe .
|
||||
|
||||
- name: CMake Generation - MSVC
|
||||
shell: cmd
|
||||
if: matrix.compiler == 'msvc'
|
||||
run: cmake -B build --preset=Release-msvc -DCMAKE_C_COMPILER_LAUNCHER=${{ github.workspace }}/buildcache/bin/buildcache.exe -DCMAKE_CXX_COMPILER_LAUNCHER=${{ github.workspace }}/buildcache/bin/buildcache.exe .
|
||||
|
||||
- name: Build Project
|
||||
working-directory: ./build
|
||||
shell: cmd
|
||||
run: |
|
||||
call "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvars64.bat"
|
||||
if "${{ matrix.compiler }}" == "msvc" (
|
||||
set CL=/MP
|
||||
)
|
||||
nmake
|
||||
cmake --build build -j 2
|
||||
|
||||
- name: Run Tests
|
||||
timeout-minutes: 5
|
||||
env:
|
||||
NEXT_DIR: ${{ github.workspace }}
|
||||
timeout-minutes: 10
|
||||
run: ./build/bin/goalc-test.exe --gtest_color=yes --gtest_filter="-*MANUAL_TEST*"
|
||||
|
||||
- name: Upload artifact
|
||||
if: matrix.compiler == 'clang'
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: opengoal-${{ matrix.os }}-${{ matrix.compiler }}
|
||||
path: ./build/bin
|
||||
|
||||
# ---- Release / Tagging related steps ----
|
||||
- name: Prepare Build Artifacts
|
||||
if: github.repository == 'open-goal/jak-project' && startsWith(github.ref, 'refs/tags/') && matrix.compiler == 'clang'
|
||||
|
||||
Reference in New Issue
Block a user