Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
205 changes: 177 additions & 28 deletions .github/workflows/build-subvision-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,35 @@ name: Build and Release Subvision Core

on:
push:
branches: []
branches: [ ]
pull_request:
branches: []
branches: [ ]
workflow_dispatch:
inputs:
release_notes:
description: 'Release notes'
required: false

jobs:
build-wasm:
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
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
Expand All @@ -33,7 +48,16 @@ jobs:
make -j$(nproc)
cd test
./subvision_tests


build-wasm:
# needs: test
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Build subvision.js & subvision.mjs
run: make all

Expand All @@ -46,9 +70,19 @@ jobs:
build_wasm/subvision.mjs

build-dotnet:
# 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
Expand All @@ -61,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/<arch>/Release/*.dll to runtimes/<rid>/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
Expand All @@ -105,17 +175,96 @@ 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
if: |
github.event_name == 'push' &&
(
startsWith(github.ref, 'refs/heads/master') ||
startsWith(github.ref, 'refs/heads/main') ||
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: ${{ 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 }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Publish to NuGet.org
if: |
github.event_name == 'push' &&
(
startsWith(github.ref, 'refs/heads/master') ||
startsWith(github.ref, 'refs/heads/main') ||
startsWith(github.ref, 'refs/heads/develop')
)
run: dotnet nuget push nuget-package/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate

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
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,11 @@
/build_wasm/
/build/
.vscode/
.idea
.idea
/build-dotnet-x64
/build-dotnet-arm64

# Generated documentation output
docs/cpp/html/
docs/_site/
docs/api/
4 changes: 3 additions & 1 deletion .idea/editor.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/subvision-cv.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading