Skip to content

build(deps): bump actions/setup-go from 5.2.0 to 5.3.0 #179

build(deps): bump actions/setup-go from 5.2.0 to 5.3.0

build(deps): bump actions/setup-go from 5.2.0 to 5.3.0 #179

Workflow file for this run

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow helps you trigger a SonarCloud analysis of your code and populates
# GitHub Code Scanning alerts with the vulnerabilities found.
# Free for open source project.
# 1. Login to SonarCloud.io using your GitHub account
# 2. Import your project on SonarCloud
# * Add your GitHub organization first, then add your repository as a new project.
# * Please note that many languages are eligible for automatic analysis,
# which means that the analysis will start automatically without the need to set up GitHub Actions.
# * This behavior can be changed in Administration > Analysis Method.
#
# 3. Follow the SonarCloud in-product tutorial
# * a. Copy/paste the Project Key and the Organization Key into the args parameter below
# (You'll find this information in SonarCloud. Click on "Information" at the bottom left)
#
# * b. Generate a new token and add it to your Github repository's secrets using the name SONAR_TOKEN
# (On SonarCloud, click on your avatar on top-right > My account > Security
# or go directly to https://sonarcloud.io/account/security/)
# Feel free to take a look at our documentation (https://docs.sonarcloud.io/getting-started/github/)
# or reach out to our community forum if you need some help (https://community.sonarsource.com/c/help/sc/9)
name: SonarCloud analysis
on:
push:
branches: [ "master", "main", $default-branch ]
pull_request:
branches: [ "master", "main", $default-branch ]
workflow_dispatch:
permissions:
pull-requests: read # allows SonarCloud to decorate PRs with analysis results
jobs:
testing:
outputs:
cover: ${{ steps.binary.outputs.cover }}
tests: ${{ steps.binary.outputs.tests }}
golangciLint: ${{ steps.binary.outputs.golangciLint }}
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- name: Harden Runner
uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4
with:
egress-policy: audit
- name: "Checkout code"
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- name: Set up Go
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
with:
go-version: '1.22'
- name: Testing...
run: go test -coverprofile cover.out -v ./... -json >tests.json
- name: GoLangCi-Lint...
uses: golangci/golangci-lint-action@v6
with:
args: --timeout=30m --issues-exit-code=0 --out-format checkstyle
- name: Generate binary hashes
id: binary
run: |
set -euo pipefail
echo "cover=$(cat cover.out | base64 -w0)" >> "$GITHUB_OUTPUT"
echo "tests=$(echo tests.json | base64 -w0)" >> "$GITHUB_OUTPUT"
echo "golangciLint=$(echo golangciLint.xml | base64 -w0)" >> "$GITHUB_OUTPUT"
Analysis:
runs-on: ubuntu-latest
needs: [testing]
steps:
- name: Harden Runner
uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4
with:
egress-policy: audit
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Restore the cover and result files
env:
COVER_CONTENT: ${{ needs.testing.outputs.cover }}
TESTS_CONTENT: "${{ needs.testing.outputs.tests }}"
GOLANGCILINT_CONTENT: "${{ needs.testing.outputs.golangciLint }}"
run: |
set -euo pipefail
echo "$COVER_CONTENT" | base64 -d >cover.out
echo "$TESTS_CONTENT" | base64 -d >tests.json
echo "$GOLANGCILINT_CONTENT" | base64 -d >golangciLint.xml
- name: Analyze with SonarCloud
uses: SonarSource/sonarcloud-github-action@02ef91109b2d589e757aefcfb2854c2783fd7b19 # v4.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} # Generate a token on Sonarcloud.io, add it to the secrets of this repo with the name SONAR_TOKEN (Settings > Secrets > Actions > add new repository secret)
with:
# Additional arguments for the sonarcloud scanner
args:
-Dsonar.go.coverage.reportPaths=coverage.out
-Dsonar.go.tests.reportPaths=tests.json
-Dsonar.go.golangci-lint.reportPaths=golangciLint.xml