Merge branch 'main' into aro/windows-dev #205
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Analyze | |
on: | |
push: | |
branches: | |
- '**' | |
pull_request: | |
branches: | |
- '**' | |
jobs: | |
build: | |
name: Build and analyze with SonarQube | |
runs-on: ubuntu-latest | |
steps: | |
# Step 1: Checkout the repository | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Ensure full history for analysis | |
- name: Update submodules | |
run: git submodule update --init --recursive | |
# Step 2: Install dependencies | |
- name: Install dependencies | |
run: | | |
sudo apt update | |
sudo apt install -y cmake build-essential pkg-config \ | |
libglfw3-dev libgl1-mesa-dev libx11-dev libgl-dev libglm-dev libfreetype6-dev ccache lua5.4 liblua5.4-dev | |
- name: Update submodules | |
run: git submodule update --init --recursive | |
# Step 3: Generate and build the project using CMake | |
- name: Configure and build project | |
run: | | |
mkdir -p build | |
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release | |
cmake --build build | |
# Step 4: Run SonarQube analysis | |
- name: Run SonarQube scan | |
uses: sonarsource/sonarqube-scan-action@v3 | |
env: | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} | |
# Optional: Enforce quality gate | |
# Uncomment the following lines to fail the workflow if the Quality Gate is not met | |
# - name: Check SonarQube quality gate | |
# uses: sonarsource/sonarqube-quality-gate-action@master | |
# timeout-minutes: 5 | |
# env: | |
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |