Adapt stable branch changes to readme to master branch (compilation i… #61
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow uses actions that are not certified by GitHub. | |
# They are provided by a third-party and are governed by | |
# separate terms of service, privacy policy, and support | |
# documentation. | |
name: MSBuild | |
on: | |
push: | |
pull_request: | |
env: | |
# Path to the solution file relative to the root of the project. | |
SOLUTION_FILE_PATH: build\Incursion.sln | |
# Generated files to clean and check | |
GENERATED_FILES: src/tokens.cpp src/yygram.cpp inc/yygram.h | |
permissions: | |
contents: read | |
jobs: | |
build: | |
strategy: | |
matrix: | |
configuration: ["Release", "Debug"] | |
platform: ["Win32", "x64"] | |
runs-on: windows-2022 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Add MSBuild to PATH | |
uses: microsoft/setup-msbuild@v2 | |
- name: Obtain external dependencies | |
run: | | |
pushd dependencies | |
curl -L -O https://github.com/libtcod/libtcod/releases/download/1.7.0/libtcod-1.7.0-${{ matrix.platform == 'Win32' && 'x86' || 'x86_64' }}-msvc.zip | |
7z x libtcod-*.zip | |
popd | |
- name: Clean generated files | |
if: matrix.platform == 'Win32' && matrix.configuration == 'Debug' | |
shell: bash | |
run: rm -v ${{env.GENERATED_FILES}} | |
- name: Build | |
# Add additional options to the MSBuild command line here (like platform or verbosity level). | |
# See https://docs.microsoft.com/visualstudio/msbuild/msbuild-command-line-reference | |
run: msbuild /m /p:Configuration=${{matrix.configuration}} /p:Platform=${{matrix.platform}} ${{env.SOLUTION_FILE_PATH}} | |
- name: Verify generated files | |
run: git diff --exit-code ${{env.GENERATED_FILES}} | |
- name: Copy binaries to project root | |
shell: bash | |
run: cp -v build/*/*/exe_libtcod/Incursion.exe dependencies/libtcod-*/libtcod.dll dependencies/libtcod-*/SDL2.dll . | |
- name: Compile mod | |
if: matrix.configuration == 'Debug' | |
shell: bash | |
run: ./Incursion.exe -compile | |
- name: Upload mod | |
if: matrix.configuration == 'Debug' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: mod-${{ matrix.platform }} | |
path: mod | |
retention-days: 1 | |
- name: Upload binaries | |
uses: actions/upload-artifact@v4 | |
with: | |
name: direct-binaries-${{matrix.configuration}}-${{matrix.platform}} | |
path: | | |
*.exe | |
*.dll | |
retention-days: 1 | |
package: | |
needs: [build] | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
platform: ["Win32", "x64"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Fetch mod | |
uses: actions/download-artifact@v4 | |
with: | |
name: mod-${{ matrix.platform }} | |
path: mod | |
- name: Fetch binaries | |
uses: actions/download-artifact@v4 | |
with: | |
name: direct-binaries-Release-${{matrix.platform}} | |
path: . | |
- name: Package Incursion | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Incursion-${{matrix.platform}} | |
path: | | |
*.exe | |
*.dll | |
*.md | |
*.txt | |
fonts | |
docs | |
mod | |
retention-days: 30 | |
compression-level: 9 |