71 lines
1.7 KiB
YAML
71 lines
1.7 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
pull_request:
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: build-htz-01
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- goos: linux
|
|
goarch: amd64
|
|
artifact: tx-sync-linux-amd64
|
|
- goos: windows
|
|
goarch: amd64
|
|
artifact: tx-sync-windows-amd64.exe
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version-file: go.mod
|
|
|
|
- name: Test
|
|
run: go test ./...
|
|
|
|
- name: Build
|
|
env:
|
|
GOOS: ${{ matrix.goos }}
|
|
GOARCH: ${{ matrix.goarch }}
|
|
GOAMD64: v1
|
|
CGO_ENABLED: "0"
|
|
run: go build -trimpath -ldflags="-s -w" -o "${{ matrix.artifact }}" .
|
|
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: ${{ matrix.artifact }}
|
|
path: ${{ matrix.artifact }}
|
|
|
|
sonarqube:
|
|
name: SonarQube
|
|
runs-on: build-htz-01
|
|
steps:
|
|
- name: Checkout Code
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Create Valid Project Key
|
|
id: sonar_setup
|
|
run: |
|
|
CLEAN_KEY=$(echo "${{ gitea.repository }}" | tr '/' ':')
|
|
echo "key=$CLEAN_KEY" >> $GITHUB_OUTPUT
|
|
|
|
- name: SonarQube Scan
|
|
uses: sonarsource/sonarqube-scan-action@master
|
|
continue-on-error: true
|
|
env:
|
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
|
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
|
|
with:
|
|
args: >
|
|
-Dsonar.projectKey=${{ steps.sonar_setup.outputs.key }}
|
|
-Dsonar.projectName=${{ gitea.repository }}
|
|
-Dsonar.qualitygate.wait=true |