A game framework written with osu! in mind.
1on: [push, pull_request]
2name: Continuous Integration
3
4jobs:
5 test:
6 name: Test
7 runs-on: ${{matrix.os.fullname}}
8 env:
9 OSU_EXECUTION_MODE: ${{matrix.threadingMode}}
10 strategy:
11 fail-fast: false
12 matrix:
13 os:
14 - { prettyname: Windows, fullname: windows-latest }
15 - { prettyname: macOS, fullname: macos-latest }
16 - { prettyname: Linux, fullname: ubuntu-latest }
17 threadingMode: ['SingleThread', 'MultiThreaded']
18 timeout-minutes: 60
19 steps:
20 - name: Checkout
21 uses: actions/checkout@v2
22
23 - name: Install .NET 5.0.x
24 uses: actions/setup-dotnet@v1
25 with:
26 dotnet-version: "5.0.x"
27
28 # FIXME: libavformat is not included in Ubuntu. Let's fix that.
29 # https://github.com/ppy/osu-framework/issues/4349
30 # Remove this once https://github.com/actions/virtual-environments/issues/3306 has been resolved.
31 - name: Install libavformat-dev
32 if: ${{matrix.os.fullname == 'ubuntu-latest'}}
33 run: |
34 sudo apt-get update && \
35 sudo apt-get -y install libavformat-dev
36
37 - name: Compile
38 run: dotnet build -c Debug -warnaserror build/Desktop.proj
39
40 - name: Test
41 run: dotnet test $pwd/*.Tests/bin/Debug/*/*.Tests.dll --settings $pwd/build/vstestconfig.runsettings --logger "trx;LogFileName=TestResults-${{matrix.os.prettyname}}-${{matrix.threadingMode}}.trx"
42 shell: pwsh
43
44 # Attempt to upload results even if test fails.
45 # https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#always
46 - name: Upload Test Results
47 uses: actions/upload-artifact@v2
48 if: ${{ always() }}
49 with:
50 name: osu-framework-test-results-${{matrix.os.prettyname}}-${{matrix.threadingMode}}
51 path: ${{github.workspace}}/TestResults/TestResults-${{matrix.os.prettyname}}-${{matrix.threadingMode}}.trx
52
53 inspect-code:
54 name: Code Quality
55 runs-on: ubuntu-latest
56 steps:
57 - name: Checkout
58 uses: actions/checkout@v2
59
60 # FIXME: Tools won't run in .NET 5.0 unless you install 3.1.x LTS side by side.
61 # https://itnext.io/how-to-support-multiple-net-sdks-in-github-actions-workflows-b988daa884e
62 - name: Install .NET 3.1.x LTS
63 uses: actions/setup-dotnet@v1
64 with:
65 dotnet-version: "3.1.x"
66
67 - name: Install .NET 5.0.x
68 uses: actions/setup-dotnet@v1
69 with:
70 dotnet-version: "5.0.x"
71
72 - name: Restore Tools
73 run: dotnet tool restore
74
75 - name: Restore Packages
76 run: dotnet restore
77
78 - name: CodeFileSanity
79 run: |
80 # TODO: Add ignore filters and GitHub Workflow Command Reporting in CFS. That way we don't have to do this workaround.
81 # FIXME: Suppress warnings from templates project
82 dotnet codefilesanity | while read -r line; do
83 if [[ "$line" != *"/osu.Framework.Templates/"* ]]; then
84 echo "::warning::$line"
85 fi
86 done
87
88 # Temporarily disabled due to test failures, but it won't work anyway until the tool is upgraded.
89 # - name: .NET Format (Dry Run)
90 # run: dotnet format --dry-run --check
91
92 - name: InspectCode
93 run: dotnet jb inspectcode $(pwd)/osu-framework.Desktop.slnf --output=$(pwd)/inspectcodereport.xml --cachesDir=$(pwd)/inspectcode --verbosity=WARN
94
95 - name: NVika
96 run: dotnet nvika parsereport "${{github.workspace}}/inspectcodereport.xml" --treatwarningsaserrors