From 235eb62f80840810c2278631d87622c1cea79846 Mon Sep 17 00:00:00 2001 From: MrGadget1024 <9826063+MrGadget1024@users.noreply.github.com> Date: Fri, 20 Jan 2023 02:31:13 -0500 Subject: [PATCH] Refactor workflows --- .github/workflows/RunUnityTests.yml | 61 +++++++++++++++++++++++++++++ .github/workflows/Semantic.yml | 1 + .github/workflows/SonarQube.yml | 1 + .github/workflows/activation.yml | 6 +-- .github/workflows/main.yml | 59 +++------------------------- 5 files changed, 72 insertions(+), 56 deletions(-) create mode 100644 .github/workflows/RunUnityTests.yml diff --git a/.github/workflows/RunUnityTests.yml b/.github/workflows/RunUnityTests.yml new file mode 100644 index 000000000..719c0027c --- /dev/null +++ b/.github/workflows/RunUnityTests.yml @@ -0,0 +1,61 @@ +name: Run Unity Tests + +on: + workflow_dispatch: + workflow_call: + +jobs: + RunUnityTests: + name: Run Unity Tests + runs-on: ubuntu-latest + strategy: + matrix: + unityVersion: + - 2019.4.40f1 + - 2020.3.44f1 + - 2021.3.16f1 + - 2022.2.2f1 + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + # Do Not Enable Caching --- Library needs to be recompiled every time because Weaver + # Leaving this here for posterity to ensure we never turn this on. + #- name: Cache Library + # id: cache-library + # uses: actions/cache@v3 + # with: + # path: Library + # key: Library-${{ matrix.unityVersion }} + + - name: Run editor Tests + continue-on-error: true + uses: game-ci/unity-test-runner@main + + # We can use the same license for all Unity versions + env: + UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} + + # testMode is set to editMode (editor tests only) until we fix playmode tests (or eliminate them) + # `-stackTraceLogType None` speeds up the job and vastly shrinks the log output + # If a test actually fails, we'll diagnose it locally anyway, so the stacktrace doesn't really help + with: + projectPath: ./ + testMode: editmode + unityVersion: ${{ matrix.unityVersion }} + githubToken: ${{ secrets.GITHUB_TOKEN }} + customParameters: -stackTraceLogType None + + - name: Archive test results + uses: actions/upload-artifact@v3 + with: + name: Test Results ${{ matrix.unityVersion }} + path: artifacts + + - name: Publish test results + uses: MirrorNetworking/nunit-reporter@master + with: + reportTitle: Test Report ${{ matrix.unityVersion }} + path: "artifacts/*.xml" + access-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/Semantic.yml b/.github/workflows/Semantic.yml index cfed4c3a5..b982b25f5 100644 --- a/.github/workflows/Semantic.yml +++ b/.github/workflows/Semantic.yml @@ -1,6 +1,7 @@ name: Semantic Release on: + workflow_dispatch: workflow_call: jobs: diff --git a/.github/workflows/SonarQube.yml b/.github/workflows/SonarQube.yml index 4977158f0..4ffa2173e 100644 --- a/.github/workflows/SonarQube.yml +++ b/.github/workflows/SonarQube.yml @@ -1,6 +1,7 @@ name: SonarQube Analysis on: + workflow_dispatch: workflow_call: jobs: diff --git a/.github/workflows/activation.yml b/.github/workflows/activation.yml index 3fa84065e..487dfb5de 100644 --- a/.github/workflows/activation.yml +++ b/.github/workflows/activation.yml @@ -1,15 +1,15 @@ name: Acquire Activation File on: - workflow_dispatch: {} + workflow_dispatch: jobs: activation: - name: Request Manual Activation File 🔑 + name: Acquire Activation File 🔑 runs-on: ubuntu-latest steps: - - name: Request Manual Activation File + - name: Acquire Activation File id: getManualLicenseFile uses: game-ci/unity-request-activation-file@v2 with: diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e20dca576..42485e1b8 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,7 +1,8 @@ name: Run Unity Tests on: - pull_request: {} + workflow_dispatch: + pull_request: push: branches: - master @@ -21,65 +22,17 @@ on: jobs: RunUnityTests: name: Run Unity Tests - runs-on: ubuntu-latest - strategy: - matrix: - unityVersion: - - 2019.4.40f1 - - 2020.3.44f1 - - 2021.3.16f1 - - 2022.2.2f1 - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - # Do Not Enable Caching --- Library needs to be recompiled every time because Weaver - # Leaving this here for posterity to ensure we never turn this on. - #- name: Cache Library - # id: cache-library - # uses: actions/cache@v3 - # with: - # path: Library - # key: Library-${{ matrix.unityVersion }} - - - name: Run editor Tests - continue-on-error: true - uses: game-ci/unity-test-runner@main - - # We can use the same license for all Unity versions - env: - UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} - - # testMode is set to editMode (editor tests only) until we fix playmode tests (or eliminate them) - # `-stackTraceLogType None` speeds up the job and vastly shrinks the log output - # If a test actually fails, we'll diagnose it locally anyway, so the stacktrace doesn't really help - with: - projectPath: ./ - testMode: editmode - unityVersion: ${{ matrix.unityVersion }} - githubToken: ${{ secrets.GITHUB_TOKEN }} - customParameters: -stackTraceLogType None - - - name: Archive test results - uses: actions/upload-artifact@v3 - with: - name: Test Results ${{ matrix.unityVersion }} - path: artifacts - - - name: Publish test results - uses: MirrorNetworking/nunit-reporter@master - with: - reportTitle: Test Report ${{ matrix.unityVersion }} - path: "artifacts/*.xml" - access-token: ${{ secrets.GITHUB_TOKEN }} + uses: ./.github/workflows/RunUnityTests.yml + secrets: inherit #SonarQube: # name: SonarQube Analysis # needs: RunUnityTests # uses: ./.github/workflows/SonarQube.yml + # secrets: inherit Release: name: Semantic Release needs: RunUnityTests uses: ./.github/workflows/Semantic.yml + secrets: inherit