diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index b61b710..b57a11d 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -1,54 +1,50 @@ name: Build -on: [] - -env: - is_tag: ${{ startsWith(github.ref, 'refs/tags/') }} - - PROJECT_FILE_PATH: blur.sln - - BUILD_CONFIGURATION: Release - BUILD_PLATFORM: x64 +on: [push] jobs: build: - runs-on: windows-latest + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + architecture: [x64, arm64] + exclude: + - os: ubuntu-latest + architecture: arm64 + - os: windows-latest + architecture: arm64 steps: - - uses: actions/checkout@v2 - - - name: Add MSBuild to PATH - uses: microsoft/setup-msbuild@v1.0.2 - - - name: Setup vcpkg - uses: lukka/run-vcpkg@v7 - with: - vcpkgDirectory: ${{ runner.workspace }}/vcpkg/ - vcpkgTriplet: "${{ env.BUILD_PLATFORM }}-windows-static" - vcpkgGitCommitId: "8eb57355a4ffb410a2e94c07b4dca2dffbee8e50" - vcpkgArguments: "cxxopts fmt glfw3 imgui[opengl3-binding,glfw-binding] nlohmann-json" - - - name: Integrate vcpkg - run: ${{ runner.workspace }}\vcpkg\vcpkg integrate install - - - name: Build - working-directory: ${{ env.GITHUB_WORKSPACE }} - run: MSBuild /p:Configuration=${{ env.BUILD_CONFIGURATION }} /p:Platform=${{ env.BUILD_PLATFORM }} ${{ env.PROJECT_FILE_PATH }} - - - name: Upload - uses: actions/upload-artifact@v3 - with: - name: Blur - path: | - bin/blur-cli/Release/blur-cli.exe - bin/blur-gui/Release/blur.exe - - - name: Release - uses: softprops/action-gh-release@v1 - if: ${{ env.is_tag == 'true' }} - with: - files: | - bin/blur-cli/Release/blur-cli.exe - bin/blur-gui/Release/blur.exe + # Checkout the repository + - name: Checkout repository + uses: actions/checkout@v4 # Updated to latest version + + # Install Ninja + - name: Install Ninja + uses: seanmiddleditch/gha-setup-ninja@master + + # Setup vcpkg + - name: Set up vcpkg + run: | + git clone https://github.com/microsoft/vcpkg.git + if [ "$RUNNER_OS" == "Windows" ]; then + .\vcpkg\bootstrap-vcpkg.bat + else + ./vcpkg/bootstrap-vcpkg.sh + fi + shell: bash # Ensures consistent shell across different OS env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + VCPKG_ROOT: ${{ github.workspace }}/vcpkg + + # Configure and build the project using CMake presets + - name: Configure and build with CMake Presets + run: | + if [ "$RUNNER_OS" == "Windows" ]; then + cmake --preset windows-release + cmake --build --preset windows-release + else + cmake --preset unix-release + cmake --build --preset unix-release + fi + shell: bash