From 779518076c9f61a14663fa96e54311c01a2887e5 Mon Sep 17 00:00:00 2001 From: josemgmz Date: Thu, 21 Nov 2024 22:14:58 +0100 Subject: [PATCH] ci: unity ci for test --- .github/workflows/check_test.yml | 45 +++++++++++++++++++ .../Game/Tests/E2ETest/Levels/LevelsTests.cs | 8 ++-- 2 files changed, 49 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/check_test.yml diff --git a/.github/workflows/check_test.yml b/.github/workflows/check_test.yml new file mode 100644 index 0000000..af01cd1 --- /dev/null +++ b/.github/workflows/check_test.yml @@ -0,0 +1,45 @@ +name: Check Tests + +on: [push, pull_request] + +jobs: + buildAndTestForLinuxBasedPlatforms: + name: Build for ${{ matrix.targetPlatform }} + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + projectPath: + - ./ + unityVersion: + - 6000.0.24f1 + targetPlatform: + - Android + steps: + # Checkout the code + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + lfs: true + + # Cache Unity Library + - uses: actions/cache@v3 + with: + path: ${{ matrix.projectPath }}/Library + key: Library-${{ matrix.projectPath }}-${{ matrix.targetPlatform }}-${{ hashFiles(matrix.projectPath) }} + restore-keys: | + Library-${{ matrix.projectPath }}-${{ matrix.targetPlatform }}- + Library-${{ matrix.projectPath }}- + Library- + + # Step 1: Run Unity Tests + - uses: game-ci/unity-test-runner@v4 + id: testRunner + env: + UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} + UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} + UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} + with: + projectPath: ${{ matrix.projectPath }} + unityVersion: ${{ matrix.unityVersion }} + githubToken: ${{ secrets.GITHUB_TOKEN }} diff --git a/Assets/Scripts/Game/Tests/E2ETest/Levels/LevelsTests.cs b/Assets/Scripts/Game/Tests/E2ETest/Levels/LevelsTests.cs index 5ac17a2..2aac07b 100644 --- a/Assets/Scripts/Game/Tests/E2ETest/Levels/LevelsTests.cs +++ b/Assets/Scripts/Game/Tests/E2ETest/Levels/LevelsTests.cs @@ -105,13 +105,13 @@ public IEnumerator EvaluateLevel(int level) GetInstance().SetRound(level); GetInstance().EndRound(false); - yield return new WaitForSeconds(2.0f); + yield return new WaitForSeconds(4.50f); var startRound = GetInstance().GetRound(); var play = GameObject.Find(PLAY_BUTTON_OBJECT); yield return PerformDrag(play.transform.position, play.transform.position + Vector3.down, 0.25f, RenderMode.ScreenSpaceCamera); - yield return new WaitForSeconds(5.0f); + yield return new WaitForSeconds(7.25f); var cardGrid = GameObject.Find(CARD_GRID_OBJECT); var cards = cardGrid.GetComponentsInChildren(); @@ -123,10 +123,10 @@ public IEnumerator EvaluateLevel(int level) foreach (var card in pair) { yield return PerformDrag(card.transform.position, card.transform.position + Vector3.down, 0.25f, RenderMode.ScreenSpaceCamera); - yield return new WaitForSeconds(0.25f); + yield return new WaitForSeconds(0.75f); } } - yield return new WaitForSeconds(1.0f); + yield return new WaitForSeconds(2.0f); var endRound = GetInstance().GetRound(); Assert.AreEqual(startRound + 1, endRound);