From f959baf6fac01f5088fb4c6284f082dd1fbce0fd Mon Sep 17 00:00:00 2001 From: Dominik Date: Fri, 5 Jun 2026 14:17:32 +0200 Subject: [PATCH] feat(languages): go test pipeline --- .github/workflows/languages-go-test.yml | 52 +++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 .github/workflows/languages-go-test.yml diff --git a/.github/workflows/languages-go-test.yml b/.github/workflows/languages-go-test.yml new file mode 100644 index 0000000..7de1ed5 --- /dev/null +++ b/.github/workflows/languages-go-test.yml @@ -0,0 +1,52 @@ +name: Go Test + +on: + workflow_call: + inputs: + go-version-file: + description: "Path to go.mod for version resolution" + type: string + default: "go.mod" + run-race: + description: "Enable race detector" + type: boolean + default: true + timeout: + description: "Test timeout (go test -timeout)" + type: string + default: "20m" + coverage: + description: "Upload coverage report as artifact" + type: boolean + default: true + +jobs: + test: + name: go test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version-file: ${{ inputs.go-version-file }} + cache: true + + - name: Run tests + run: | + ARGS="-timeout ${{ inputs.timeout }}" + if [ "${{ inputs.run-race }}" = "true" ]; then + ARGS="$ARGS -race" + fi + if [ "${{ inputs.coverage }}" = "true" ]; then + ARGS="$ARGS -coverprofile=coverage.out -covermode=atomic" + fi + go test $ARGS ./... + + - name: Upload coverage report + if: ${{ inputs.coverage }} + uses: actions/upload-artifact@v4 + with: + name: coverage-report + path: coverage.out + retention-days: 7