Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
martha-johnston committed Nov 7, 2024
0 parents commit fe0db14
Show file tree
Hide file tree
Showing 20 changed files with 3,735 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .canon.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# This file provides project-level configuration for the canon dev environment utility. https://github.com/viamrobotics/canon
MODULE:
default: true
image_amd64: ghcr.io/viamrobotics/rdk-devenv:amd64-cache
image_arm64: ghcr.io/viamrobotics/rdk-devenv:arm64-cache
minimum_date: 2023-10-26T20:00:00.0Z
update_interval: 168h0m0s
user: testbot
group: testbot
persistent: true

MODULE-antique:
image_amd64: ghcr.io/viamrobotics/antique2:amd64-cache
image_arm64: ghcr.io/viamrobotics/antique2:arm64-cache
minimum_date: 2023-10-26T20:00:00.0Z
update_interval: 168h0m0s
user: testbot
group: testbot
persistent: true
13 changes: 13 additions & 0 deletions .github/actionlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
self-hosted-runner:
labels:
- qemu-host
- buildjet-2vcpu-ubuntu-2204
- buildjet-4vcpu-ubuntu-2204
- buildjet-8vcpu-ubuntu-2204
- buildjet-16vcpu-ubuntu-2204
- buildjet-32vcpu-ubuntu-2204
- buildjet-2vcpu-ubuntu-2204-arm
- buildjet-4vcpu-ubuntu-2204-arm
- buildjet-8vcpu-ubuntu-2204-arm
- buildjet-16vcpu-ubuntu-2204-arm
- buildjet-32vcpu-ubuntu-2204-arm
43 changes: 43 additions & 0 deletions .github/workflows/bump_dependencies.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Bump Versions

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
schedule:
- cron: '30 17 * * WED' # 12:30 EST on wednesdays
workflow_dispatch:

jobs:
bump-versions:
name: Bump Package Versions
if: github.repository_owner == 'viam-modules'
runs-on: ubuntu-latest
container:
image: ghcr.io/viamrobotics/rdk-devenv:amd64
timeout-minutes: 10

steps:
- name: Check out code
uses: actions/checkout@v3
- name: Update go dependencies
id: gobump
run: |
sudo chown -R testbot .
sudo -u testbot bash -lc 'go get -u .'
GEN_DIFF=$(git status -s)
if [ -n "$GEN_DIFF" ]; then
echo "needs_pr=1" >> $GITHUB_OUTPUT
fi
- name: Add + Commit + Open PR
if: steps.gobump.outputs.needs_pr == 1
uses: peter-evans/create-pull-request@v5
with:
commit-message: '[WORKFLOW] Updating go dependencies'
branch: 'workflow/update-dependencies'
delete-branch: true
base: main
title: Automated Go Dependencies Update
body: This is an auto-generated PR to update go dependencies. Please confirm tests are passing before merging.
29 changes: 29 additions & 0 deletions .github/workflows/license_finder.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: License Finder

on:
workflow_dispatch:
workflow_call:

jobs:
license_finder:
name: Audit 3rd-Party Licenses
runs-on: [ubuntu-latest]
container:
image: ghcr.io/viamrobotics/rdk-devenv:amd64-cache
options: --platform linux/amd64
timeout-minutes: 30

steps:
- name: Check out code
if: github.event_name != 'pull_request_target'
uses: actions/checkout@v3

- name: Check out PR branch code
if: github.event_name == 'pull_request_target'
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Run license finder
run: |
sudo -Hu testbot bash -lc 'make license-check'
15 changes: 15 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Build and Publish Latest

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}

on:
workflow_dispatch:
push:
branches: [ 'main' ]
paths-ignore:
- 'README.md'

jobs:
test:
uses: ./.github/workflows/test.yml
41 changes: 41 additions & 0 deletions .github/workflows/pr-labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: PR Test Label Manager

on:
pull_request_target:
branches: [ main ]
types: [ opened, synchronize, reopened ]

jobs:
pr_test_label_manager:
name: PR Test Label Manager
runs-on: ubuntu-latest
if: |
github.event_name == 'pull_request_target' &&
contains(fromJson('["opened", "synchronize", "reopened"]'), github.event.action)
steps:
- name: "Check Membership and Label PR"
uses: actions/github-script@v6
id: check-membership
with:
github-token: ${{ secrets.PR_TOKEN }}
script: |
let prNumber = context.payload.pull_request && context.payload.pull_request.number;
try {
await github.rest.issues.removeLabel({owner: "viam-modules", repo: "MODULE", issue_number: prNumber, name: "safe to test"});
} catch (err) {
core.info(`Non-fatal error ${err}, while trying to remove 'safe to test' label.`);
}
let orgResp = await github.rest.orgs.checkMembershipForUser({org: "viam-modules", username: context.payload.sender.login});
if (orgResp.status === 204) {
// order of labeling events must be preserved, so two seperate calls
await github.rest.issues.addLabels({owner: "viam-modules", repo: "MODULE", issue_number: prNumber, labels: ["safe to test"]});
return true;
}
return false;
- name: Add Unsafe PR Comment
if: steps.check-membership.outputs.result != 'true'
uses: marocchino/sticky-pull-request-comment@v2
with:
recreate: true
message: For security reasons, this PR must be labeled with `safe to test` in order for tests to run.
21 changes: 21 additions & 0 deletions .github/workflows/pullrequest-trusted.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Pull Request Update

concurrency:
group: pullrequest-${{ github.head_ref }}
cancel-in-progress: true

on:
pull_request_target:
branches: [ main ]
types: [ labeled ]

jobs:
test:
if: (github.event.label.name == 'safe to test' || github.event.label.name == 'appimage')
uses: viam-modules/MODULE/.github/workflows/test.yml@main
secrets:
MONGODB_TEST_OUTPUT_URI: ${{ secrets.MONGODB_TEST_OUTPUT_URI }}
DOCKER_PUBLIC_READONLY_PAT: ${{ secrets.DOCKER_PUBLIC_READONLY_PAT }}

license_finder:
uses: viam-modules/MODULE/.github/workflows/license_finder.yml@main
60 changes: 60 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Build and Publish RC

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}

on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+'

# To test workflow updates you need to work in a branch directly on viamrobotics/viam-cartographer
# and tag your working branch instead of @main in any viamrobotics/viam-cartographer "uses" below.
# Don't forget to tag back to @main before merge.

jobs:
test:
uses: ./.github/workflows/test.yml

publish:
strategy:
matrix:
include:
- arch: buildjet-8vcpu-ubuntu-2204
image: ghcr.io/viamrobotics/rdk-devenv:amd64-cache
platform: linux/amd64
label: amd64
- arch: buildjet-8vcpu-ubuntu-2204-arm
image: ghcr.io/viamrobotics/rdk-devenv:arm64-cache
platform: linux/arm64
label: arm64

runs-on: ${{ matrix.arch }}

steps:
- uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.23

- name: Install canon
run: |
export PATH="$(go env GOPATH)/bin:$PATH"
go install github.com/viamrobotics/[email protected]
- name: Build and package
run: |
canon --profile MODULE
TARGET_OS=${{ matrix.platform }} TARGET_ARCH=${{ matrix.arch }} make module
- name: Upload MODULE module to registry
uses: viamrobotics/upload-module@main
with:
meta-path: meta.json
module-path: bin/module.tar.gz
platform: ${{ matrix.platform }}
version: ${{ github.ref_name }}
key-id: ${{ secrets.VIAM_DEV_API_KEY_ID }}
key-value: ${{ secrets.VIAM_DEV_API_KEY }}
55 changes: 55 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Test

on:
workflow_dispatch:
workflow_call:

jobs:
build_and_test:
strategy:
matrix:
include:
- arch: buildjet-8vcpu-ubuntu-2204
image: ghcr.io/viamrobotics/rdk-devenv:amd64-cache
platform: linux/amd64
label: amd64
- arch: buildjet-8vcpu-ubuntu-2204-arm
image: ghcr.io/viamrobotics/rdk-devenv:arm64-cache
platform: linux/arm64
label: arm64
runs-on: ${{ matrix.arch }}
container:
image: ${{ matrix.image }}
timeout-minutes: 45
steps:

- name: Check out main branch code
if: github.event_name != 'pull_request_target'
uses: actions/checkout@v3

- name: Check out PR branch code
if: github.event_name == 'pull_request_target'
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: apt update
run: |
apt-get update
- name: Verify no uncommitted changes from make lint
run: |
git init
git add .
chown -R testbot:testbot .
sudo -u testbot bash -lc 'make lint'
if [ -n "$GEN_DIFF" ]; then
echo '"make lint" resulted in changes not in git' 1>&2
git status
exit 1
fi
- name: make build
run: |
sudo -u testbot bash -lc 'make build'
28 changes: 28 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# If you prefer the allow list template instead of the deny list, see community template:
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
#
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib

# Test binary, built with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

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

# Go workspace file
go.work
go.work.sum

# env file
.env

# binaries
bin/
Loading

0 comments on commit fe0db14

Please sign in to comment.