Skip to content

Løsningsforslag samling 1 #1

Løsningsforslag samling 1

Løsningsforslag samling 1 #1

name: Analyze
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
name: Build and analyze
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: 'maven'
- name: Build Java Consumer
working-directory: 2-EventDriven/java-consumer
run: |
if ! command -v mvn &> /dev/null; then
echo "Maven not found, installing..."
curl -fsSL https://archive.apache.org/dist/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.tar.gz | tar xz -C /tmp
export PATH=/tmp/apache-maven-3.9.6/bin:$PATH
fi
mvn clean compile
- name: Set up .NET 8
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Build .NET Consumer
working-directory: 2-EventDriven/dotnet-consumer
run: dotnet build
- uses: SonarSource/sonarqube-scan-action@v6
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ vars.SONAR_HOST_URL }}
- name: SonarQube Quality Gate check
uses: SonarSource/sonarqube-quality-gate-action@v1
timeout-minutes: 5
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ vars.SONAR_HOST_URL }}