Skip to content

Merge pull request #26 from unibuc-cs/gamemodes #140

Merge pull request #26 from unibuc-cs/gamemodes

Merge pull request #26 from unibuc-cs/gamemodes #140

Workflow file for this run

name: CI/CD Workflow
on:
push:
branches: ['*']
tags: ['*']
pull_request:
branches: ['*']
permissions:
contents: write
checks: write
pull-requests: write
env:
SOLUTION_FILE_PATH: 'DeadZone.sln'
ZIP_NAME: 'windows-x64'
jobs:
windows:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
build-configuration: [Debug, Release]
build-platform: [x64]
steps:
- name: Clone Git Repository
uses: actions/checkout@v4
with:
repository: 'unibuc-cs/software-engineering-product-deadzone'
submodules: true
- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v2
with:
msbuild-architecture: x64
- name: Add VSTest.console.exe to PATH
uses: darenm/[email protected]
- name: Install 7zip
run: choco install 7zip.install
- name: Setup
working-directory: ${{env.GITHUB_WORKSPACE}}
run: cmd /c "generate_project.bat"
- name: Build
working-directory: ${{env.GITHUB_WORKSPACE}}
run: MSBuild ${{env.SOLUTION_FILE_PATH}} /m /p:Configuration=${{matrix.build-configuration}} /p:Platform=${{matrix.build-platform}}
- name: Install Mesa
working-directory: ${{env.GITHUB_WORKSPACE}}bin\${{matrix.build-configuration}}-windows-x86_64\Unit-Tests
shell: cmd
run: |
curl.exe -L --output mesa.7z --url https://github.com/pal1000/mesa-dist-win/releases/download/24.0.3/mesa3d-24.0.3-release-msvc.7z
"C:\Program Files\7-Zip\7z.exe" x mesa.7z
mklink opengl32.dll "x64\opengl32.dll"
mklink libglapi.dll "x64\libglapi.dll"
mklink osmesa.dll "x64\osmesa.dll"
- name: Unit-Tests
working-directory: ${{env.GITHUB_WORKSPACE}}
run: VSTest.console.exe bin\${{matrix.build-configuration}}-windows-x86_64\Unit-Tests\Unit-Tests.dll /logger:"trx;LogFileName=results-${{matrix.build-configuration}}.trx"
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action/windows@v2
if: always()
with:
files: TestResults\results-${{matrix.build-configuration}}.trx
check_name: 'Test Results ${{matrix.build-configuration}}'
- name: Move artifacts to Release Folder
if: startsWith(github.ref, 'refs/tags/') && matrix.build-configuration == 'Release'
run: |
mkdir ${{ env.ZIP_NAME }}
copy bin/Release-windows-x86_64/DeadZone/*.exe ${{ env.ZIP_NAME }}
copy bin/Release-windows-x86_64/DeadZone/*.dll ${{ env.ZIP_NAME }}
mkdir -p "${{ env.ZIP_NAME }}\resources"
xcopy DeadZone\resources "${{ env.ZIP_NAME }}\resources" /E /H
mkdir -p "${{ env.ZIP_NAME }}\shaders"
xcopy DeadZone\shaders "${{ env.ZIP_NAME }}\shaders" /E /H
mkdir -p "${{ env.ZIP_NAME }}\maps"
xcopy DeadZone\maps "${{ env.ZIP_NAME }}\maps" /E /H
mkdir -p "${{ env.ZIP_NAME }}\config"
xcopy DeadZone\config "${{ env.ZIP_NAME }}\config" /E /H
dir /a ${{ env.ZIP_NAME }}
- name: Set Tag Name
if: startsWith(github.ref, 'refs/tags/') && matrix.build-configuration == 'Release'
shell: bash
run: echo "TAG_NAME=${GITHUB_REF#'refs/tags/'}" >> ${GITHUB_ENV}
- name: Add tag to folder name
if: startsWith(github.ref, 'refs/tags/') && matrix.build-configuration == 'Release'
run: move ${{ env.ZIP_NAME }} ${{ env.ZIP_NAME }}-${{ env.TAG_NAME }}
- name: Archive Release
uses: thedoctor0/zip-release@master
if: startsWith(github.ref, 'refs/tags/') && matrix.build-configuration == 'Release'
with:
type: 'zip'
path: ${{ env.ZIP_NAME }}-${{ env.TAG_NAME }}
filename: ${{ env.ZIP_NAME }}-${{ env.TAG_NAME }}.zip
- name: Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/') && matrix.build-configuration == 'Release'
with:
files: ${{ env.ZIP_NAME }}-${{ env.TAG_NAME }}.zip