|
| 1 | +name: PR |
| 2 | +on: |
| 3 | + pull_request_target: |
| 4 | + types: [ opened, synchronize, reopened, labeled ] |
| 5 | + |
| 6 | +env: |
| 7 | + UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} |
| 8 | + |
| 9 | +defaults: |
| 10 | + run: |
| 11 | + shell: bash |
| 12 | + |
| 13 | +jobs: |
| 14 | + build: |
| 15 | + name: Build ${{ matrix.rid }} |
| 16 | + runs-on: ${{ matrix.os }} |
| 17 | + if: github.event.pull_request.head.repo.full_name == 'freezy/VisualPinball.Engine' || contains(github.event.pull_request.labels.*.name, 'safe to test') |
| 18 | + strategy: |
| 19 | + fail-fast: false |
| 20 | + matrix: |
| 21 | + include: |
| 22 | + - os: windows-latest |
| 23 | + rid: win-x64 |
| 24 | + - os: windows-latest |
| 25 | + rid: win-x86 |
| 26 | + - os: macos-latest |
| 27 | + rid: osx |
| 28 | + - os: macos-latest |
| 29 | + rid: ios-arm64 |
| 30 | + - os: ubuntu-latest |
| 31 | + rid: linux-x64 |
| 32 | + - os: ubuntu-latest |
| 33 | + rid: android-arm64-v8a |
| 34 | + steps: |
| 35 | + - uses: actions/checkout@v3 |
| 36 | + with: |
| 37 | + ref: ${{ github.event.pull_request.head.sha }} |
| 38 | + - uses: actions/setup-dotnet@v1 |
| 39 | + with: |
| 40 | + dotnet-version: '3.1.x' |
| 41 | + - name: Build |
| 42 | + run: | |
| 43 | + cd VisualPinball.Engine.Test |
| 44 | + dotnet build VisualPinball.Engine.Test.csproj -c Release -r ${{ matrix.rid }} |
| 45 | + - run: | |
| 46 | + mkdir tmp |
| 47 | + cp -r VisualPinball.Unity/Plugins/${{ matrix.rid }} tmp |
| 48 | + - uses: actions/upload-artifact@v3 |
| 49 | + with: |
| 50 | + name: Plugins |
| 51 | + path: tmp |
| 52 | + |
| 53 | + test: |
| 54 | + name: Unit Test |
| 55 | + needs: [ build ] |
| 56 | + runs-on: ubuntu-latest |
| 57 | + steps: |
| 58 | + - uses: actions/checkout@v3 |
| 59 | + with: |
| 60 | + ref: ${{ github.event.pull_request.head.sha }} |
| 61 | + - uses: actions/download-artifact@v3 |
| 62 | + with: |
| 63 | + name: Plugins |
| 64 | + path: VisualPinball.Unity/Plugins |
| 65 | + - uses: actions/cache@v3 |
| 66 | + with: |
| 67 | + path: VisualPinball.Unity/VisualPinball.Unity.Test/TestProject~/Library |
| 68 | + key: Library-Test-Project |
| 69 | + restore-keys: | |
| 70 | + Library-Test-Project |
| 71 | + Library |
| 72 | + - uses: game-ci/unity-test-runner@main |
| 73 | + id: test |
| 74 | + with: |
| 75 | + projectPath: VisualPinball.Unity/VisualPinball.Unity.Test/TestProject~ |
| 76 | + artifactsPath: VisualPinball.Unity/VisualPinball.Unity.Test/TestProject~/artifacts |
| 77 | + testMode: all |
| 78 | + customParameters: -debugCodeOptimization -enableCodeCoverage -burst-disable-compilation -coverageOptions enableCyclomaticComplexity;assemblyFilters:+VisualPinball.Engine;pathFilters:-**/VisualPinball.Engine/Math/Triangulator/**,-**/VisualPinball.Engine/Math/Mesh/** -coverageResultsPath artifacts |
| 79 | + - run: | |
| 80 | + curl -s https://codecov.io/bash | bash -s - -f ${{ steps.test.outputs.artifactsPath }}/TestProject~-opencov/EditMode/TestCoverageResults_0000.xml |
| 81 | + - uses: MirrorNG/[email protected] |
| 82 | + if: always() |
| 83 | + with: |
| 84 | + path: ${{ steps.test.outputs.artifactsPath }}/*.xml |
| 85 | + access-token: ${{ secrets.GITHUB_TOKEN }} |
| 86 | + - uses: actions/upload-artifact@v3 |
| 87 | + if: always() |
| 88 | + with: |
| 89 | + name: Test results |
| 90 | + path: ${{ steps.test.outputs.artifactsPath }} |
0 commit comments