Skip to content

feat(OpenTelemetry): Integrate OpenTelemetry into agent #56

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

Closed
Closed
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
173 changes: 165 additions & 8 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,24 +1,181 @@
name: ci
name: Go Build - CI

on:
workflow_dispatch:
push:
tags-ignore:
- "*"
branches-ignore:
- main

pull_request:
types:
- opened
- reopened
- synchronize
branches:
- main

jobs:
quality:
name: Code Quality
runs-on: ubuntu-latest

steps:
# Checkout code
- name: Checkout repository
uses: actions/checkout@v4

# Set up Go environment
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
cache-dependency-path: "**/*.sum"
cache: true

- name: GolangCI Lint
uses: golangci/golangci-lint-action@v8
with:
version: latest

- name: Run format-check
run: |
UNFORMATTED=$(gofmt -l .)
if [ -n "$UNFORMATTED" ]; then
echo "The following files are not formatted according to gofmt:"
echo "$UNFORMATTED"
exit 1
fi

test:
name: Unit Tests
runs-on: ubuntu-latest
steps:
# Checkout code
- name: Checkout repository
uses: actions/checkout@v4

# Set up Go environment
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
cache: true
cache-dependency-path: "**/*.sum"

- name: Run tests
run: go test -cover -coverprofile=coverage.txt ./...

- name: Archive code coverage results
uses: actions/upload-artifact@v4
with:
name: code-coverage
path: "coverage.txt"
if-no-files-found: error

code_coverage:
name: "Code coverage report"
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
needs:
- test

permissions:
contents: read
actions: read
pull-requests: write
statuses: write

steps:
- uses: fgrosse/go-coverage-report@v1.2.0
with:
coverage-artifact-name: "code-coverage"
coverage-file-name: "coverage.txt"
github-baseline-workflow-ref: "release.yaml"

tinygo:
runs-on: ubuntu-latest
needs:
- test
- quality

steps:
# Checkout code (full history)
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

# Setup golang with caching
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
cache-dependency-path: "**/go.sum"
go-version-file: "go.mod"
cache-dependency-path: "**/*.sum"
cache: true

# Run tests
- name: Run tests
run: make test
# Setup tinygo
- uses: acifani/setup-tinygo@v2
with:
tinygo-version: '0.37.0'

# Build fanunit firmware
- name: Build FanUnit Firmware
run: make build-fanunit

- name: Archive FanUnit Firmware
uses: actions/upload-artifact@v4
with:
name: fanunit.uf2
path: "fanunit.uf2"

goreleaser:
runs-on: ubuntu-latest
needs:
- tinygo

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

# Install cosign
- name: Install Cosign
uses: sigstore/cosign-installer@v3

# Install GoLang
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
cache-dependency-path: "**/*.sum"
cache: true

# Setup docker buildx
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

# Download FanUnit Firmware
- name: Download fanunit firmware
uses: actions/download-artifact@v4
with:
pattern: fanunit.uf2

# Run goreleaser
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
version: latest
args: release --snapshot --clean --skip sign
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: compute-blade-agent
path: dist/*-SNAPSHOT-*
if-no-files-found: error
43 changes: 40 additions & 3 deletions .github/workflows/conventional-commits.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
name: Enforce conventional pr title
name: Enforce PR title

on:
pull_request:
types:
- opened
- reopened
- edited
- synchronize

pull_request_target:
types:
- opened
Expand All @@ -9,11 +16,41 @@ on:
- synchronize

jobs:
lint:
pr_title:
name: "Validate PR Title"
runs-on: ubuntu-latest

permissions:
statuses: write
pull-requests: write
contents: read

steps:
- uses: aslafy-z/conventional-pr-title-action@v3
- uses: amannn/action-semantic-pull-request@v5
id: lint_pr_title
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- uses: marocchino/sticky-pull-request-comment@v2
# When the previous steps fail, the workflow would stop. By adding this
# condition you can continue the execution with the populated error message.
if: always() && (steps.lint_pr_title.outputs.error_message != null)
with:
header: pr-title-lint-error
message: |
Hey there and thank you for opening this pull request! 👋🏼

We require pull request titles to follow the [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/) and it looks like your proposed title needs to be adjusted.

Details:

```
${{ steps.lint_pr_title.outputs.error_message }}
```

# Delete a previous comment when the issue has been resolved
- if: ${{ steps.lint_pr_title.outputs.error_message == null }}
uses: marocchino/sticky-pull-request-comment@v2
with:
header: pr-title-lint-error
delete: true
101 changes: 76 additions & 25 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: release
name: Go Build - Release

on:
push:
Expand All @@ -19,59 +19,110 @@ jobs:
outputs:
release_created: ${{ steps.release-please.outputs.release_created }}

# Goreleaser for binary releases / GH release
goreleaser:
test:
name: Unit Tests
runs-on: ubuntu-latest
steps:
# Checkout code
- name: Checkout repository
uses: actions/checkout@v4

# Set up Go environment
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
cache: true
cache-dependency-path: "**/*.sum"

- name: Run tests
run: go test -cover -coverprofile=coverage.txt ./...

- name: Archive code coverage results
uses: actions/upload-artifact@v4
with:
name: code-coverage
path: "coverage.txt"
if-no-files-found: error

tinygo:
runs-on: ubuntu-latest
needs:
- release-please
if: needs.release-please.outputs.release_created
- test

steps:
# Checkout code (full history)
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

# Setup golang with caching
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
cache-dependency-path: "**/go.sum"
go-version-file: "go.mod"
cache-dependency-path: "**/*.sum"
cache: true

# Setup tinygo
- uses: acifani/setup-tinygo@v2
with:
tinygo-version: '0.33.0'
tinygo-version: '0.37.0'

# Setup docker buildx
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
# Build fanunit firmware
- name: Build FanUnit Firmware
run: make build-fanunit

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Archive FanUnit Firmware
uses: actions/upload-artifact@v4
with:
name: fanunit.uf2
path: "fanunit.uf2"

- name: 'Login to GitHub Container Registry'
uses: docker/login-action@v3
# Goreleaser for binary releases / GH release
goreleaser:
runs-on: ubuntu-latest
needs:
- release-please
- tinygo

if: needs.release-please.outputs.release_created

steps:
- name: Checkout
uses: actions/checkout@v4
with:
registry: ghcr.io
username: ${{github.actor}}
password: ${{secrets.GITHUB_TOKEN}}
fetch-depth: 0

# Install cosign
- name: Install Cosign
uses: sigstore/cosign-installer@v3

# Build fanunit firmware
- name: Build FanUnit Firmware
run: make build-fanunit
# Install GoLang
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
cache-dependency-path: "**/*.sum"
cache: true

# Setup docker buildx
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

# Download FanUnit Firmware
- name: Download fanunit firmware
uses: actions/download-artifact@v4
with:
pattern: fanunit.uf2

# Run goreleaser
- name: Run Goreleaser
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
version: latest
version: '~> v2'
args: release --clean
env:
COSIGN_YES: "true"
Expand Down
Loading
Loading