-
Notifications
You must be signed in to change notification settings - Fork 6
59 lines (55 loc) · 1.86 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
name: CI
on:
push:
branches:
- mainstream
- release/*
pull_request:
paths-ignore:
- '**/*.md'
- '**/*.txt'
permissions: read-all
jobs:
test:
name: Test
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of SonarCloud analysis
- name: Set up JDK 17 # Needed for sonarscanner
uses: actions/setup-java@v4
with:
distribution: 'microsoft'
java-version: '17'
- name: Set up .NET SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.0.x
- name: Restore .NET local tools
run: dotnet tool restore
- name: Enable SonarCloud scanning
env:
# We can't use secrets in if conditions so we first put it in an environment variable.
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
if: vars.SONAR_PROJECT_KEY != null && env.SONAR_TOKEN != null && runner.os == 'Linux'
run: |
dotnet sonarscanner begin /k:"${{ vars.SONAR_PROJECT_KEY }}" /o:"${{ vars.SONAR_PROJECT_ORGANIZATION }}" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.opencover.reportsPaths="./**/*.opencover.xml"
- name: Run tests
run: |
dotnet run --project eng/Farkle.Build.fsproj -- -t Test
- name: End SonarCloud scanning
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
if: vars.SONAR_PROJECT_KEY != null && env.SONAR_TOKEN != null && runner.os == 'Linux'
run: |
dotnet sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"
full_ci_passed:
needs: [test]
runs-on: ubuntu-latest
steps:
- run: exit 0