Skip to content
Open
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
33 changes: 19 additions & 14 deletions .github/workflows/go_app_pull_requests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@ on:
workflow_call:
inputs:
GH_CI_USER:
description: 'User for GitHub auth'
description: "User for GitHub auth"
required: true
type: string
GOPRIVATE:
description: 'GOPRIVATE env for go commands'
description: "GOPRIVATE env for go commands"
required: false
type: string
secrets:
GH_CI_PAT:
description: 'Token password for GitHub auth'
description: "Token password for GitHub auth"
required: true
CODECOV_TOKEN:
description: 'Token for Codecov'
description: "Token for Codecov"
required: true
env:
GOPRIVATE: ${{ inputs.GOPRIVATE }}
Expand Down Expand Up @@ -51,13 +51,14 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '^1'
go-version: "^1"
# Use auth to get access to private Git repos for Go code dependencies.
- name: Configure git for private modules
env:
TOKEN: ${{ secrets.GH_CI_PAT }}
GITHUB_USERNAME: kochava-ci
run: git config --global url."https://${GITHUB_USERNAME}:${TOKEN}@github.com".insteadOf
run:
git config --global url."https://${GITHUB_USERNAME}:${TOKEN}@github.com".insteadOf
"https://github.com"
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v6
Expand All @@ -72,7 +73,7 @@ jobs:
strategy:
matrix:
# List of go versions to test on.
go: ['^1']
go: ["^1"]
steps:
# Checkout go code to test.
- name: Checkout repo
Expand All @@ -87,20 +88,23 @@ jobs:
env:
TOKEN: ${{ secrets.GH_CI_PAT }}
GITHUB_USERNAME: ${{ inputs.GH_CI_USER }}
run: git config --global url."https://${GITHUB_USERNAME}:${TOKEN}@github.com".insteadOf
run:
git config --global url."https://${GITHUB_USERNAME}:${TOKEN}@github.com".insteadOf
"https://github.com"
# Go vet every Go module.
- name: go vet
run: find . -name vendor -prune -o -name go.mod -print | xargs -n1 dirname
run:
find . -name vendor -prune -o -name go.mod -print | xargs -n1 dirname
| xargs -n1 -I{} bash -c "pushd {}; go vet ./..."
# Install go-junit-report to format test results.
- name: Install go-junit-report
run: go install github.com/jstemmer/go-junit-report/v2@v2.1.0
# Run unit test for evet Go module.
- name: go test
run: find . -name vendor -prune -o -name go.mod -print | xargs -n1 dirname
| xargs -n1 -I{} bash -c "pushd {}; go test -coverprofile=coverage.txt --race -v ./..."
| go-junit-report -set-exit-code > junit_report.xml || true
run: |
find . -name vendor -prune -o -name go.mod -print | xargs -n1 dirname \
| xargs -n1 -I{} bash -c "pushd {}; go test -coverprofile=coverage.txt --race -v ./..." \
| tee >(go-junit-report -set-exit-code > junit_report.xml)
- name: Test Report
uses: dorny/test-reporter@v1
if: success() || failure()
Expand Down Expand Up @@ -132,13 +136,14 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '^1'
go-version: "^1"
# Use auth to get access to private Git repos for Go code dependencies.
- name: Configure git for private modules
env:
TOKEN: ${{ secrets.GH_CI_PAT }}
GITHUB_USERNAME: ${{ inputs.GH_CI_USER }}
run: git config --global url."https://${GITHUB_USERNAME}:${TOKEN}@github.com".insteadOf
run:
git config --global url."https://${GITHUB_USERNAME}:${TOKEN}@github.com".insteadOf
"https://github.com"
# Vendor Go code needed to build app.
- name: go mod vendor
Expand Down
21 changes: 12 additions & 9 deletions .github/workflows/go_app_push_main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ on:
type: string
secrets:
GH_CI_PAT:
description: 'Token password for GitHub auth'
description: "Token password for GitHub auth"
required: true
CODECOV_TOKEN:
description: 'Token for Codecov'
description: "Token for Codecov"
required: true
env:
GOPRIVATE: ${{ inputs.GOPRIVATE }}
Expand All @@ -29,7 +29,7 @@ jobs:
strategy:
matrix:
# List of go versions to test on.
go: ['^1']
go: ["^1"]
steps:
# Checkout go code to test.
- name: Checkout repo
Expand All @@ -44,20 +44,23 @@ jobs:
env:
TOKEN: ${{ secrets.GH_CI_PAT }}
GITHUB_USERNAME: ${{ inputs.GH_CI_USER }}
run: git config --global url."https://${GITHUB_USERNAME}:${TOKEN}@github.com".insteadOf
run:
git config --global url."https://${GITHUB_USERNAME}:${TOKEN}@github.com".insteadOf
"https://github.com"
# Go vet every Go module.
- name: go vet
run: find . -name vendor -prune -o -name go.mod -print | xargs -n1 dirname
run:
find . -name vendor -prune -o -name go.mod -print | xargs -n1 dirname
| xargs -n1 -I{} bash -c "pushd {}; go vet ./..."
# Install go-junit-report to format test results.
- name: Install go-junit-report
run: go install github.com/jstemmer/go-junit-report/v2@v2.1.0
# Run unit test for evet Go module.
- name: go test
run: find . -name vendor -prune -o -name go.mod -print | xargs -n1 dirname
| xargs -n1 -I{} bash -c "pushd {}; go test -coverprofile=coverage.txt --race -v ./..."
| go-junit-report -set-exit-code > junit_report.xml || true
run: |
find . -name vendor -prune -o -name go.mod -print | xargs -n1 dirname \
| xargs -n1 -I{} bash -c "pushd {}; go test -coverprofile=coverage.txt --race -v ./..." \
| tee >(go-junit-report -set-exit-code > junit_report.xml)
Comment on lines +60 to +63
Copy link
Contributor

@23caterpie 23caterpie May 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe I'm over simplifying this, but instead of piping into junit at all, why not just run it on it's own line to get all the outputs? Or does junit need the output? I assumed it looked at the coverage output file.

Suggested change
run: |
find . -name vendor -prune -o -name go.mod -print | xargs -n1 dirname \
| xargs -n1 -I{} bash -c "pushd {}; go test -coverprofile=coverage.txt --race -v ./..." \
| tee >(go-junit-report -set-exit-code > junit_report.xml)
run: |
find . -name vendor -prune -o -name go.mod -print | xargs -n1 dirname \
| xargs -n1 -I{} bash -c "pushd {}; go test -coverprofile=coverage.txt --race -v ./..."
go-junit-report -set-exit-code > junit_report.xml

- name: Test Report
uses: dorny/test-reporter@v1
if: success() || failure()
Expand All @@ -79,7 +82,7 @@ jobs:
#
# Create a GitHub Release based on conventional commits.
#
name: 'Release to GitHub'
name: "Release to GitHub"
# needs: test
runs-on: ubuntu-latest
needs: test
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/go_lib_pull_requests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ on:
description: "Token password for GitHub auth"
required: true
CODECOV_TOKEN:
description: 'Token for Codecov'
description: "Token for Codecov"
required: true
env:
GOPRIVATE: ${{ inputs.GOPRIVATE }}
Expand Down Expand Up @@ -106,10 +106,10 @@ jobs:
run: go install github.com/jstemmer/go-junit-report/v2@v2.1.0
# Run unit test for evet Go module.
- name: go test
run:
find . -name vendor -prune -o -name go.mod -print | xargs -n1 dirname
| xargs -n1 -I{} bash -c "pushd {}; go test -coverprofile=coverage.txt --race -v ./..."
| go-junit-report -set-exit-code > junit_report.xml || true
run: |
find . -name vendor -prune -o -name go.mod -print | xargs -n1 dirname \
| xargs -n1 -I{} bash -c "pushd {}; go test -coverprofile=coverage.txt --race -v ./..." \
| tee >(go-junit-report -set-exit-code > junit_report.xml)
- name: Test Report
uses: dorny/test-reporter@v1
if: success() || failure()
Expand All @@ -126,4 +126,4 @@ jobs:
- name: Upload test coverage results to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
token: ${{ secrets.CODECOV_TOKEN }}
14 changes: 7 additions & 7 deletions .github/workflows/go_lib_push_main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ on:
type: string
secrets:
GH_CI_PAT:
description: 'Token password for GitHub auth'
description: "Token password for GitHub auth"
required: true
CODECOV_TOKEN:
description: 'Token for Codecov'
description: "Token for Codecov"
required: true
env:
GOPRIVATE: ${{ inputs.GOPRIVATE }}
Expand Down Expand Up @@ -57,10 +57,10 @@ jobs:
run: go install github.com/jstemmer/go-junit-report/v2@v2.1.0
# Run unit test for evet Go module.
- name: go test
run:
find . -name vendor -prune -o -name go.mod -print | xargs -n1 dirname
| xargs -n1 -I{} bash -c "pushd {}; go test -coverprofile=coverage.txt --race -v ./..."
| go-junit-report -set-exit-code > junit_report.xml || true
run: |
find . -name vendor -prune -o -name go.mod -print | xargs -n1 dirname \
| xargs -n1 -I{} bash -c "pushd {}; go test -coverprofile=coverage.txt --race -v ./..." \
| tee >(go-junit-report -set-exit-code > junit_report.xml)
- name: Test Report
uses: dorny/test-reporter@v1
if: success() || failure()
Expand All @@ -82,7 +82,7 @@ jobs:
#
# Create a GitHub Release based on conventional commits.
#
name: 'Release to GitHub'
name: "Release to GitHub"
# needs: test
runs-on: ubuntu-latest
steps:
Expand Down