diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml index 00c4e3b..f27e34d 100644 --- a/.github/workflows/c-cpp.yml +++ b/.github/workflows/c-cpp.yml @@ -1,11 +1,10 @@ -name: SlimeVR OpenVR Driver +name: Build and test OpenVR driver on: [ push, pull_request, workflow_dispatch ] jobs: build: - - name: Build for ${{ matrix.os }} + name: Build (${{ matrix.os }}) runs-on: ${{ matrix.os }} strategy: fail-fast: false @@ -14,10 +13,12 @@ jobs: include: - os: windows-latest triplet: x64-windows-static-md + name: win64 target: ALL_BUILD release_dir: Release # dir of driver binaries within env.CMAKE_BUILD_DIR, VS multi-config uses / subfolder - os: ubuntu-latest triplet: x64-linux + name: x64-linux target: all release_dir: "" # makefile single config won't have subfolder env: @@ -68,32 +69,20 @@ jobs: - name: Build run: cmake --build "${{env.CMAKE_BUILD_DIR}}" --config Release --target "${{ matrix.target }}" -j 6 -- - - name: Upload a build artifact + - name: Upload driver uses: actions/upload-artifact@v7 with: - # Artifact name - name: slimevr-openvr-driver-${{ matrix.triplet }} # optional, default is artifact - # A file, directory or wildcard pattern that describes what to upload - # Using wildcards so that only the driver directory gets included (if you specify it, then it won't be included) - path: | - ${{env.CMAKE_BUILD_DIR}}/${{ matrix.release_dir }}/driver/* - ${{env.CMAKE_BUILD_DIR}}/${{ matrix.release_dir }}/tests* + name: slimevr-openvr-driver-${{ matrix.name }} + path: ${{ env.CMAKE_BUILD_DIR }}/${{ matrix.release_dir }}/driver - - name: Zip - if: startsWith(github.ref, 'refs/tags/') - working-directory: ${{env.CMAKE_BUILD_DIR}}/${{ matrix.release_dir }}/driver - run: cmake -E tar "cf" "${{env.CMAKE_BUILD_DIR}}/slimevr-openvr-driver-${{ matrix.triplet }}.zip" --format=zip -- ${{env.CMAKE_BUILD_DIR}}/${{ matrix.release_dir }}/driver/slimevr - - - name: Upload to draft release - uses: softprops/action-gh-release@v3 - if: startsWith(github.ref, 'refs/tags/') + - name: Upload tests + uses: actions/upload-artifact@v7 with: - draft: true - generate_release_notes: true - files: "${{env.CMAKE_BUILD_DIR}}/slimevr-openvr-driver-${{ matrix.triplet }}.zip" + name: tests-${{ matrix.name }} + path: ${{ env.CMAKE_BUILD_DIR }}/${{ matrix.release_dir }}/tests* test: - name: Run tests + name: Run tests (${{ matrix.os }}) needs: build runs-on: ${{ matrix.os }} strategy: @@ -103,15 +92,17 @@ jobs: include: - os: windows-latest triplet: x64-windows-static-md - target: RUN_TESTS + name: win64 + target: ALL_BUILD - os: ubuntu-latest triplet: x64-linux - target: test + name: x64-linux + target: all steps: - name: Download build artifact uses: actions/download-artifact@v8 with: - name: slimevr-openvr-driver-${{ matrix.triplet }} + name: tests-${{ matrix.name }} path: ${{ github.workspace }} - if: matrix.os == 'windows-latest' name: Run tests on Windows @@ -121,3 +112,23 @@ jobs: name: Run tests on Unix working-directory: ${{ github.workspace }}/ run: chmod +x ./tests && ./tests + + upload-release: + name: Upload draft release + needs: [build, test] + if: startsWith(github.ref, 'refs/tags/') + runs-on: ubuntu-latest + steps: + - name: Download driver artifacts + uses: actions/download-artifact@v8 + with: + path: ${{ github.workspace }} + pattern: slimevr-openvr-driver-* + merge-multiple: true + skip-decompress: true + + - uses: softprops/action-gh-release@v3 + with: + draft: true + generate_release_notes: true + files: slimevr-openvr-driver-*.zip