Fix build workflow #8
This file contains hidden or 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
| # | ||
|
Check failure on line 1 in .github/workflows/mapbase_build-base.yml
|
||
| # 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 | ||
| # HACKHACK: MSBuild doesn't seem to recognize Python even when its directory is within PATH, | ||
| # so we currently have to make it call Python directly. | ||
| # This assumes %Python3_ROOT_DIR% will always be set by setup-python above. | ||
| if: inputs.project-group == 'game' || inputs.project-group == 'all' | ||
| working-directory: 'src/game/server' | ||
| shell: bash | ||
| run: | | ||
| sed -i 's/\"python/\"%Python3_ROOT_DIR%\\python/' server_base.vpc | ||
| cat server_base.vpc | ||
| - 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 | ||
| game/mod_${{inputs.game}}/bin/x64/*.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 | ||
| game/bin/x64/*.exe | ||
| game/bin/x64/*.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/bin/x64 | ||
| game/mod_*/bin | ||
| game/mod_*/x64/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/linux64/*.so | ||
| !game/mod_${{inputs.game}}/bin/*_srv.so | ||
| !game/mod_${{inputs.game}}/bin/linux64/*_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/linux64/*.so | ||
| game/bin/*.so | ||
| !game/bin/linux64/*_srv.so | ||
| !game/bin/*_srv.so | ||
| game/mod_*/bin/linux64/*.so | ||
| game/mod_*/bin/*.so | ||
| !game/mod_*/bin/linux64/*_srv.so | ||
| !game/mod_*/bin/*_srv.so | ||
| if-no-files-found: error | ||