Skip to content

Cleanup sonar issues #786

Cleanup sonar issues

Cleanup sonar issues #786

Workflow file for this run

name: Go
on:
push:
branches: [ main, develop ]
tags:
- '*'
pull_request:
types: [ opened, synchronize, reopened ]
branches: [ main, develop ]
jobs:
build:
name: Lint, Build and Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.23.0
- name: Lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.60.3
- name: Build
run: go build -tags release -v .
- name: Test
run: go test -tags release -timeout 1m -race -v -coverprofile=coverage.out ./...
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
code-ql:
name: CodeQL Analysis
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
security-events: write
packages: read
actions: read
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: go
build-mode: autobuild
queries: security-and-quality
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:go"
release:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
needs: [ build, code-ql ]
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.23.0
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ github.actor }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v3
with:
distribution: goreleaser
version: v1.26
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ACCOUNT_GITHUB_TOKEN: ${{ secrets.ACCOUNT_GITHUB_TOKEN }}
- name: Build and publish NPM packages
uses: evg4b/goreleaser-npm-publisher-action@v1.0.0
with:
token: ${{ secrets.NPM_AUTH_TOKEN }}
description: A simple dev HTTP/HTTPS reverse proxy for replacing CORS headers.