diff --git a/.github/actions/common-macos/action.yml b/.github/actions/common-macos/action.yml new file mode 100644 index 0000000..e709921 --- /dev/null +++ b/.github/actions/common-macos/action.yml @@ -0,0 +1,27 @@ +name: macos + +inputs: + config-preset: + required: true + build-preset: + required: true + +runs: + using: "composite" + steps: + - name: Select Xcode version + run: sudo xcode-select -switch /Applications/Xcode_16.3.app + shell: bash + + - name: Configure PartStacker + run: | + cmake --preset ${{ inputs.config-preset }} \ + -G Xcode \ + -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \ + -DCMAKE_OSX_DEPLOYMENT_TARGET=11.6 + shell: bash + + - name: Build PartStacker + run: | + cmake --build --preset ${{ inputs.build-preset }} -j8 + shell: bash diff --git a/.github/actions/common-windows/action.yml b/.github/actions/common-windows/action.yml new file mode 100644 index 0000000..f044f9d --- /dev/null +++ b/.github/actions/common-windows/action.yml @@ -0,0 +1,20 @@ +name: windows + +inputs: + config-preset: + required: true + build-preset: + required: true + +runs: + using: "composite" + steps: + - name: Configure PartStacker + run: | + cmake --preset ${{ inputs.config-preset }} -G "Visual Studio 17 2022" -A x64 + shell: powershell + + - name: Build PartStacker + run: | + cmake --build --preset ${{ inputs.build-preset }} -j8 + shell: powershell diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0a012f9..73b8755 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,23 +2,25 @@ on: workflow_dispatch: jobs: - windows: - runs-on: windows-2025 + run-tests: + uses: ./.github/workflows/test.yml + build-windows: + needs: run-tests + runs-on: windows-2025 steps: - name: Checkout code uses: actions/checkout@v4 with: submodules: recursive + + - uses: ./.github/actions/common-windows + with: + config-preset: Release + build-preset: Release - - name: Configure PartStacker - run: | - cmake --preset Release -G "Visual Studio 17 2022" -A x64 - - - name: Build PartStacker - run: | - cmake --build --preset Release -j8 - copy ".\bin\Release\PartStackerGUI.exe" ".\bin\Release\PartStackerGUI-windows.exe" + - name: Copy exe + run: copy ".\bin\Release\PartStackerGUI.exe" ".\bin\Release\PartStackerGUI-windows.exe" - name: Upload artifacts uses: actions/upload-artifact@v4 @@ -26,27 +28,19 @@ jobs: name: PartStackerGUI-windows path: .\bin\Release\PartStackerGUI-windows.exe - macos: + build-macos: + needs: run-tests runs-on: macos-15 - steps: - name: Checkout code uses: actions/checkout@v4 with: submodules: recursive - - - name: Select Xcode version - run: sudo xcode-select -switch /Applications/Xcode_16.3.app - - - name: Configure PartStacker - run: | - cmake --preset Release \ - -G Xcode \ - -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \ - -DCMAKE_OSX_DEPLOYMENT_TARGET=11.6 - - - name: Build PartStacker - run: cmake --build --preset Release -j8 + + - uses: ./.github/actions/common-macos + with: + config-preset: Release + build-preset: Release - name: Package into DMG run: | diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..5d9ee6c --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,40 @@ +on: + workflow_dispatch: + workflow_call: + +jobs: + test-windows: + runs-on: windows-2025 + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + submodules: recursive + + - uses: ./.github/actions/common-windows + with: + config-preset: Debug + build-preset: Tests + + - name: Run Tests + run: | + cd ./build/ + ctest + + test-macos: + runs-on: macos-15 + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + submodules: recursive + + - uses: ./.github/actions/common-macos + with: + config-preset: Debug + build-preset: Tests + + - name: Run Tests + run: | + cd ./build/ + ctest