Skip to content

chore(deps): bump actions/download-artifact from 4.2.1 to 4.3.0 #69

chore(deps): bump actions/download-artifact from 4.2.1 to 4.3.0

chore(deps): bump actions/download-artifact from 4.2.1 to 4.3.0 #69

Workflow file for this run

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@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
- name: 🛠️ Set up Go 1.x
uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b #v5.4.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@ea165f8d65b6e75b540449e92b4886f43607fa02 #v4.6.2
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@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
- name: 🛠️ Set up Go 1.x
uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b #v5.4.0
with:
go-version-file: go.mod
- name: ✍️ Check format
run: make lint
- name: 🕵️ Go vet
run: make vet
- name: 🔎 golangci-lint
uses: reviewdog/action-golangci-lint@f9bba13753278f6a73b27a56a3ffb1bfda90ed71 #v2.8.0
with:
go_version_file: go.mod
github_token: ${{ secrets.GITHUB_TOKEN }}
reporter: github-pr-check
golangci_lint_version: v2.0.2
# the name has to be as the same as the one specified in "sonar-project.properties" and in the upload artifact step
golangci_lint_flags: "--output.checkstyle.path=lint-report.xml"
- name: ⬆️ Archive lint results
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 #v4.6.2
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@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
with:
# Disabling shallow clones is recommended for improving the relevancy of reporting
fetch-depth: 0
- name: ⬇️ Download coverage artifact
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 #v4.3.0
with:
name: code-coverage-report
- name: ⬇️ Download lint artifact
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 #v4.3.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@aa494459d7c39c106cc77b166de8b4250a32bb97 # nosemgrep false detection of commit v5.1.0
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
args: |
-Dsonar.projectVersion=${{steps.get_latest_tag.outputs.GIT_TAG}}