Skip to content

Update ci.yml

Update ci.yml #1525

Workflow file for this run

name: CI
on:
push:
pull_request:
types: [opened]
jobs:
build:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
DOTNET_ROLL_FORWARD: Major
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
# Manually install .NET SDK
- name: Download .NET SDK
run: |
DOTNET_VERSION=7.0.100
wget https://download.visualstudio.microsoft.com/download/pr/69beb740-ba0e-4a0b-a82a-737c61cb75cb/eff5e94b382efcdcd2a80278e04edb92/dotnet-runtime-9.0.0-rc.2.24473.5-linux-x64.tar.gz
mkdir -p $HOME/dotnet
tar -zxf dotnet-sdk-$DOTNET_VERSION-linux-x64.tar.gz -C $HOME/dotnet
# Add .NET to the PATH
- name: Setup .NET PATH
run: |
echo "$HOME/dotnet" >> $GITHUB_PATH
# - name: Setup .NET
# uses: actions/[email protected]
# with:
# dotnet-version: '9.0.x'
# dotnet-quality: 'preview'
- name: Setup Java JDK
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 21
- name: Restore tools
run: dotnet tool restore
- name: Begin scan
if: env.SONAR_TOKEN != null && env.SONAR_TOKEN != ''
run: dotnet sonarscanner begin /k:"GenHTTP" /d:sonar.token="$SONAR_TOKEN" /d:sonar.cs.opencover.reportsPaths="**/coverage.opencover.xml" /d:sonar.exclusions="**/bin/**/*,**/obj/**/*,**/Playground/**/*,**/*.css,**/*.js,**/*.html" /o:"kaliumhexacyanoferrat" /k:"GenHTTP" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.branch.name="${GITHUB_REF##*/}" /d:sonar.dotnet.excludeTestProjects=true
- name: Build project
run: dotnet build GenHTTP.sln -c Release
- name: Test project
run: dotnet test -c Release --no-build GenHTTP.sln --collect:"XPlat Code Coverage" -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=opencover
- name: End scan
if: env.SONAR_TOKEN != null && env.SONAR_TOKEN != ''
run: dotnet sonarscanner end /d:sonar.token="$SONAR_TOKEN"