diff --git a/.github/workflows/Engine-CI.yml b/.github/workflows/Engine-CI.yml new file mode 100644 index 00000000..71c27072 --- /dev/null +++ b/.github/workflows/Engine-CI.yml @@ -0,0 +1,15 @@ +on: + push: + branches: [ master, develop ] + pull_request: + branches: [ master, develop ] + +jobs: + windows: + uses: ./.github/workflows/windows-build.yml + + macOS: + uses: ./.github/workflows/macOS-build.yml + + # linux: + # uses: ./.github/workflows/linux-build.yml \ No newline at end of file diff --git a/.github/workflows/job-cmakebuild-macOS.yml b/.github/workflows/job-cmakebuild-macOS.yml new file mode 100644 index 00000000..a1237c4d --- /dev/null +++ b/.github/workflows/job-cmakebuild-macOS.yml @@ -0,0 +1,38 @@ +# CMake build of ZEngine for macOS +# +name: ZEngine macOS Workflow + +on: + workflow_call: + inputs: + configuration: + type: string + default: 'Debug' + architecture: + type: string + default: 'x64' + +jobs: + cmake-build: + name: cmake-build-macOS-${{ inputs.architecture }}-${{ inputs.configuration }} + runs-on: ${{ inputs.architecture == 'x64' && 'macos-13' || 'macos-latest' }} + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: CMake Build + run: .\Scripts\BuildEngine.ps1 -Configurations ${{inputs.configuration}} + shell: pwsh + + - name: Publish Build Artifacts + uses: actions/upload-artifact@v4 + with: + name: Build-macOS-${{ inputs.architecture }}-${{inputs.configuration}} + path: | + Result.Darwin.x64.${{inputs.configuration}}/Panzerfaust/${{inputs.configuration}}/net6.0/osx-${{ inputs.architecture }}/publish/ + Result.Darwin.x64.${{inputs.configuration}}/__externals/Vulkan-Loader/loader/${{ inputs.configuration }}/ + Result.Darwin.x64.${{inputs.configuration}}/ZEngine/tests/${{inputs.configuration}}/ + !Result.Darwin.x64.${{inputs.configuration}}/Panzerfaust/${{inputs.configuration}}/net6.0/**/Microsoft.CodeAnalysis.CSharp.resources.dll + !Result.Darwin.x64.${{inputs.configuration}}/Panzerfaust/${{inputs.configuration}}/net6.0/**/Microsoft.CodeAnalysis.CSharp.Scripting.resources.dll + !Result.Darwin.x64.${{inputs.configuration}}/Panzerfaust/${{inputs.configuration}}/net6.0/**/Microsoft.CodeAnalysis.resources.dll + !Result.Darwin.x64.${{inputs.configuration}}/Panzerfaust/${{inputs.configuration}}/net6.0/**/Microsoft.CodeAnalysis.Scripting.resources.dll diff --git a/.github/workflows/job-cmakebuild-windows.yml b/.github/workflows/job-cmakebuild-windows.yml new file mode 100644 index 00000000..da0dbd4e --- /dev/null +++ b/.github/workflows/job-cmakebuild-windows.yml @@ -0,0 +1,35 @@ +# CMake build of ZEngine for Windows +# +name: Windows Build Workflow + +on: + workflow_call: + inputs: + configuration: + type: string + default: 'Debug' + +jobs: + cmake-build: + name: cmake-build-windows-${{ inputs.configuration }} + runs-on: windows-2022 + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: CMake Build + run: .\Scripts\BuildEngine.ps1 -Configurations ${{inputs.configuration}} + shell: pwsh + + - name: Publish Build Artifacts + uses: actions/upload-artifact@v4 + with: + name: Build-Windows-x64-${{inputs.configuration}} + path: | + Result.Windows.x64.MultiConfig/Panzerfaust/${{inputs.configuration}}/net6.0/win-x64/publish/ + Result.Windows.x64.MultiConfig/ZEngine/tests/${{inputs.configuration}}/ + !Result.Windows.x64.MultiConfig/Panzerfaust/${{inputs.configuration}}/net6.0/**/Microsoft.CodeAnalysis.CSharp.resources.dll + !Result.Windows.x64.MultiConfig/Panzerfaust/${{inputs.configuration}}/net6.0/**/Microsoft.CodeAnalysis.CSharp.Scripting.resources.dll + !Result.Windows.x64.MultiConfig/Panzerfaust/${{inputs.configuration}}/net6.0/**/Microsoft.CodeAnalysis.resources.dll + !Result.Windows.x64.MultiConfig/Panzerfaust/${{inputs.configuration}}/net6.0/**/Microsoft.CodeAnalysis.Scripting.resources.dll + !Result.Windows.x64.MultiConfig/Panzerfaust/${{inputs.configuration}}/net6.0/**/createdump.exe diff --git a/.github/workflows/job-deploy-macOS.yml b/.github/workflows/job-deploy-macOS.yml new file mode 100644 index 00000000..280826ef --- /dev/null +++ b/.github/workflows/job-deploy-macOS.yml @@ -0,0 +1,29 @@ +# Deploy for macOS +# +name: macOS Deploy Workflow + +on: + workflow_call: + inputs: + configuration: + type: string + default: 'Release' + architecture: + type: string + default: 'x64' + +jobs: + deploy: + name: deploy-macOS-${{ inputs.architecture }}-${{ inputs.configuration }} + runs-on: ${{ inputs.architecture == 'x64' && 'macos-13' || 'macos-latest' }} + steps: + - uses: actions/download-artifact@v4 + with: + path: Result.Darwin.x64.${{ inputs.configuration }} + name: Build-macOS-${{ inputs.architecture }}-Release + + - name: Publish Artifacts + uses: actions/upload-artifact@v4 + with: + name: macOS-${{ inputs.architecture }}-${{ inputs.configuration }} + path: Result.Darwin.x64.${{ inputs.configuration }}/Panzerfaust/${{ inputs.configuration }}/net6.0/osx-${{ inputs.architecture }}/publish/ diff --git a/.github/workflows/job-deploy-windows.yml b/.github/workflows/job-deploy-windows.yml new file mode 100644 index 00000000..99aa311f --- /dev/null +++ b/.github/workflows/job-deploy-windows.yml @@ -0,0 +1,26 @@ +# Deploy for Windows +# +name: Windows Deploy Workflow + +on: + workflow_call: + inputs: + configuration: + type: string + default: 'Release' + +jobs: + deploy: + name: deploy-windows-x64-${{ inputs.configuration }} + runs-on: windows-2022 + steps: + - uses: actions/download-artifact@v4 + with: + path: Result.Windows.x64.MultiConfig + name: Build-Windows-x64-Release + + - name: Publish Artifacts + uses: actions/upload-artifact@v4 + with: + name: Windows-x64-${{ inputs.configuration }} + path: Result.Windows.x64.MultiConfig/Panzerfaust/${{ inputs.configuration }}/net6.0/win-x64/publish/ diff --git a/.github/workflows/job-test-macOS.yml b/.github/workflows/job-test-macOS.yml new file mode 100644 index 00000000..62c22a6d --- /dev/null +++ b/.github/workflows/job-test-macOS.yml @@ -0,0 +1,34 @@ +# Run tests for macOS +# +name: macOS Test Workflow + +on: + workflow_call: + inputs: + configuration: + type: string + default: 'Debug' + architecture: + type: string + default: 'x64' + +jobs: + test: + name: test-macOS-${{ inputs.architecture }}-${{ inputs.configuration }} + runs-on: ${{ inputs.architecture == 'x64' && 'macos-13' || 'macos-latest' }} + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Download Artifacts + uses: actions/download-artifact@v4 + with: + name: Build-macOS-${{ inputs.architecture }}-${{ inputs.configuration }} + path: Result.Darwin.x64.${{ inputs.configuration }} + + - name: Update access permission of ZEngineTests + run: chmod +x ./Result.Darwin.x64.${{ inputs.configuration }}/ZEngine/tests/${{ inputs.configuration }}/ZEngineTests + + - name: Run Tests + run: .\Scripts\RunTests.ps1 -Configurations ${{ inputs.configuration }} + shell: pwsh diff --git a/.github/workflows/job-test-windows.yml b/.github/workflows/job-test-windows.yml new file mode 100644 index 00000000..19f30ce3 --- /dev/null +++ b/.github/workflows/job-test-windows.yml @@ -0,0 +1,36 @@ +# Run tests for Windows +# +name: Windows Test Workflow + +on: + workflow_call: + inputs: + configuration: + type: string + default: 'Debug' + +jobs: + test: + name: test-windows-${{ inputs.configuration }} + runs-on: windows-2022 + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Download All Artifacts + uses: actions/download-artifact@v4 + with: + path: Result.Windows.x64.MultiConfig + pattern: Build-Windows-x64-* + merge-multiple: true + + - name: Install Vulkan SDK + uses: humbletim/setup-vulkan-sdk@v1.2.0 + with: + vulkan-query-version: 1.3.204.0 + vulkan-components: Vulkan-Headers, Vulkan-Loader + vulkan-use-cache: true + + - name: Run Tests + run: .\Scripts\RunTests.ps1 -Configurations ${{inputs.configuration}} + shell: pwsh diff --git a/.github/workflows/linux-build.yml b/.github/workflows/linux-build.yml index fb67eb01..927ddaa3 100644 --- a/.github/workflows/linux-build.yml +++ b/.github/workflows/linux-build.yml @@ -1,24 +1,24 @@ # @JeanPhilippeKernel : Disabled because we only support Windows as platform for now # -# name: ZEngine Linux Build - -# on: -# push: -# branches: [ master, develop ] -# pull_request: -# branches: [ master, develop ] - -# jobs: -# Linux-Build: -# runs-on: ubuntu-latest -# strategy: -# matrix: -# buildConfiguration: [Debug, Release] - -# steps: -# - name: Checkout repository -# uses: actions/checkout@v2 - +name: ZEngine Linux Build + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + Linux-Build: + runs-on: ubuntu-latest + strategy: + matrix: + buildConfiguration: [Debug, Release] + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + # - name: Checkout submodules # run: git submodule update --init --recursive diff --git a/.github/workflows/macOS-build.yml b/.github/workflows/macOS-build.yml index eee25681..43e02aef 100644 --- a/.github/workflows/macOS-build.yml +++ b/.github/workflows/macOS-build.yml @@ -1,36 +1,35 @@ name: ZEngine macOS Build -on: - push: - branches: [ master, develop ] - pull_request: - branches: [ master, develop ] +on: workflow_call jobs: - macOS-Intel-Build: - runs-on: macos-13 + cmake-build: strategy: matrix: - buildConfiguration: [Debug, Release] + buildConfiguration: [Debug, Release] + architecture: [x64, arm64] + uses: ./.github/workflows/job-cmakebuild-macOS.yml + with: + configuration: ${{matrix.buildConfiguration}} + architecture: ${{ matrix.architecture }} - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - - name: CMake Build - run: .\Scripts\BuildEngine.ps1 -Configurations ${{matrix.buildConfiguration}} - shell: pwsh - - macOS-Silicon-Build: - runs-on: macos-latest + test: + needs: cmake-build strategy: matrix: - buildConfiguration: [Debug, Release] - - steps: - - name: Checkout repository - uses: actions/checkout@v2 + testConfiguration: [Debug, Release] + architecture: [x64, arm64] + uses: ./.github/workflows/job-test-macOS.yml + with: + configuration: ${{matrix.testConfiguration}} + architecture: ${{ matrix.architecture }} - - name: CMake Build - run: .\Scripts\BuildEngine.ps1 -Configurations ${{matrix.buildConfiguration}} - shell: pwsh + deploy: + needs: test + strategy: + matrix: + architecture: [x64, arm64] + uses: ./.github/workflows/job-deploy-macOS.yml + with: + configuration: Release + architecture: ${{ matrix.architecture }} diff --git a/.github/workflows/window-build.yml b/.github/workflows/window-build.yml deleted file mode 100644 index aea0d645..00000000 --- a/.github/workflows/window-build.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: ZEngine Window Build - -on: - push: - branches: [ master, develop ] - pull_request: - branches: [ master, develop ] - -jobs: - Windows-Build: - runs-on: windows-2022 - strategy: - matrix: - buildConfiguration: [Debug, Release] - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Install Vulkan SDK - uses: humbletim/setup-vulkan-sdk@v1.2.0 - with: - vulkan-query-version: 1.3.204.0 - vulkan-components: Vulkan-Headers, Vulkan-Loader - vulkan-use-cache: true - - - name: Install CMake - uses: jwlawson/actions-setup-cmake@v2 - with: - cmake-version: '3.21.x' - - - name: CMake Build - run: .\Scripts\BuildEngine.ps1 -Configurations ${{matrix.buildConfiguration}} - shell: pwsh - - - name: Run Tests - run: .\Scripts\RunTests.ps1 -Configurations ${{matrix.buildConfiguration}} - shell: pwsh diff --git a/.github/workflows/windows-build.yml b/.github/workflows/windows-build.yml new file mode 100644 index 00000000..6e8fa1a3 --- /dev/null +++ b/.github/workflows/windows-build.yml @@ -0,0 +1,27 @@ +name: ZEngine Window Build + +on: workflow_call + +jobs: + cmake-build: + strategy: + matrix: + buildConfiguration: [Debug, Release] + uses: ./.github/workflows/job-cmakebuild-windows.yml + with: + configuration: ${{matrix.buildConfiguration}} + + test: + needs: cmake-build + strategy: + matrix: + testConfiguration: [Debug, Release] + uses: ./.github/workflows/job-test-windows.yml + with: + configuration: ${{matrix.testConfiguration}} + + deploy: + needs: test + uses: ./.github/workflows/job-deploy-windows.yml + with: + configuration: Release \ No newline at end of file diff --git a/Scripts/RunTests.ps1 b/Scripts/RunTests.ps1 index b0b7f19e..18528e54 100644 --- a/Scripts/RunTests.ps1 +++ b/Scripts/RunTests.ps1 @@ -64,8 +64,10 @@ function RunTests { "Windows" { $testExecutablePath = [IO.Path]::Combine($OutputBuildDirectory, "ZEngine", "tests", $Configuration, "ZEngineTests.exe") } + "Darwin" { + $testExecutablePath = Join-Path $OutputBuildDirectory -ChildPath "ZEngine/tests/$Configuration/ZEngineTests" + } "Linux" {} - "Darwin" {} Default { throw 'This system is not supported' } diff --git a/ZEngine/tests/MemoryOperation_test.cpp b/ZEngine/tests/MemoryOperation_test.cpp index 0b489531..9c42f0aa 100644 --- a/ZEngine/tests/MemoryOperation_test.cpp +++ b/ZEngine/tests/MemoryOperation_test.cpp @@ -49,7 +49,7 @@ TEST(MemoryOperationsTest, SecureMemmove) TEST(MemoryOperationsTest, SecureStrncpy) { char src[] = "Hello"; - char dest[10]; + char dest[10] = { 0 }; EXPECT_EQ(secure_strncpy(dest, sizeof(dest), src, 5), MEMORY_OP_SUCCESS); EXPECT_STREQ(dest, "Hello");