48 lines
989 B
YAML
48 lines
989 B
YAML
name: Go CI/CD
|
|
run-name: ${{ github.actor }} is running CI/CD protected
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- release/**
|
|
- develop
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
- release/**
|
|
- develop
|
|
|
|
jobs:
|
|
go-ci:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: '1.24'
|
|
|
|
- name: Download dependencies
|
|
shell: bash
|
|
run: |
|
|
go mod tidy -x
|
|
|
|
- name: Run tests
|
|
shell: bash
|
|
run: |
|
|
go test -json > test-report.out
|
|
go test -coverprofile=coverage.out
|
|
|
|
- name: SonarQube Analysis
|
|
uses: SonarSource/sonarqube-scan-action@v5
|
|
env:
|
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
|
SONAR_HOST_URL: ${{ vars.SONAR_HOST_URL }}
|
|
|
|
- name: Build binary
|
|
shell: bash
|
|
run: |
|
|
go build -o ./bin/app main.go |