source-sdk-2013-mapbase/.github/workflows/mapbase_build-base.yml
2025-03-02 09:43:07 -06:00

183 lines
5.7 KiB
YAML

#
# MAPBASE SOURCE 2013 CI
#
# This workflow script automatically builds the Source SDK 2013 codebase on Windows and Linux using GitHub Actions.
#
# This is useful in a number of ways:
#
# 1. It ensures pull requests compile correctly on multiple platforms and provides binaries that can be used to test them.
# 2. It can be used to compile code for releases without having to pull and prepare a local development environment.
# 3. It opens potential for scripts that can employ more principles of CI/CD. (e.g. automatically publishing a release)
#
# This is based on a workflow originally created by z33ky.
name: Build Projects
on:
workflow_call:
inputs:
configuration:
description: 'Which configuration to build with'
default: 'Release'
required: true
type: string
game:
description: 'The name of the game to build (if relevant)'
default: 'episodic'
required: false
type: string
project-group:
description: 'Which group of projects to compile'
required: true
type: string
solution-name:
description: 'The name of the solution/makefile'
required: true
type: string
build-on-linux:
description: 'Build on Ubuntu/Linux?'
default: true
required: false
type: boolean
jobs:
build_windows:
name: Windows (VS2022)
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.13'
- name: Add MSBuild to PATH
uses: compnerd/gha-setup-vsdevenv@v6
- name: Pick game
if: inputs.project-group == 'game' || inputs.project-group == 'shaders'
working-directory: 'src'
shell: bash
run: sed -i 's/\/hl2mp \/tf/\/${{inputs.game}}/' create${{inputs.project-group}}projects.bat
- name: Create project files
working-directory: 'src'
shell: cmd
run: |
create${{inputs.project-group}}projects.bat
# --------------------------------------------------------------------
- name: Build
#if: steps.filter.outputs.game == 'true'
working-directory: 'src'
shell: cmd
run: |
devenv ${{inputs.solution-name}}.sln /upgrade
msbuild -m -t:Rebuild -p:Configuration=${{inputs.configuration}};Platform=win64 ${{inputs.solution-name}}.sln
# --------------------------------------------------------------------
- name: Publish game binaries
if: inputs.project-group == 'game' || inputs.project-group == 'shaders'
uses: actions/upload-artifact@v4
with:
name: '${{inputs.project-group}}_${{inputs.game}}_win32_${{ inputs.configuration }}'
path: |
game/mod_${{inputs.game}}/bin/*.dll
if-no-files-found: error
- name: Publish map tools
if: inputs.project-group == 'maptools'
uses: actions/upload-artifact@v4
with:
name: '${{inputs.project-group}}_win32_${{ inputs.configuration }}'
path: |
game/bin/*.exe
game/bin/*.dll
if-no-files-found: error
- name: Publish everything
if: inputs.project-group == 'all'
uses: actions/upload-artifact@v4
with:
name: 'everything_win32_${{ inputs.configuration }}'
path: |
game/bin
game/mod_*/bin
if-no-files-found: error
build_ubuntu:
if: inputs.build-on-linux == true && inputs.project-group != 'maptools' # No Linux map tools for now
name: Ubuntu (GCC/G++)
runs-on: ubuntu-latest
env:
config: ${{ inputs.configuration }}
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get -y install podman python3
- name: Pick game
if: inputs.project-group == 'game' || inputs.project-group == 'shaders'
working-directory: 'src'
shell: bash
run: sed -i 's/\/hl2mp \/tf/\/${{inputs.game}}/' build${{inputs.project-group}}projects
- name: Set configuration
working-directory: 'src'
shell: bash
run: |
config=${{inputs.configuration}}
export CFG=${config,,}
echo "config=${CFG}" >> $GITHUB_ENV
# --------------------------------------------------------------------
- name: Build
working-directory: 'src'
run: ./build${{inputs.project-group}}projects ${config,,}
# --------------------------------------------------------------------
- name: Publish game binaries
if: inputs.project-group == 'game' || inputs.project-group == 'shaders'
uses: actions/upload-artifact@v4
with:
name: '${{inputs.project-group}}_${{inputs.game}}_linux32_${{ inputs.configuration }}'
path: |
game/mod_${{inputs.game}}/bin/*.so
!game/mod_${{inputs.game}}/bin/*_srv.so
if-no-files-found: error
#- name: Publish map tools
# if: inputs.project-group == 'maptools'
# uses: actions/upload-artifact@v4
# with:
# name: '${{inputs.project-group}}_linux32_${{ inputs.configuration }}'
# path: |
# game/bin/vbsp
# game/bin/vvis
# game/bin/vvis_dll.so
# game/bin/vrad
# game/bin/vrad_dll.so
# if-no-files-found: error
# For now, don't publish the .dbg files even though we publish .pdb files on Windows
# (they're too big)
- name: Publish everything
if: inputs.project-group == 'all'
uses: actions/upload-artifact@v4
with:
name: 'everything_linux32_${{ inputs.configuration }}'
path: |
game/bin/*.so
!game/bin/*_srv.so
game/mod_*/bin/*.so
!game/mod_*/bin/*_srv.so
if-no-files-found: error