Skip to content

chore(deps): bump actions/setup-go from 6.1.0 to 6.2.0 #1492

chore(deps): bump actions/setup-go from 6.1.0 to 6.2.0

chore(deps): bump actions/setup-go from 6.1.0 to 6.2.0 #1492

name: Build, Lint, and Test
# This workflow
# - builds the code
# - runs the unit tests
# - runs the linter
# - reports the code coverage and linting errors to Sonar
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
merge_group: # run if triggered as part of a merge queue
schedule:
# this is checking periodically if there are any breaking API changes
# Every day at 00:00
- cron: '0 0 * * *'
defaults:
run:
shell: bash
jobs:
build_test:
name: Build and Test
permissions:
contents: read
checks: write
runs-on: ubuntu-latest
steps:
- name: ⬇️ Check out code into the Go module directory
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 #v6.0.1
- name: 🛠️ Set up Go 1.x
uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 #v6.2.0
with:
go-version-file: go.mod
- name: 🏗️ Compile
run: make compile
- name: 🚀 Binary starts
run: go run ./cmd/monaco
- name: 🛠️ Generate mocks
run: make mocks
- name: Install gotestsum
run: go install gotest.tools/gotestsum@3f7ff0ec4aeb6f95f5d67c998b71f272aa8a8b41 #v1.12.1
- name: 🧪 Unit test with coverage
# the coverage name has to match the one specified in "sonar-project.properties" and in the upload artifact step
run: gotestsum --format testdox --format-icons hivis -- -coverprofile=cov.out -tags=unit -v -race ./...
- name: ⬆️ Archive code coverage results
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f #v6.0.0
with:
name: code-coverage-report
path: cov.out
lint:
name: Run Static Code Analysis
runs-on: ubuntu-latest
permissions:
contents: read
checks: write
steps:
- name: ⬇️ Check out code into the Go module directory
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 #v6.0.1
- name: 🛠️ Set up Go 1.x
uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 #v6.2.0
with:
go-version-file: go.mod
- name: ✍️ Check format
run: make lint
- name: 🕵️ Go vet
run: make vet
- name: 🔎 golangci-lint
uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 #v9.2.0
with:
install-mode: 'goinstall' # install mode goinstall in order to use hashes for the version
version: eabc2638a66daf5bb6c6fb052a32fa3ef7b6600d #v2.1.6
args: '--output.checkstyle.path=lint-report.xml --issues-exit-code=0' # if issues are found, don't exit with "1". Sonar decides if it fails or not
- name: ⬆️ Archive lint results
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f #v6.0.0
with:
name: lint-report
path: lint-report.xml
sonar_scan:
name: Report lint and test coverage
if: ${{ always() }} # always runs after lint and test have completed, regardless of whether they were successful
needs: [build_test, lint]
permissions:
contents: read
checks: write
runs-on: ubuntu-latest
steps:
- name: ⬇️ Check out code into the Go module directory
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 #v6.0.1
with:
# Disabling shallow clones is recommended for improving the relevancy of reporting
fetch-depth: 0
- name: ⬇️ Download coverage artifact
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 #v7.0.0
with:
name: code-coverage-report
- name: ⬇️ Download lint artifact
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 #v7.0.0
with:
name: lint-report
- name: 🏷️ Get latest tag
id: get_latest_tag
run: |
echo "GIT_TAG=$(git describe --tags --abbrev=0)" >> "$GITHUB_OUTPUT"
- name: 🔍 SonarQube Scan
uses: SonarSource/sonarqube-scan-action@a31c9398be7ace6bbfaf30c0bd5d415f843d45e9 # nosemgrep false detection of commit v7.0.0
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
args: |
-Dsonar.projectVersion=${{steps.get_latest_tag.outputs.GIT_TAG}}