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: Install NASM run: choco install ${{ github.workspace }}/third-party/nasm/nasm.2.15.05.nupkg - name: Setup Buildcache uses: mikehardy/buildcache-action@v1.3.0 with: cache_key: ${{ matrix.os }}-${{ matrix.compiler }} - uses: ilammy/msvc-dev-cmd@v1 # TODO - separate workflows! - name: CMake Generation - Clang shell: cmd if: matrix.compiler == 'clang' && startsWith(github.ref, 'refs/tags/') == false 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 shell: cmd run: | if "${{ matrix.compiler }}" == "msvc" ( set CL=/MP ) cmake --build build -j 2 - name: Run Tests 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' shell: bash run: | mkdir -p ./ci-artifacts/out ./.github/scripts/releases/extract_build_windows.sh ./ci-artifacts/out ./ 7z a -tzip ./ci-artifacts/windows.zip ./ci-artifacts/out/* - 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: zip TAG_TO_SEARCH_FOR: ${{ github.REF }} run: | cd ./.github/scripts/releases/upload-release-artifacts npm ci node index.js