refactor: Bump copyright year #1278
Workflow file for this run
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
# Copyright (c) Omar Boukli-Hacene. All rights reserved. | ||
# Distributed under an MIT-style license that can be | ||
# found in the LICENSE file. | ||
# SPDX-License-Identifier: MIT | ||
name: SonarCloud scan | ||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
push: | ||
branches: | ||
- main | ||
schedule: | ||
- cron: 10 22 * * 5 | ||
workflow_dispatch: | ||
permissions: {} | ||
jobs: | ||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
env: | ||
SONAR_SCANNER_VERSION: 5.0.1.3006 | ||
SONAR_SERVER_URL: https://sonarcloud.io | ||
BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory | ||
COVERAGE_REPORTS_PATH: ${{ github.workspace }}/coverage.xml | ||
steps: | ||
- name: Update dependency list | ||
run: sudo apt-get update | ||
- name: Install dependencies | ||
run: >- | ||
sudo apt-get install | ||
--assume-yes | ||
--quiet | ||
autoconf-archive | ||
gcovr | ||
lcov | ||
libboost-test-dev | ||
libsdl2-dev | ||
xvfb | ||
- name: Check out repository | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
persist-credentials: false | ||
- name: Cache SonarCloud packages | ||
uses: actions/cache@v3 | ||
with: | ||
path: sonarscanner_cache | ||
key: ${{ runner.os }}-sonar-${{ hashFiles( | ||
'ci/cache-key-salt/sonarscanner.txt' | ||
) }} | ||
restore-keys: ${{ runner.os }}-sonar | ||
- name: Download and set up sonar-scanner | ||
env: | ||
SONAR_SCANNER_DOWNLOAD_URL: https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${{ env.SONAR_SCANNER_VERSION }}-linux.zip | ||
run: >- | ||
mkdir --parents "$HOME/.sonar" | ||
curl | ||
--silent | ||
--show-error | ||
--location | ||
--output "$HOME/.sonar/sonar-scanner.zip" | ||
'${{ env.SONAR_SCANNER_DOWNLOAD_URL }}' | ||
unzip | ||
-o "$HOME/.sonar/sonar-scanner.zip" | ||
-d "$HOME/.sonar/" | ||
echo "$HOME/.sonar/sonar-scanner-${{ env.SONAR_SCANNER_VERSION }}-linux/bin" | ||
>> "$GITHUB_PATH" | ||
- name: Download and set up build-wrapper | ||
env: | ||
BUILD_WRAPPER_DOWNLOAD_URL: ${{ env.SONAR_SERVER_URL }}/static/cpp/build-wrapper-linux-x86.zip | ||
run: >- | ||
curl | ||
--silent | ||
--show-error | ||
--location | ||
--output "$HOME/.sonar/build-wrapper-linux-x86.zip" | ||
'${{ env.BUILD_WRAPPER_DOWNLOAD_URL }}' | ||
unzip | ||
-o "$HOME/.sonar/build-wrapper-linux-x86.zip" | ||
-d "$HOME/.sonar/" | ||
echo "$HOME/.sonar/build-wrapper-linux-x86" | ||
>> "$GITHUB_PATH" | ||
- name: Run autogen.sh | ||
run: ./autogen.sh | ||
- name: Configure build | ||
run: >- | ||
./configure | ||
--enable-code-coverage | ||
CPPFLAGS='-DTROMINO_2D_HEADLESS' | ||
- name: Run build-wrapper | ||
run: >- | ||
build-wrapper-linux-x86-64 | ||
--out-dir '${{ env.BUILD_WRAPPER_OUT_DIR }}' | ||
make clean all check | ||
- name: Run tromino | ||
run: ./tromino 2> /dev/null || true | ||
- name: Run tromino 5 0 0 | ||
run: ./tromino 5 0 0 2> /dev/null || true | ||
- name: Run tromino 2 0 7 | ||
run: ./tromino 2 0 7 2> /dev/null || true | ||
- name: Run tromino 2 0 1 | ||
run: ./tromino 2 0 1 | ||
- name: Run tromino 8 3 5 | ||
run: ./tromino 8 3 5 | ||
- name: Run tromino2d | ||
run: ./tromino2d 2> /dev/null || true | ||
- name: Run tromino2d 5 0 0 | ||
run: ./tromino2d 5 0 0 2> /dev/null || true | ||
- name: Run tromino2d 8192 0 0 | ||
run: ./tromino2d 8192 0 0 2> /dev/null || true | ||
- name: Run tromino2d 1024 0 0 -f | ||
run: ./tromino2d 1024 0 0 -f 2> /dev/null || true | ||
- name: Start Xvfb | ||
run: Xvfb :99 -screen 0 1024x768x24 & | ||
- name: Run tromino2d 2 0 0 -f | ||
env: | ||
DISPLAY: :99 | ||
run: ./tromino2d 2 0 0 -f | ||
- name: Run tromino2d 8 2 5 | ||
env: | ||
DISPLAY: :99 | ||
run: ./tromino2d 8 2 5 | ||
- name: Run gcovr | ||
run: >- | ||
gcovr | ||
--exclude='./test' | ||
--exclude='/usr/include' | ||
--keep | ||
--root '.' | ||
--sonarqube '${{ env.COVERAGE_REPORTS_PATH }}' | ||
- name: Run sonar-scanner | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | ||
run: >- | ||
sonar-scanner | ||
--define sonar.host.url='${{ env.SONAR_SERVER_URL }}' | ||
--define sonar.cfamily.build-wrapper-output='${{ env.BUILD_WRAPPER_OUT_DIR }}' | ||
--define sonar.coverageReportPaths='${{ env.COVERAGE_REPORTS_PATH }}' |