set custom User-Agent header for BlackDuck API requests #36906
Workflow file for this run
This file contains hidden or 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: Go | |
| on: | |
| push: | |
| branches: | |
| - master | |
| pull_request: | |
| branches: | |
| - master | |
| env: | |
| DEFAULT_GOLANG: '1.25.0' | |
| jobs: | |
| unit: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: styfle/cancel-workflow-action@0.11.0 | |
| - name: 🏗 Set up Golang ${{ env.DEFAULT_GOLANG }} | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version: ${{ env.DEFAULT_GOLANG }} | |
| - name: 🏗 Cache Golang packages | |
| uses: actions/cache@v5 | |
| with: | |
| path: ~/go/pkg/mod | |
| key: ${{ runner.os }}-golang-${{ hashFiles('go.sum') }} | |
| restore-keys: | | |
| ${{ runner.os }}-golang- | |
| - name: ⤵️ Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: 🚀 Run tests | |
| id: unit-test | |
| run: go run gotest.tools/gotestsum@latest --junitfile TEST-go.xml --jsonfile unit-report.out -- -coverprofile cover.out -tags=unit ./... | |
| - name: 🔎 Analyse code | |
| if: github.event.pull_request.head.repo.full_name == github.repository | |
| uses: SonarSource/sonarqube-scan-action@v7 | |
| env: | |
| SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
| SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} | |
| format: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/setup-go@v6 | |
| with: | |
| go-version: '1.25.0' | |
| - name: Cache Golang Packages | |
| uses: actions/cache@v5 | |
| with: | |
| path: ~/go/pkg/mod | |
| key: ${{ runner.os }}-golang-format${{ hashFiles('go.sum') }} | |
| restore-keys: | | |
| ${{ runner.os }}-golang-format | |
| ${{ runner.os }}-golang- | |
| - name: checkout | |
| uses: actions/checkout@v4 | |
| - name: format | |
| run: go fmt ./... | |
| - name: verify | |
| run: git diff --exit-code | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/setup-go@v6 | |
| with: | |
| go-version: '1.25.0' | |
| - name: checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 1 | |
| - name: staticcheck | |
| uses: dominikh/staticcheck-action@v1.3.0 | |
| with: | |
| cache-key: ${{ runner.os }}-golang-staticcheck | |
| install-go: false | |
| generate: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/setup-go@v6 | |
| with: | |
| go-version: '1.25.0' | |
| - name: Cache Golang Packages | |
| uses: actions/cache@v5 | |
| with: | |
| path: ~/go/pkg/mod | |
| key: ${{ runner.os }}-golang-generate${{ hashFiles('go.sum') }} | |
| restore-keys: | | |
| ${{ runner.os }}-golang-generate | |
| ${{ runner.os }}-golang- | |
| - name: checkout | |
| uses: actions/checkout@v4 | |
| - name: generate | |
| run: go run pkg/generator/step-metadata.go | |
| - name: verify | |
| run: git diff --exit-code | |
| dependencies: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/setup-go@v6 | |
| with: | |
| go-version: '1.25.0' | |
| - name: Cache Golang Packages | |
| uses: actions/cache@v5 | |
| with: | |
| path: ~/go/pkg/mod | |
| key: ${{ runner.os }}-golang-dependencies${{ hashFiles('go.sum') }} | |
| restore-keys: | | |
| ${{ runner.os }}-golang-dependencies | |
| ${{ runner.os }}-golang- | |
| - name: checkout | |
| uses: actions/checkout@v4 | |
| - name: cleanup dependencies | |
| run: go mod tidy | |
| - name: verify | |
| run: git diff --name-only --exit-code |