-
Notifications
You must be signed in to change notification settings - Fork 36
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
Separated out tests in a different GHA workflow #84
Conversation
Signed-off-by: Owais Kazi <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
See also this link for a potential fix for the flaky integ test.
.github/workflows/CI.yml
Outdated
run: | | ||
./gradlew check | ||
./gradlew check -x test -x integTest -x yamlRestTest | ||
- name: Upload Coverage Report | ||
if: matrix.os == 'ubuntu-latest' | ||
uses: codecov/codecov-action@v3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually... codecov may depend on the tests being run. Does this still work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It didn't run on this PR. That's something to think about. Do you think I should try moving codecov to tests.yml?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe. I'm still not clear on the motivation to split everything out from "check" which did it all anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also since each step in the tests.yml does its own checkout, I'm not sure if the coverage would be cumulative for all the steps.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yaay! Codecov worked!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The motivation behind is to run the tests and build in parallel and reduce the CI time overall when our plugin will become more heavy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
run the tests and build in parallel
Hmm.
Full gradle check gives a total time of 50.570s.
Gradle check without the tests takes 9.819s.
Running the tests separately gives 42.721s, because you're still running them sequentially.
You could get them to run in parallel by putting them up under the highest level jobs:
label.
Task | Duration |
---|---|
:integTest | 14.761s |
:test | 14.051s |
:yamlRestTest | 10.518s |
Note jacoco is only considering unit tests, so you could (for now) put jacoco in that job and run the other two jobs without jacoco.
jacocoTestReport {
dependsOn test
reports {
xml.required = true
}
}
There are ways to get jacoco to combine others: https://docs.gradle.org/7.4-rc-1/userguide/test_report_aggregation_plugin.html but I'm not sure that's needed.
Signed-off-by: Owais Kazi <[email protected]>
Signed-off-by: Owais Kazi <[email protected]>
Signed-off-by: Owais Kazi <[email protected]>
Signed-off-by: Owais Kazi <[email protected]>
Signed-off-by: Owais Kazi <[email protected]>
Codecov Report
@@ Coverage Diff @@
## main #84 +/- ##
============================================
+ Coverage 81.68% 81.85% +0.17%
- Complexity 285 287 +2
============================================
Files 30 30
Lines 1119 1119
Branches 125 125
============================================
+ Hits 914 916 +2
Misses 160 160
+ Partials 45 43 -2 |
.github/workflows/test.yml
Outdated
test: | ||
strategy: | ||
matrix: | ||
os: | ||
- ubuntu-latest | ||
- macOS-latest | ||
- windows-latest | ||
java: | ||
- 17 | ||
if: github.repository == 'opensearch-project/opensearch-ai-flow-framework' | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up JDK ${{ matrix.java }} | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: ${{ matrix.java }} | ||
distribution: temurin | ||
|
||
- name: Test | ||
run: ./gradlew test | ||
|
||
- name: YamlRestTest | ||
run: | ||
./gradlew yamlRestTest | ||
|
||
- name: integTest | ||
run: | ||
./gradlew integTest | ||
|
||
- name: Run Tests with Coverage | ||
run: | ||
./gradlew test jacocoTestReport --info | ||
|
||
- name: Upload Coverage Report | ||
if: matrix.os == 'ubuntu-latest' | ||
uses: codecov/codecov-action@v3 | ||
with: | ||
file: ./build/reports/jacoco/test/jacocoTestReport.xml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test: | |
strategy: | |
matrix: | |
os: | |
- ubuntu-latest | |
- macOS-latest | |
- windows-latest | |
java: | |
- 17 | |
if: github.repository == 'opensearch-project/opensearch-ai-flow-framework' | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK ${{ matrix.java }} | |
uses: actions/setup-java@v3 | |
with: | |
java-version: ${{ matrix.java }} | |
distribution: temurin | |
- name: Test | |
run: ./gradlew test | |
- name: YamlRestTest | |
run: | |
./gradlew yamlRestTest | |
- name: integTest | |
run: | |
./gradlew integTest | |
- name: Run Tests with Coverage | |
run: | |
./gradlew test jacocoTestReport --info | |
- name: Upload Coverage Report | |
if: matrix.os == 'ubuntu-latest' | |
uses: codecov/codecov-action@v3 | |
with: | |
file: ./build/reports/jacoco/test/jacocoTestReport.xml | |
test: | |
if: github.repository == 'opensearch-project/opensearch-ai-flow-framework' | |
strategy: | |
matrix: | |
test: | |
- test jacocoTestReport | |
- integTest | |
- yamlRestTest | |
os: | |
- ubuntu-latest | |
- macOS-latest | |
- windows-latest | |
java: | |
- 17 | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK ${{ matrix.java }} | |
uses: actions/setup-java@v3 | |
with: | |
java-version: ${{ matrix.java }} | |
distribution: temurin | |
- name: Test | |
run: ./gradlew ${{ matrix.test }} | |
- name: Upload Coverage Report | |
if: matrix.os == 'ubuntu-latest' && matrix.test == 'test jacocoTestReport' | |
uses: codecov/codecov-action@v3 | |
with: | |
file: ./build/reports/jacoco/test/jacocoTestReport.xml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could have raised the PR directly :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's probably not the right way to go, just pointing out how to achieve what you're trying to do :)
Signed-off-by: Owais Kazi <[email protected]>
.github/workflows/CI.yml
Outdated
uses: codecov/codecov-action@v3 | ||
with: | ||
file: ./build/reports/jacoco/test/jacocoTestReport.xml | ||
./gradlew check -x test -x integTest -x yamlRestTest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just wondering, why not use gradlew build here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can. I don't have any strong opinion here. We had check before I kept the same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am good with either, ./gradlew build
means we also run assemble which runs the :compileJava, :processResources
which check
does also but this does it into a jar.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed it to build.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should step back and figure out all the dependencies and figure out what we are trying to optimize here. With the current PR we're shifting the tests somewhere else (still in series so not really gaining much) but duplicating compile/build stuff in parallel.
My general preference would be for CI to keep all the check stuff and test
and code coverage bits, and just spin off the integ tests and yaml tests into another job in parallel (or just put them in the CI yaml at the top level under "jobs").
Lots of different ways to do it, haven't really been convinced we have a problem that needs solving yet :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with you. I will go ahead and close the PR. We can always come back and open it back when the plugin becomes heavy.
- macOS-latest | ||
- windows-latest | ||
java: | ||
- 17 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I remember in AD we had to test on 11, 17, 20. Should we do that here too? I think default for 2.x is jdk 11 still but could be wrong
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dbwiddis WDYT? Since you worked on the CI initially.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://opensearch.org/docs/latest/install-and-configure/install-opensearch/index/#java-compatibility this is what we have documented and i think java 20 is going to be for 3.x
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pushed the change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably match whatever OpenSearch tests.
test: | ||
- test jacocoTestReport | ||
- integTest | ||
- yamlRestTest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also just for understanding, what are yamlRestTests for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's for testing the rest-api-spec yaml files. We don't have right now for our plugin, but we would in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's an example test https://github.com/opensearch-project/OpenSearch/blob/1447d75e5e9ea042dd4bb645d71f25aea1fb42a8/modules/geo/src/yamlRestTest/resources/rest-api-spec/test/geo_shape/10_basic.yml ... it tests a search API with specific input and makes sure it gets the expected output.
Signed-off-by: Owais Kazi <[email protected]>
Closing this PR, as the plugin is quite lightweight now and doesn't take much time to process. This PR has some good discussion for the CI. We can always revisit this later later. |
Description
Separated out test, integTest and yamRestTest in a different GHA workflow
Issues Resolved
Part of #73
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.