Tests #535
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: Tests | |
on: | |
schedule: | |
- cron: "5 2 * * *" | |
push: | |
branches: | |
- main | |
pull_request: | |
workflow_dispatch: | |
env: | |
OUTPUT_PATH: ${{ github.workspace }}/output | |
TESTS_PATH: ${{ github.workspace }}/src/ScoopSearch.Indexer.Tests/ | |
GitHub__Token: ${{ secrets.GITHUB_TOKEN }} | |
DOTNET_VERSION: '8.0.x' | |
# SONAR_TOKEN: '' # Stored in the Actions secrets | |
jobs: | |
tests: | |
name: Tests ⚙️🧪 | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Full history for Sonar blame | |
- name: Setup .NET ${{ env.DOTNET_VERSION }} | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: ${{ env.DOTNET_VERSION }} | |
- name: Install SonarScanner and dotnet-coverage | |
run: | | |
dotnet tool install --global dotnet-sonarscanner | |
dotnet tool install --global dotnet-coverage | |
- name: Install dependencies | |
run: dotnet restore ${{ env.TESTS_PATH }} | |
- name: Start SonarScanner | |
run: > | |
dotnet sonarscanner begin | |
/o:"scoopinstaller" | |
/k:"ScoopInstaller_ScoopInstaller.scoopinstaller.github.io-indexer" | |
/d:sonar.token="${{ secrets.SONAR_TOKEN }}" | |
/d:sonar.host.url="https://sonarcloud.io" | |
/d:sonar.cs.vscoveragexml.reportsPaths=coverage.xml | |
- name: Tests | |
run: > | |
dotnet-coverage collect | |
"dotnet test ${{ env.TESTS_PATH }} --configuration Release --no-restore" | |
-f xml | |
-o "coverage.xml" | |
- name: Stop SonarScanner and send analysis | |
run: | | |
export JAVA_HOME=$JAVA_HOME_17_X64 # Force JAVA_HOME environment variable (Version 11 or 17 is required by SonarScanner) | |
dotnet sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}" | |
keepalive: | |
name: Keepalive Workflow | |
runs-on: ubuntu-latest | |
permissions: | |
actions: write | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: gautamkrishnar/keepalive-workflow@v2 |