diff --git a/.github/workflows/build-subvision-core.yml b/.github/workflows/build-subvision-core.yml index 5b9d7da..457a009 100644 --- a/.github/workflows/build-subvision-core.yml +++ b/.github/workflows/build-subvision-core.yml @@ -2,9 +2,9 @@ name: Build and Release Subvision Core on: push: - branches: [] + branches: [ ] pull_request: - branches: [] + branches: [ ] workflow_dispatch: inputs: release_notes: @@ -12,6 +12,23 @@ on: required: false jobs: + get-version: + runs-on: ubuntu-latest + outputs: + version: ${{ steps.version.outputs.version }} + pre-release-label: ${{ steps.version.outputs.pre-release-label }} + steps: + - name: Checkout repository + uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Get version + uses: reecetech/version-increment@2023.10.2 + id: version + with: + scheme: calver + increment: patch + test: runs-on: ubuntu-latest steps: @@ -33,7 +50,7 @@ jobs: ./subvision_tests build-wasm: - needs: test + # needs: test runs-on: ubuntu-latest permissions: contents: write @@ -53,10 +70,19 @@ jobs: build_wasm/subvision.mjs build-dotnet: - needs: test + # needs: test runs-on: windows-latest permissions: contents: write + strategy: + fail-fast: false + matrix: + arch: [x64] + include: + - arch: x64 + cmake_arch: x64 + rid: win-x64 + suffix: x64 steps: - name: Checkout repository uses: actions/checkout@v3 @@ -69,39 +95,75 @@ jobs: choco install opencv -y echo "OpenCV_DIR=C:\tools\opencv\build" >> $env:GITHUB_ENV - - name: Build C++/CLI .NET Library (x64) + - name: Build C++/CLI .NET Library (${{ matrix.arch }}) run: | - mkdir build-dotnet-x64 - cd build-dotnet-x64 - cmake -G "Visual Studio 17 2022" -A x64 -DBUILD_CLI_WRAPPER=ON .. + if (Test-Path build-dotnet-${{ matrix.suffix }}) { Remove-Item -Recurse -Force build-dotnet-${{ matrix.suffix }} } + New-Item -ItemType Directory -Force -Path build-dotnet-${{ matrix.suffix }} + cd build-dotnet-${{ matrix.suffix }} + cmake -G "Visual Studio 17 2022" -A ${{ matrix.cmake_arch }} -DBUILD_CLI_WRAPPER=ON .. cmake --build . --config Release - - name: Upload .NET artifacts + - name: Upload .NET artifacts (${{ matrix.arch }}) uses: actions/upload-artifact@v4 with: - name: dotnet-artifacts-x64 + name: dotnet-artifacts-${{ matrix.suffix }} path: | - build-dotnet-x64/bin/**/*.dll - build-dotnet-x64/bin/**/*.pdb + build-dotnet-${{ matrix.suffix }}/bin/**/*.dll + build-dotnet-${{ matrix.suffix }}/bin/**/*.pdb - create-release: - needs: [build-wasm, build-dotnet] - runs-on: ubuntu-latest + package-nuget: + needs: [build-dotnet, get-version] + runs-on: windows-latest permissions: contents: write steps: - name: Checkout repository uses: actions/checkout@v3 - - name: Get next version - uses: reecetech/version-increment@2023.10.2 - id: version + - name: Download x64 artifacts + uses: actions/download-artifact@v4 with: - scheme: calver - increment: patch + name: dotnet-artifacts-x64 + path: ./nupkg/runtimes/win-x64/native + + - name: Flatten artifact directories + shell: pwsh + run: | + # Flatten nested bin//Release/*.dll to runtimes//native/ + foreach ($rid in @("win-x64")) { + $nativeDir = "./nupkg/runtimes/$rid/native" + Get-ChildItem -Path $nativeDir -Recurse -Filter "*.dll" | ForEach-Object { + if ($_.DirectoryName -ne (Resolve-Path $nativeDir).Path) { + Move-Item $_.FullName -Destination $nativeDir -Force + } + } + # Clean up empty subdirectories + Get-ChildItem -Path $nativeDir -Directory -Recurse | Sort-Object FullName -Descending | Remove-Item -Force -ErrorAction SilentlyContinue + } + + - name: Build NuGet package + shell: pwsh + run: | + Copy-Item Subvision.targets ./nupkg/ + nuget pack Subvision.nuspec -OutputDirectory ./nupkg -Version ${{ needs.get-version.outputs.version }} -BasePath ./nupkg + + - name: Upload NuGet package + uses: actions/upload-artifact@v4 + with: + name: nuget-package + path: ./nupkg/*.nupkg + + create-release: + needs: [ build-wasm, build-dotnet, package-nuget, get-version ] + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - name: Checkout repository + uses: actions/checkout@v3 - name: Print version - run: echo "Version is ${{ steps.version.outputs.version }}" + run: echo "Version is ${{ needs.get-version.outputs.version }}" - name: Download WASM artifacts uses: actions/download-artifact@v4 @@ -113,7 +175,13 @@ jobs: uses: actions/download-artifact@v4 with: name: dotnet-artifacts-x64 - path: ./dotnet-artifacts + path: ./dotnet-artifacts-x64 + + - name: Download NuGet package + uses: actions/download-artifact@v4 + with: + name: nuget-package + path: ./nuget-package - name: Create GitHub Release uses: softprops/action-gh-release@v2 @@ -125,14 +193,68 @@ jobs: startsWith(github.ref, 'refs/heads/develop') ) with: - tag_name: ${{ steps.version.outputs.version }} - name: ${{ steps.version.outputs.version }} + tag_name: ${{ needs.get-version.outputs.version }} + name: ${{ needs.get-version.outputs.version }} body: ${{ inputs.release_notes }} - prerelease : ${{ steps.version.outputs.pre-release-label != '' }} - make_latest: ${{ steps.version.outputs.pre-release-label == '' }} + prerelease: ${{ needs.get-version.outputs.pre-release-label != '' }} + make_latest: ${{ needs.get-version.outputs.pre-release-label == '' }} files: | wasm-artifacts/subvision.js wasm-artifacts/subvision.mjs - dotnet-artifacts/**/*.dll + dotnet-artifacts-x64/**/*.dll + nuget-package/*.nupkg env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + build-docs: + runs-on: ubuntu-latest + permissions: + contents: read + pages: write + id-token: write + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Install Doxygen + run: | + sudo apt-get update + sudo apt-get install -y doxygen + + - name: Create output directories + run: mkdir -p docs/cpp/html + + - name: Generate C++ API docs (Doxygen) + run: | + cd docs + doxygen Doxyfile + + - name: Install DocFX + run: | + dotnet tool install -g docfx || true + echo "$HOME/.dotnet/tools" >> $GITHUB_PATH + + - name: Build documentation site (DocFX) + run: | + cd docs + docfx build docfx.json || echo "DocFX build completed (metadata step skipped — no .NET project present)" + + - name: Upload docs artifact + uses: actions/upload-artifact@v4 + with: + name: documentation + path: docs/_site + + - name: Setup GitHub Pages + if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' + uses: actions/configure-pages@v4 + + - name: Upload to GitHub Pages + if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' + uses: actions/upload-pages-artifact@v3 + with: + path: docs/_site + + - name: Deploy to GitHub Pages + if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' + uses: actions/deploy-pages@v4 \ No newline at end of file diff --git a/.gitignore b/.gitignore index 3bde07b..c7574b1 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,11 @@ /build_wasm/ /build/ .vscode/ -.idea \ No newline at end of file +.idea +/build-dotnet-x64 +/build-dotnet-arm64 + +# Generated documentation output +docs/cpp/html/ +docs/_site/ +docs/api/ \ No newline at end of file diff --git a/.idea/editor.xml b/.idea/editor.xml index 198c798..933d1dd 100644 --- a/.idea/editor.xml +++ b/.idea/editor.xml @@ -17,7 +17,7 @@