Skip to content

Commit

Permalink
add module CI (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
abe-winter authored Aug 25, 2023
1 parent ac46778 commit 6c1eb16
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 1 deletion.
37 changes: 37 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
on:
workflow_dispatch:
push:
release:
types: [released]

env:
VERSION: ${{ github.event_name == 'release' && github.ref_name || format('0.0.0-{0}.{1}', github.ref_name, github.run_number) }}

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: '~1.20.6'
- name: deps
run: go mod download
- name: build
run: |
GOARCH=arm64 make module.tar.gz && mv module.tar.gz module-arm64.tar.gz
GOARCH=amd64 make module.tar.gz && mv module.tar.gz module-amd64.tar.gz
- uses: viamrobotics/upload-module@main
if: github.event_name == 'release'
with:
module-path: module-arm64.tar.gz
platform: linux/arm64
version: ${{ env.VERSION }}
cli-config-secret: ${{ secrets.cli_config }}
- uses: viamrobotics/upload-module@main
if: github.event_name == 'release'
with:
module-path: module-amd64.tar.gz
platform: linux/amd64
version: ${{ env.VERSION }}
cli-config-secret: ${{ secrets.cli_config }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@

# Dependency directories (remove the comment below to include it)
# vendor/

wifi
module.tar.gz
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
wifi: *.go */*.go
# the executable
go build -o $@ -ldflags "-s -w" -tags osusergo,netgo
file $@

module.tar.gz: wifi
# the bundled module
rm -f $@
tar czf $@ $^
2 changes: 1 addition & 1 deletion linuxwifi/linuxwifi.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
)

// Model represents a linux wifi strength sensor model.
var Model = resource.NewModel("viam-labs", "sensor", "linux-wifi")
var Model = resource.NewModel("viam", "sensor", "linux-wifi")

const wirelessInfoPath string = "/proc/net/wireless"

Expand Down
13 changes: 13 additions & 0 deletions meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "viam:golang-wifi-example",
"visibility": "private",
"url": "https://github.com/viam-labs/wifi-sensor",
"description": "Example module for golang",
"models": [
{
"api": "rdk:component:sensor",
"model": "viam:sensor:linux-wifi"
}
],
"entrypoint": "wifi"
}

0 comments on commit 6c1eb16

Please sign in to comment.