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

Split tests by modules in Github Actions #558

Merged
merged 1 commit into from
Jul 12, 2024
Merged

Split tests by modules in Github Actions #558

merged 1 commit into from
Jul 12, 2024

Conversation

siarhei-luskanau
Copy link
Contributor

No description provided.

steps:
- uses: actions/checkout@v4
- name: Setup test environment
uses: ./.github/actions/setup_test_action
timeout-minutes: 10
- name: Run JS Tests
run: ./gradlew cleanTest jsTest
run: ./gradlew ${{ matrix.gradle_tasks }}
- name: Upload JS test artifact
uses: actions/upload-artifact@v4
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All artifacts should have a unique name, so it should derive the name of the artifact from the gradle task. E.g "JS firebase-firestore Firebase Debug Log"

"firebase-analytics"
).contains(subProject.name).not()
}.map { subProject ->
"${subProject.path}:iosSimulatorArm64Test"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should check for the CPU architecture running the gradle script. For X86-64 CPUs it should be using iosX64Test

@@ -143,24 +143,6 @@ kotlin {
}
}

if (project.property("firebase-storage.skipIosTests") == "true") {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there anywhere these tests are still disabled when you run them locally. While the gradle script is fine for generating the CI matrix, we should still be able to run ./gradlew testIosArmSimulator64 without issue on a local checkout

Copy link
Contributor Author

@siarhei-luskanau siarhei-luskanau Jul 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I propose two ways for running tests locally:

  • create custom Gradle tasks (like devIosTests, devJsTests, devJvmTests) in root build.gradle.kts file. This tasks will use the EmulatorJobsMatrix.kt logic. As result many build.gradle.kts files will have less code.

  • EmulatorJobsMatrix.kt logic use the gradle.properties file for excluding jobs from matrix.

@Daeda88 What do you prefer for running tests locally?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it should be the latter. Making custom gradle tasks to get back functionality that is there by default on gradle feels a bit weird to me.

You are right on having many build gradle scripts that do the same thing, but I think a better long term solution for that is to make a custom gradle plugin that does all the recurring setup. Not that I;m saying you should implement that mind you, just that if we want to reduce code, there is a better way.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it should be the latter. Making custom gradle tasks to get back functionality that is there by default on gradle feels a bit weird to me.

Agreed, the default test tasks should work as people expect

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

}.map { subProject ->
when (val osArch = System.getProperty("os.arch")) {
"x86", "i386", "ia-32", "i686",
"x86_64", "amd64", "x64", "x86-64" -> "${subProject.path}:iosSimulatorX64Test"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Task is called iosX64Test for X64 and iosX86Test for x86 machines. No Simulator in there. Since iphones were always Arm based, there is a distinction between SimulatorArm (a simulator) and Arm (an actual iphone) that is not required for Intel architecture

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

@nbransby
Copy link
Member

nbransby commented Jul 9, 2024

image @siarhei-luskanau do you know why these get stuck on waiting for status to be reported?

@siarhei-luskanau
Copy link
Contributor Author

image @siarhei-luskanau do you know why these get stuck on waiting for status to be reported?

@nbransby I have no idea. Looks like it is related the matrix jobs

@nbransby
Copy link
Member

nbransby commented Jul 9, 2024

Is there a way to fix that?

@siarhei-luskanau
Copy link
Contributor Author

@nbransby
Copy link
Member

I don't believe so as it works on other PRs fine - example #504

@siarhei-luskanau
Copy link
Contributor Author

I don't believe so as it works on other PRs fine - example #504

I have found similar issue with Expected — Waiting for status to be reported https://github.com/orgs/community/discussions/26698

@nbransby
Copy link
Member

Ok thanks for the extra info, I've fixed that now. There is one failing test which I don't think has anything to do with these changes but would be good to get fixed before merging in:

dev.gitlive.firebase.auth.FirebaseAuthTest.testSignInWithUsernameAndPassword[iosSimulatorArm64] FAILED
    dev.gitlive.firebase.FirebaseNetworkException at /opt/buildAgent/work/b2e1db4d8d903ca4/kotlin/kotlin-native/runtime/src/main/kotlin/kotlin/Throwable.kt:28

Not sure why there is network connection issues with the ios simulator, could it be to do with the Firebase Local Emulator Suite setup?

@siarhei-luskanau
Copy link
Contributor Author

Ok thanks for the extra info, I've fixed that now. There is one failing test which I don't think has anything to do with these changes but would be good to get fixed before merging in:

dev.gitlive.firebase.auth.FirebaseAuthTest.testSignInWithUsernameAndPassword[iosSimulatorArm64] FAILED
    dev.gitlive.firebase.FirebaseNetworkException at /opt/buildAgent/work/b2e1db4d8d903ca4/kotlin/kotlin-native/runtime/src/main/kotlin/kotlin/Throwable.kt:28

Not sure why there is network connection issues with the ios simulator, could it be to do with the Firebase Local Emulator Suite setup?

It looks like the flaky fails, I didn't changed the Firebase related code. Please re-launch the failed jobs.
Result of splitting is re-launching the small piece of flaky failed jobs

@nbransby nbransby merged commit 1abbb9b into GitLiveApp:master Jul 12, 2024
50 checks passed
@siarhei-luskanau siarhei-luskanau deleted the github-actions-matrix branch July 12, 2024 08:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants