Skip to content

feat: add go-lint, go-test, commitlint and license-headers composite actions#34

Merged
huaweic-nv merged 7 commits into
mainfrom
feat/go-ci-actions
Apr 8, 2026
Merged

feat: add go-lint, go-test, commitlint and license-headers composite actions#34
huaweic-nv merged 7 commits into
mainfrom
feat/go-ci-actions

Conversation

@huaweic-nv

@huaweic-nv huaweic-nv commented Apr 7, 2026

Copy link
Copy Markdown
Contributor

Summary

Add reusable composite actions and CI workflows for DSX Go and Helm projects:

New Composite Actions (4)

Action Purpose
go-lint golangci-lint (v2.11), go fmt (vendor-excluded), go vet
go-test go test with race detection, coverage, JUnit output
license-headers SPDX header check/add via addlicense
commitlint Conventional commit message validation

New Reusable Workflows (2)

Workflow Purpose
dsx-ci-go.yml Full Go CI: commitlint, license-headers, go-lint, go-test, docker-build, codeql, trufflehog, helm-validate, slack
dsx-ci-helm.yml Helm CI: commitlint, license-headers, helm-validate, trufflehog, slack

Both workflows accept an actions-ref input so callers pin all internal action refs to the same version — no @main drift.

Caller usage (minimal)

# auth-callout ci.yml — entire CI in 12 lines
jobs:
  ci:
    uses: NVIDIA/dsx-github-actions/.github/workflows/dsx-ci-go.yml@v1
    with:
      go-version: "1.25.5"
      go-flags: "-mod=vendor"
      docker-image: dsx-exchange-auth-callout
      dockerfile: build/package/Dockerfile
      slack-channel-id: C09VC8R4E92
      actions-ref: v1
    secrets:
      SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}

Jira: CDEVS-2228

Test plan

  • go-lint: tested on dsx-exchange-auth-callout
  • go-test: tested on dsx-exchange-auth-callout
  • license-headers: tested on both repos
  • commitlint: tested on both repos
  • dsx-ci-go.yml reusable workflow end-to-end
  • dsx-ci-helm.yml reusable workflow end-to-end

🤖 Generated with Claude Code

@huaweic-nv huaweic-nv self-assigned this Apr 7, 2026
@copy-pr-bot

copy-pr-bot Bot commented Apr 7, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

Add three new reusable composite actions for Go projects:

- go-lint: runs golangci-lint, go fmt, and go vet with configurable
  Go version and lint config
- go-test: runs go test with race detection, coverage reporting,
  and JUnit XML output via gotestsum
- license-headers: checks/adds SPDX license headers via addlicense
  with configurable license type, copyright holder, and ignore patterns

These actions support the DSX GitHub-First migration and will be
reused across event-bus, Carbide, and other DSX Go projects.
@huaweic-nv huaweic-nv force-pushed the feat/go-ci-actions branch from 9d867cc to 9899c81 Compare April 7, 2026 09:30
huaweic-nv and others added 2 commits April 7, 2026 18:29
…arsing errors

String-based flag expansion caused addlicense to treat -ignore and -check
as file path arguments instead of flags. Switch to bash array construction
and env vars to preserve flag boundaries correctly.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
gofmt -l . scans all .go files including vendor/, which contains
third-party code that should not be reformatted. Use find with
-not -path './vendor/*' to skip vendor directory.

go vet ./... already skips vendor/ by default.
@huaweic-nv huaweic-nv force-pushed the feat/go-ci-actions branch from 984ab88 to 17604fe Compare April 7, 2026 10:29
golangci-lint v2.1 was built with Go 1.24 and fails when targeting
Go 1.25 code. v2.9+ added Go 1.25/1.26 support. Bump default to
v2.11 (latest stable).
Validates commit messages against conventional commits using commitlint.
Supports:
- Auto-detection of commitlint config (commitlint.config.js, .commitlintrc.js)
- Custom config file path
- PR context (lint from base branch) and push context (lint latest commit)
- Configurable commit range (from/to refs)

Replaces the GitLab .commitlint template from cds/cicd-pipelines.
@huaweic-nv huaweic-nv changed the title feat: add go-lint, go-test, and license-headers composite actions feat: add go-lint, go-test, commitlint and license-headers composite actions Apr 8, 2026
@huaweic-nv

Copy link
Copy Markdown
Contributor Author

/ok to test 9251a3c

@huaweic-nv huaweic-nv requested review from lachen-nv and mmou-nv April 8, 2026 05:50
- go-test: route all inputs through env vars to prevent ${{ }} shell
  injection, pin gotestsum version, add artifact-name input for matrix
  builds, fix go-version-file path for non-root working directories
- go-lint: fix go-version-file path, replace || true with proper error
  handling in gofmt check to prevent silent pass on find failures
- license-headers: route addlicense-version through env var, fix success
  message to differentiate check vs add mode
- commitlint: add --ignore-scripts to npm install for supply chain
  safety, handle HEAD~1 failure on initial commits, support empty
  commit range gracefully

Signed-off-by: Hua-Wei Chen <huaweic@nvidia.com>
Add README.md for go-lint, go-test, license-headers, and commitlint
actions following existing project conventions. Update main README with
new actions in the available actions table, repository structure tree,
and documentation links section.

Also includes linter-applied SHA pinning for action refs in docs.

Signed-off-by: Hua-Wei Chen <huaweic@nvidia.com>
@huaweic-nv huaweic-nv force-pushed the feat/go-ci-actions branch from 7e2092d to 838b4c3 Compare April 8, 2026 06:07
@huaweic-nv huaweic-nv merged commit 2caabb4 into main Apr 8, 2026
2 checks passed
@huaweic-nv huaweic-nv deleted the feat/go-ci-actions branch April 8, 2026 06:47
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 8, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants