Add CI and SonarQube workflows for automated testing and code quality analysis
Some checks failed
SonarQube Scan / SonarQube Analysis (push) Failing after 1m13s

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
2026-04-18 20:07:15 +01:00
parent 8bd45193b0
commit 65d939196c
4 changed files with 206 additions and 0 deletions

81
.gitea/workflows/ci.yml Normal file
View File

@@ -0,0 +1,81 @@
name: CI
on:
pull_request:
branches:
- main
- develop
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.23'
cache: true
- name: Run tests
run: go test -v -race -coverprofile=coverage.out ./src
- name: Upload coverage
uses: actions/upload-artifact@v3
with:
name: coverage
path: coverage.out
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.23'
cache: true
- name: Install golangci-lint
run: go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
- name: Run linter
run: golangci-lint run ./src
build:
name: Build
runs-on: ubuntu-latest
needs: [test, lint]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.23'
cache: true
- name: Build binary (Linux)
run: CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o epage-linux ./src
- name: Build binary (macOS)
run: CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -o epage-macos ./src
- name: Build binary (Windows)
run: CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o epage-windows.exe ./src
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: binaries
path: |
epage-linux
epage-macos
epage-windows.exe

View File

@@ -0,0 +1,31 @@
name: SonarQube Scan
on:
push:
branches:
- main
jobs:
sonarqube:
name: SonarQube Analysis
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.23'
cache: true
- name: Run tests with coverage
run: go test -v -coverprofile=coverage.out ./src
- name: Run SonarQube scanner
uses: SonarSource/sonarqube-scan-action@v7.1.0
env:
SONAR_HOST_URL: ${{ secrets.SONAR_URL }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}