Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable test with Unity CI #1

Merged
merged 1 commit into from
Nov 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/check_test.yml
Original file line number Diff line number Diff line change
@@ -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 }}
8 changes: 4 additions & 4 deletions Assets/Scripts/Game/Tests/E2ETest/Levels/LevelsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,13 @@ public IEnumerator EvaluateLevel(int level)
GetInstance<IRoundService>().SetRound(level);
GetInstance<IRoundService>().EndRound(false);

yield return new WaitForSeconds(2.0f);
yield return new WaitForSeconds(4.50f);
var startRound = GetInstance<IRoundService>().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<CardView>();

Expand All @@ -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<IRoundService>().GetRound();
Assert.AreEqual(startRound + 1, endRound);
Expand Down
Loading