diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index f4faf61..da30c42 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -43,3 +43,31 @@ jobs: key-id: ${{ secrets.viam_key_id }} key-value: ${{ secrets.viam_key_value }} + publish-windows: + needs: validate-tag + name: Build and Upload Windows module + runs-on: ${{ matrix.build_target.built_on }} + strategy: + matrix: + build_target: + - platform: windows/amd64 + built_on: windows-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version-file: go.mod + - name: Build + run: go build -a -o module.exe ./cmd/module + - name: Package + run: tar -czf module.tar.gz module.exe third_party/onnxruntime.dll + - name: Install Viam CLI + run: | + Invoke-WebRequest -Uri "https://storage.googleapis.com/packages.viam.com/apps/viam-cli/viam-cli-latest-windows-amd64.exe" -OutFile "viam.exe" + - name: Publish build to Viam registry + run: | + .\viam.exe login api-key --key-id ${{ secrets.viam_key_id }} --key ${{ secrets.viam_key_value }} + .\viam.exe module upload --platform ${{ matrix.build_target.platform }} --version ${{ github.ref_name }} module.tar.gz + diff --git a/Makefile b/Makefile index 940914a..836d12d 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ lint: module.tar.gz: ifeq ($(VIAM_TARGET_OS),windows) # this needs to be at the top since windows is emulated - GOOS=windows GOARCH=amd64 go build -a -o module.exe ./cmd/module + CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc GOOS=windows GOARCH=amd64 go build -a -o module.exe ./cmd/module jq '.entrypoint = "module.exe"' meta.json > temp.json && mv temp.json meta.json tar -czf $@ module.exe third_party/onnxruntime.dll meta.json else ifeq ($(MOD_OS),Darwin) diff --git a/README.md b/README.md index 365a0e4..20d28cd 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Before configuring your ML model, you must [create a machine](https://docs.viam. ## Build and run -To use this module, follow these instructions to [add a module from the Viam Registry](https://docs.viam.com/registry/configure/#add-a-modular-resource-from-the-viam-registry) and select the `viam-labs:mlmodel:onnx-cpu` model from the [`onnx-cpu` module](https://github.com/viam-labs/onnx-cpu). +To use this module, follow these instructions to [add a module from the Viam Registry](https://docs.viam.com/registry/configure/#add-a-modular-resource-from-the-viam-registry) and select the `viam:mlmodel:onnx-cpu` model from the [`onnx-cpu` module](https://github.com/viam-modules/onnx-cpu). ## Configure your `onnx-cpu` ML model @@ -37,7 +37,7 @@ If you prefer to configure your service using JSON, use the following attributes ### Attributes -The following attributes are available for the `viam-labs:mlmodel:onnx-cpu` ML model service: +The following attributes are available for the `viam:mlmodel:onnx-cpu` ML model service: | Name | Type | Inclusion | Description | | ------- | ------ | ------------ | ----------- | @@ -53,7 +53,7 @@ The following attributes are available for the `viam-labs:mlmodel:onnx-cpu` ML m { "name": "onnx", "type": "mlmodel", - "model": "viam-labs:mlmodel:onnx-cpu", + "model": "viam:mlmodel:onnx-cpu", "attributes": { "model_path": "/path/to/onnx_file/detector_googlenet.onnx" "label_path": "/path/to/labels.txt" @@ -116,7 +116,7 @@ tar -czf module.tar.gz module third_party/ For Android, the Makefile will create the tar file. -You can then add the module to app.viam.com locally. the model triplet is `viam-labs:mlmodel:onnx-cpu`. +You can then add the module to app.viam.com locally. the model triplet is `viam:mlmodel:onnx-cpu`. ## License diff --git a/cmd/module/main.go b/cmd/module/main.go index d3f70f6..5a5f4ce 100644 --- a/cmd/module/main.go +++ b/cmd/module/main.go @@ -7,7 +7,7 @@ import ( "go.viam.com/rdk/module" "go.viam.com/rdk/services/mlmodel" - onnx "github.com/viam-labs/onnx-cpu" + onnx "github.com/viam-modules/onnx-cpu" ) func main() { diff --git a/go.mod b/go.mod index 56a07d8..c8edcb6 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/viam-labs/onnx-cpu +module github.com/viam-modules/onnx-cpu go 1.25.1 diff --git a/meta.json b/meta.json index 633992a..a21fa26 100644 --- a/meta.json +++ b/meta.json @@ -2,7 +2,7 @@ "module_id": "viam:onnx-cpu", "build": { "build": "make module.tar.gz", - "arch" : ["linux/amd64", "linux/arm64", "darwin/arm64", "windows/amd64"] + "arch" : ["linux/amd64", "linux/arm64", "darwin/arm64"] }, "visibility": "public", "url": "https://github.com/viam-modules/onnx-cpu", diff --git a/onnx_cpu.go b/onnx_cpu.go index af8c7e5..0986385 100644 --- a/onnx_cpu.go +++ b/onnx_cpu.go @@ -18,7 +18,7 @@ import ( ) // Model is the name of the module -var Model = resource.ModelNamespace("viam-labs").WithFamily("mlmodel").WithModel("onnx-cpu") +var Model = resource.ModelNamespace("viam").WithFamily("mlmodel").WithModel("onnx-cpu") // DataTypeMap maps the long ONNX data type labels to the data type as written in Go. var DataTypeMap = map[ort.TensorElementDataType]string{