chore: fix all lint issues #7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: otlpinf-build | |
on: | |
workflow_dispatch: | |
pull_request: | |
branches: [ main ] | |
push: | |
branches: [ main ] | |
concurrency: | |
group: ${{ github.workflow }} | |
cancel-in-progress: false | |
permissions: | |
contents: write | |
pull-requests: write | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '1.23.x' | |
check-latest: true | |
- name: Lint | |
uses: golangci/golangci-lint-action@971e284b6050e8a5849b72094c50ab08da042db8 #v6.1.1 | |
with: | |
version: v1.62 | |
working-directory: . | |
args: --config ../.github/golangci.yaml | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '1.23' | |
- name: get otelcol-contrib | |
run: make getotelcol | |
- name: Build binary (go build only) | |
run: make build | |
- name: Install additional dependencies | |
run: go install github.com/mfridman/[email protected] | |
- name: Run go test | |
id: go-test | |
run: | | |
make test-coverage | |
echo 'coverage-report<<EOF' >> $GITHUB_OUTPUT | |
cat .coverage/test-report.md >> $GITHUB_OUTPUT | |
echo 'EOF' >> $GITHUB_OUTPUT | |
echo "coverage-total=$(cat .coverage/coverage.txt)" >> $GITHUB_OUTPUT | |
- name: Output Result | |
if: always() | |
run: cat .coverage/test-report.md | |
- name: Find comment | |
uses: peter-evans/find-comment@3eae4d37986fb5a8592848f6a574fdf654e61f9e #v3.1.0 | |
id: existing-comment | |
with: | |
issue-number: ${{ github.event.pull_request.number }} | |
comment-author: 'github-actions[bot]' | |
body-includes: Go test coverage | |
- name: Post comment | |
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 #v4.0.0 | |
with: | |
comment-id: ${{ steps.existing-comment.outputs.comment-id }} | |
issue-number: ${{ github.event.pull_request.number }} | |
body: | | |
Go test coverage | |
${{ steps.go-test.outputs.coverage-report }} | |
Total coverage: ${{ steps.go-test.outputs.coverage-total }}% | |
edit-mode: replace | |
package: | |
if: ${{ github.event_name != 'pull_request' }} | |
needs: [ test ] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf #v3.2.0 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5 #v3.8.0 | |
- name: Login to Docker Hub | |
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 #v3.3.0 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build image and push | |
uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 #v6.10.0 | |
with: | |
context: . | |
file: docker/Dockerfile | |
platforms: linux/amd64, linux/arm64 | |
push: true | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
tags: netboxlabs/opentelemetry-infinity:develop | |