Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Modus Go SDK #418

Merged
merged 22 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
version: 2
updates:
- package-ecosystem: "gomod"
directory: "/"
directories:
- "/"
- "/runtime"
- "/runtime/languages/golang/testdata"
- "/sdk/go"
- "/sdk/go/examples/*"
- "/sdk/go/tools/modus-go-build"
schedule:
interval: "weekly"
day: "wednesday"
Expand Down
49 changes: 49 additions & 0 deletions .github/workflows/ci-go-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# This workflow will lint all Go projects in the repository
name: ci-go-lint
on:
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
jobs:
get-dirs:
if: github.event_name == 'pull_request'
name: find go projects
runs-on: ubuntu-latest
outputs:
dirs: ${{ steps.get-dirs.outputs.dirs }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Search for go.mod files
id: get-dirs
run: echo "dirs=$(find . -name 'go.mod' -exec dirname {} \; | jq -Rsc 'split("\n")[:-1]')" >> ${GITHUB_OUTPUT}

go-lint:
needs: get-dirs
if: github.event_name == 'pull_request'
name: lint
runs-on: ubuntu-latest
strategy:
matrix:
dir: ${{ fromJson(needs.get-dirs.outputs.dirs) }}
defaults:
run:
working-directory: ${{ matrix.dir }}
steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
cache-dependency-path: "${{ matrix.dir }}/go.sum"
go-version-file: "${{ matrix.dir }}/go.mod"
- name: Generate Code
run: go generate ./...
- name: Run Linter
uses: golangci/golangci-lint-action@v6
with:
working-directory: ${{ matrix.dir }}
version: latest
args: --timeout=10m
51 changes: 51 additions & 0 deletions .github/workflows/ci-go-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# This workflow will test all Go projects in the repository
name: ci-go-test
on:
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
jobs:
get-dirs:
if: github.event_name == 'pull_request'
name: find go projects
runs-on: ubuntu-latest
outputs:
dirs: ${{ steps.get-dirs.outputs.dirs }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Search for go.mod files
id: get-dirs
run: echo "dirs=$(find . -name 'go.mod' -exec dirname {} \; | jq -Rsc 'split("\n")[:-1]')" >> ${GITHUB_OUTPUT}

go-test:
needs: get-dirs
name: test
runs-on: warp-ubuntu-latest-x64-4x
strategy:
matrix:
dir: ${{ fromJson(needs.get-dirs.outputs.dirs) }}
defaults:
run:
working-directory: ${{ matrix.dir }}
steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
cache-dependency-path: "${{ matrix.dir }}/go.sum"
go-version-file: "${{ matrix.dir }}/go.mod"
- name: Generate Code
run: go generate ./...
- name: Run Unit Tests
run: |
go install github.com/jstemmer/go-junit-report/v2@latest
go test -v -race 2>&1 ./... | go-junit-report -set-exit-code -iocopy -out report.xml
- name: Generate Test Summary
if: always()
uses: test-summary/action@v2
with:
paths: "${{ matrix.dir }}/report.xml"
29 changes: 0 additions & 29 deletions .github/workflows/ci-golang-lint.yml

This file was deleted.

27 changes: 0 additions & 27 deletions .github/workflows/ci-golang-unit-tests.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: ci-golang-integration-tests
name: ci-runtime-integration-tests
on:
pull_request:
types:
Expand All @@ -7,7 +7,7 @@ on:
- reopened
- ready_for_review
jobs:
golang-tests:
runtime-integration-tests:
name: test
runs-on: warp-ubuntu-latest-x64-4x
if: github.event.pull_request.draft == false
Expand Down
75 changes: 75 additions & 0 deletions .github/workflows/ci-sdk-go-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: ci-sdk-go-build
on:
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
jobs:
get-dirs:
if: github.event_name == 'pull_request'
name: find tools and examples
runs-on: ubuntu-latest
outputs:
tools_dirs: ${{ steps.get-tools-dirs.outputs.dirs }}
examples_dirs: ${{ steps.get-examples-dirs.outputs.dirs }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Find tools
id: get-tools-dirs
run: echo "dirs=$(find ./sdk/go/tools -name 'go.mod' -exec dirname {} \; | jq -Rsc 'split("\n")[:-1]')" >> ${GITHUB_OUTPUT}
- name: Find examples
id: get-examples-dirs
run: echo "dirs=$(find ./sdk/go/examples -name 'go.mod' -exec dirname {} \; | jq -Rsc 'split("\n")[:-1]')" >> ${GITHUB_OUTPUT}

sdk-go-build-tools:
needs: get-dirs
if: github.event_name == 'pull_request'
name: build
runs-on: ubuntu-latest
strategy:
matrix:
dir: ${{ fromJson(needs.get-dirs.outputs.tools_dirs) }}
defaults:
run:
working-directory: ${{ matrix.dir }}
steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
cache-dependency-path: "${{ matrix.dir }}/go.sum"
go-version-file: "${{ matrix.dir }}/go.mod"
- name: Generate Code
run: go generate ./...
- name: Build Program
run: go build .

sdk-go-build-examples:
needs: get-dirs
if: github.event_name == 'pull_request'
name: build
runs-on: ubuntu-latest
strategy:
matrix:
dir: ${{ fromJson(needs.get-dirs.outputs.examples_dirs) }}
defaults:
run:
working-directory: ${{ matrix.dir }}
steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
cache-dependency-path: "${{ matrix.dir }}/go.sum"
go-version-file: "${{ matrix.dir }}/go.mod"
- name: Setup TinyGo
uses: acifani/setup-tinygo@v2
with:
tinygo-version: "0.33.0"
- name: Generate Code
run: go generate ./...
- name: Build Program
run: ./build.sh
22 changes: 22 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,28 @@
"--s3path=${input:s3folder}",
"--refresh=1s"
]
},
{
"name": "modus-go-build simple example",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceFolder}/sdk/go/tools/modus-go-build",
"args": ["${workspaceFolder}/sdk/go/examples/simple"],
"env": {
"MODUS_DEBUG": "true"
}
},
{
"name": "hypbumodus-go-buildild http example",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceFolder}/sdk/go/tools/modus-go-build",
"args": ["${workspaceFolder}/sdk/go/examples/http"],
"env": {
"MODUS_DEBUG": "true"
}
}
],
"inputs": [
Expand Down
Loading
Loading