Skip to content

Commit

Permalink
feat: ci
Browse files Browse the repository at this point in the history
  • Loading branch information
f0e committed Nov 30, 2024
1 parent 3f987e1 commit adcb7bc
Showing 1 changed file with 47 additions and 40 deletions.
87 changes: 47 additions & 40 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -1,54 +1,61 @@
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]
build-type: [release]

steps:
- uses: actions/checkout@v2
# Checkout the repository
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive

- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v1.0.2
# Install Ninja
- name: Install Ninja
uses: seanmiddleditch/gha-setup-ninja@master
with:
version: 1.11.1

# Setup vcpkg
- name: Setup vcpkg
uses: lukka/run-vcpkg@v7
uses: lukka/run-vcpkg@v11
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
vcpkgGitCommitId: "cd124b84feb0c02a24a2d90981e8358fdee0e077"

# Select CMake preset based on OS and build type
- name: Select CMake Preset
id: select-preset
shell: bash
run: |
if [ "${{ runner.os }}" == "Windows" ]; then
case "${{ matrix.build-type }}" in
debug) echo "preset=win-debug" ;;
release) echo "preset=win-release" ;;
relwithdebinfo) echo "preset=win-relwithdebinfo" ;;
esac
else
case "${{ matrix.build-type }}" in
debug) echo "preset=unix-debug" ;;
release) echo "preset=unix-release" ;;
relwithdebinfo) echo "preset=unix-relwithdebinfo" ;;
esac
fi | tee -a $GITHUB_OUTPUT
# Configure the project
- name: Configure CMake
run: cmake --preset ${{ steps.select-preset.outputs.preset }}
env:
VCPKG_ROOT: ${{ github.workspace }}/vcpkg

# Build the project
- 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
run: cmake --build --preset ${{ steps.select-preset.outputs.preset }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VCPKG_ROOT: ${{ github.workspace }}/vcpkg

0 comments on commit adcb7bc

Please sign in to comment.