Skip to content

Commit

Permalink
RSDK-9098: test go in module generation test (viamrobotics#4504)
Browse files Browse the repository at this point in the history
  • Loading branch information
purplenicole730 authored Nov 1, 2024
1 parent a34352b commit 9c30b69
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/test-module-generation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ jobs:
strategy:
fail-fast: true
matrix:
language: ["python", "go"]
resource:
[
{ subtype: "arm", type: "component" },
Expand Down Expand Up @@ -46,7 +47,7 @@ jobs:
go-version-file: go.mod

- name: Run module generator
run: go run ./cli/viam --debug module generate --resource-subtype "${{ matrix.resource.subtype }}" --resource-type "${{ matrix.resource.type }}"
run: go run ./cli/viam --debug module generate --resource-subtype "${{ matrix.resource.subtype }}" --resource-type "${{ matrix.resource.type }}" --language "${{ matrix.language }}"

- name: Run module
run: |
Expand Down
6 changes: 6 additions & 0 deletions cli/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ const (
apiKeyCreateFlagName = "name"

moduleFlagName = "name"
moduleFlagLanguage = "language"
moduleFlagPublicNamespace = "public-namespace"
moduleFlagPath = "module"
moduleFlagVersion = "version"
Expand Down Expand Up @@ -1496,6 +1497,11 @@ After creation, use 'viam module update' to push your new module to app.viam.com
Name: "generate",
Usage: "generate a new modular resource via prompts",
Flags: []cli.Flag{
&cli.StringFlag{
Name: moduleFlagLanguage,
Usage: "language to use for module",
Value: "python",
},
&cli.StringFlag{
Name: moduleFlagResourceType,
Usage: "resource type to use in module",
Expand Down
2 changes: 1 addition & 1 deletion cli/module_generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func (c *viamClient) generateModuleAction(cCtx *cli.Context) error {
ModuleName: "my-module",
IsPublic: false,
Namespace: "my-org",
Language: python,
Language: cCtx.String(moduleFlagLanguage),
Resource: resourceSubtype + " " + resourceType,
ResourceType: resourceType,
ResourceSubtype: resourceSubtype,
Expand Down

0 comments on commit 9c30b69

Please sign in to comment.