Skip to content

Commit e9897c3

Browse files
committed
fill empty readme sections
1 parent d6361e3 commit e9897c3

File tree

1 file changed

+44
-4
lines changed

1 file changed

+44
-4
lines changed

README.md

+44-4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
This is a Github CI action which wraps Viam's cloud build system. Use this to build and publish your Viam module for multiple platforms.
77

8+
If you run into trouble setting this up, file a bug on this repo or reach out on our [Discord](https://discord.gg/viam).
9+
810
## What is Viam cloud build?
911

1012
Cloud build is cross-compilation infrastructure that we provide to module authors so you can publish your module for multiple platforms. (x86 and ARM Linux, ideally MacOS as well).
@@ -16,32 +18,70 @@ Your customers are deploying to different kinds of hardware, and prototyping on
1618
1. Set up build commands in your meta.json ([instructions below](#build-commands)). You can test these on your laptop by running `viam module build local`
1719
1. Create a .github/workflows/viam-build.yml in your repo with the default contents below
1820
1. Set up repo secrets using [auth instructions](#auth-instructions) below
19-
1. Create a tag like 0.0.1 (todo: make this an RC and link to RC) and push to github; your module should build and deploy on the desired platforms
21+
1. Create a tag like 0.0.1 and push to github; your module should build and deploy on the desired platforms
2022

2123
Default contents:
2224

2325
```yml
2426
# see https://github.com/viamrobotics/upload-module for help
25-
# todo: example should restrict to tags
2627
on:
2728
push:
29+
tags:
30+
- '[0-9]+.[0-9]+.[0-9]+'
2831

2932
jobs:
3033
publish:
3134
runs-on: ubuntu-latest
3235
steps:
3336
- uses: actions/checkout@v3
34-
- uses: viamrobotics/build-action@main
37+
- uses: viamrobotics/build-action@v1
3538
with:
39+
# note: you can replace this line with 'version: ""' if you want to test the build process without deploying
3640
version: ${{ github.ref_name }}
3741
key-id: ${{ secrets.viam_key_id }}
3842
key-value: ${{ secrets.viam_key_value }}
3943
```
4044
4145
## Auth instructions
4246
47+
1. Run `viam organizations list` to view your organization ID.
48+
2. Create a key with `viam organization api-key create --org-id YOUR_ORG_UUID --name descriptive-key-name`. This command outputs an ID + a value, both of which you will use in step 4 below. If the command doesn't exist, update your CLI version.
49+
3. In the github repo for your project, go to 'Settings' -> 'Secrets and variables' -> 'Actions'
50+
4. Create two new secrets using the 'New repository secret' button:
51+
- `viam_key_id` with the UUID from "Key ID:" in your terminal
52+
- `viam_key_value` with the string from "Key Value:" in your terminal
53+
5. All set! If you copy the YAML example above, it will use these secrets to authenticate to Viam. If you have already tried the action and it failed because the secrets were missing, you can trigger a re-run from your repo's 'Actions' tab.
54+
55+
## Build commands
56+
57+
In order for cloud builds to work, you'll need to create a build stanza in your module's meta.json. (If you don't have a meta.json, start with the 'create' and 'upload' sections of our [registry docs](https://docs.viam.com/registry/)).
58+
59+
Here's an example, taken from our [golang wifi repo](https://github.com/viam-labs/wifi-sensor):
60+
61+
```json
62+
{
63+
"module_id": "viam:golang-wifi-example",
64+
...
65+
"build": {
66+
"build": "make module.tar.gz",
67+
"arch" : ["linux/amd64", "linux/arm64", "darwin/arm64"]
68+
}
69+
}
70+
```
71+
72+
You can test this command by running `viam module build local` on your laptop. This will run your build instructions without submitting a cloud build job.
73+
4374
## Environment and base image
4475

76+
On Linux builds, you'll be using the same Debian layer that builds our golang RDK. If something is missing, you can `apt-get install` it.
77+
78+
For MacOS, you'll have a runner with most of the libraries for our golang RDK installed as homebrew packages. If something is missing, you can `brew install` it.
79+
4580
## Examples
4681

47-
- ...
82+
- [Golang](https://github.com/viam-labs/wifi-sensor)
83+
- [CI yaml](https://github.com/viam-labs/wifi-sensor/blob/main/.github/workflows/build.yml)
84+
- [meta.json](https://github.com/viam-labs/wifi-sensor/blob/main/meta.json)
85+
- [C++](https://github.com/viamrobotics/module-example-cpp)
86+
- [CI yaml](https://github.com/viamrobotics/module-example-cpp/blob/main/.github/workflows/build2.yml)
87+
- [meta.json](https://github.com/viamrobotics/module-example-cpp/blob/main/meta.json)

0 commit comments

Comments
 (0)