Files
jak-project/.github/workflows/windows-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

102 lines
3.9 KiB
YAML

name: Windows
# 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: [windows-2022]
compiler: [msvc, clang]
experimental: [false]
name: ${{ matrix.compiler }}
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.experimental }}
# 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: Install Dependencies
run: Choco-Install -PackageName nasm
- name: Setup Buildcache
uses: mikehardy/buildcache-action@v1.2.2
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 .
)
- 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
- name: Run Tests
timeout-minutes: 5
env:
NEXT_DIR: ${{ github.workspace }}
run: ./build/bin/goalc-test.exe --gtest_color=yes --gtest_filter="-*MANUAL_TEST*"
# ---- 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/bin/decompiler.exe ./ci-artifacts/windows-decompiler.exe
cp ./build/bin/gk.exe ./ci-artifacts/windows-gk.exe
cp ./build/bin/goalc.exe ./ci-artifacts/windows-goalc.exe
ls ./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: exe
TAG_TO_SEARCH_FOR: ${{ github.REF }}
run: |
cd ./.github/scripts/releases/upload-release-artifacts
npm ci
node index.js