From 578a509153658e4bedfbb495d9e9a936833463a3 Mon Sep 17 00:00:00 2001 From: Kitlith Date: Thu, 10 Mar 2022 16:51:16 -0800 Subject: [PATCH] Setup CI. This originally took a lot of time and commits, and it's still not perfect. 13 commits compared to the 28 previously in the repository is too many for me, so I'm squashing them. Tags now automatically trigger a release, uploading the cpack zip file. Commits get artifacts uploaded, the resulting zip is not quite the same as the release zip (it's missing a folder) but it's Close Enough For Now. --- .github/workflows/build.yml | 63 +++++++++++++++++++++++++++++++++++++ CMakeLists.txt | 3 +- 2 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..1006e66 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,63 @@ +name: Build Feeder App +on: [push, workflow_dispatch] + +jobs: + job: + name: ${{ matrix.os }}-${{ github.workflow }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [windows-latest] + + steps: + - uses: actions/checkout@v2 + with: + submodules: true + + - uses: lukka/get-cmake@latest + + - name: vcpkg setup/restore artifacts + uses: lukka/run-vcpkg@v10.1 + id: runvcpkg + with: + vcpkgJsonGlob: 'vcpkg.json' + + - name: Prints output of run-vcpkg's action. + run: echo "root='${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_ROOT_OUT }}', triplet='${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_DEFAULT_TRIPLET_OUT }}' " + + - name: Setup vcpkg env + run: vcpkg env + shell: cmd + if: matrix.os == 'windows-latest' + + - name: CMake+vcpkg configure + run: cmake -S . -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo + shell: cmd + + - name: Build + run: cmake --build build --config RelWithDebInfo + shell: cmd + + # - name: List $RUNNER_WORKSPACE after build + # run: find $RUNNER_WORKSPACE + # shell: bash + + - name: Package + run: cmake --build build --target package --config RelWithDebInfo + shell: cmd + + - name: Get package path for Artifact + run: echo "artifactPath=$(realpath build/_CPack_Packages/*/ZIP/SlimeVR-Feeder-App-*/ --relative-to .)" >> $GITHUB_ENV + shell: bash + + - name: Upload Artifact + uses: actions/upload-artifact@v3 + with: + path: ${{ env.artifactPath }} + + - name: Release + uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/') + with: + files: build/SlimeVR-Feeder-App-*.zip \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index a547e5e..8a13b82 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,7 +39,8 @@ install(FILES "${PROJECT_SOURCE_DIR}/manifest.vrmanifest" ) if (WIN32) - install(FILES "${CMAKE_BINARY_DIR}/openvr_api.dll" "${CMAKE_BINARY_DIR}/fmt.dll" "${CMAKE_BINARY_DIR}/libprotobuf.dll" DESTINATION ".") + set(VCPKG_BINARIES "${CMAKE_BINARY_DIR}/vcpkg_installed/x64-windows/bin") + install(FILES "${VCPKG_BINARIES}/openvr_api.dll" "${VCPKG_BINARIES}/fmt.dll" "${VCPKG_BINARIES}/libprotobuf.dll" DESTINATION ".") endif() install(TARGETS "${PROJECT_NAME}"