-
Notifications
You must be signed in to change notification settings - Fork 59
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
Add GitHub Actions maven build and test for main branch #208
Conversation
There are four test failures in the GHA test, from these three test signatures:
Interestingly these all pass locally on my Linux machine with Java 21.
|
The error in EDDTableFromNCFilesTest#testOrderByMean2 is interesting. The file has the longitude as 350. On all other machines it gets convered here:
to be -10. Which is because the variable's attributes are degree_east. In order to not be converted, I'd expect the units to need to be in this list: public static final String DEFAULT_ANGULAR_DEGREE_TRUE_UNITS = "degreesT,degrees_T,degrees_Tangular_degree,degrees_true," + "degreeT,degree_T,degree_true"; It's possible the GitHub action is using a different version of the netcdf library that changes the units of that column, but that'd be quite surprising to me. |
The Fixed that here: I'm reviewing the rest of the failures in the context of your PR to try to understand the source of failure better, will keep this PR a draft until they're resolved and the commits are cleaned up. |
60d0d50
to
b9c48f3
Compare
@ChrisJohnNOAA At long last this should be ready to go. I updated the description with notes about additional changes needed to make the tests pass (most importantly moving test data from |
One other note: the total cache GitHub actions cache size for a repo is 10GB. The size of the cached data payload (everything in |
How is using test-data different that it will eliminate the flakiness? |
@@ -237,7 +237,6 @@ | |||
<url>https://github.com/ERDDAP/erddapContent/releases/download/${erddapcontent.download.version}/erddapContent.zip</url> | |||
<unpack>true</unpack> | |||
<outputDirectory>${project.basedir}</outputDirectory> | |||
<cacheDirectory>${project.basedir}/download_cache</cacheDirectory> |
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.
Won't removing the cache directory cause the files to need to be downloaded repeatedly?
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.
Nope, removing cacheDirectory
will cause the default of ~/.m2/repository/.cache/maven-download-plugin
to be used for the cache, and since that's inside of ~/.m2/repository
it will be included in the GitHub action maven cache.
https://github.com/actions/setup-java/blob/main/src/cache.ts#L26
I believe developers need to clear the /data/ directory because of the change to src/test/resources/ -> test-data. I had a lot of test failures initially trying to run tests on these changes. |
Ah yeah, good point. Do you think we need to handle deletion of the previous |
This is more of a speculation and I haven't tested, but it should make any test more stable where the expected output derives from the most recent file (largest mtime) in the dataset and there's variability in the tested fields through the dataset files. If there are cases where we previously were adding some variability to the expected test strings to accommodate this, we may have consistent results now. (Also please see my justification for the test data move in the edited PR description above if you haven't already 😁) |
Added a check for test data directories in
|
I was actually talking about the erddap/data/ directory that is used to cache data for the server (one of the things that's cached is file paths to where the data was- I've been wondering if it should more gracefully handle moves like this). Related to this. I think the paths that are generated by EDDTestDataset need to get updated with the move to test-data. I can look more into that tomorrow. |
Ah, gotcha. Seems like we'd want the
It looks like all of the places that generate |
* Adds GitHub Action in `.github/workflows/maven.yml` to build and test on pushes or pull_requests to `main` * Moves test data from `src/test/resources` to `test-data` and adds `test-data` as a `maven-surefire-plugin` `additionalClasspathElement` * Removes `download-maven-plugin` cacheDirectory overrides, moving cache directory to default `.m2/respository/.cache/maven-download-plugin` * Fixes `TopLevelHandlerTests` which alters the value of `EDStatic.angularDegreeUnitsSet`, affecting subsequent tests (test order is indeterminate) * Updates `development/docker/Dockerfile` (adds missing .mvn dir needed for `errorprone`, skips git-code-format hook installtion, and updates Java version to 21) The test data move from `src/test/resources` to `test-data` was needed because many of the test cases require a specific data file to be the last file (latest mtime) in the matching set. `maven-resources-plugin` does not preserve mtime when copying test resources into `target/test-classes`, which was leading to files in test datasets having exactly the same mtime (the time at which `maven-resources-plugin` copied the files), and an indeterminate file was being selected as "latest". By using the test data in place via `additionalClasspathElement`, we preserve the mtimes and also avoid copying huge amounts of data into `target/test-classes` (win win). Note: `gha-test` branch reference in `.github/workflows/maven.yml` can be deleted just before or after merge. It's just there to demonstrate working build/test.
Move the BPD for the test setup to under target so that it is cleared when running mvn clean.
I made a pull request against your branch to allow the integration tests (mvn verify) to work with the moved test data: srstsavage#5 |
Add test-data to the path for failsafe tests.
Thanks, merged that! Any thoughts on if we should be running |
I think we should have both running on pull requests (assuming GHA time is free as an open source project, which I believe it is). Just running mvn verify does also run the (mvn test) tests first, so we could likely do it with the one command. I think it's better to catch test breakages early rather than needing to hunt for what broke something (if only running once a week). As for the quick feedback of just the mvn test on a pull, we can have that separate if it's useful. I'd hope for most pull requests the quick (mvn test) tests have been run locally so there should be no surprises on the server. |
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.
Looks good. As we were discussing we could change the command to verify instead of test (or add an additional command for verify), but this will be a great step as is.
Description
.github/workflows/maven.yml
to build and test on pushes or pull_requests tomain
src/test/resources
totest-data
and addstest-data
as amaven-surefire-plugin
additionalClasspathElement
download-maven-plugin
cacheDirectory overrides, moving cache directory to default.m2/respository/.cache/maven-download-plugin
TopLevelHandlerTests
which alters the value ofEDStatic.angularDegreeUnitsSet
, affecting subsequent tests (test order is indeterminate)development/docker/Dockerfile
(adds missing .mvn dir needed forerrorprone
, skips git-code-format hook installtion, and updates Java version to 21)The test data move from
src/test/resources
totest-data
was needed because many of the test cases require a specific data file to be the last file (latest mtime) in the matching set.maven-resources-plugin
does not preserve mtime when copying test resources intotarget/test-classes
, which was leading to files in test datasets having exactly the same mtime (the time at whichmaven-resources-plugin
copied the files), and an indeterminate file was being selected as "latest". By using the test data in place viaadditionalClasspathElement
, we preserve the mtimes and also avoid copying huge amounts of data intotarget/test-classes
(win win).Note:
gha-test
branch reference in.github/workflows/maven.yml
can be deleted just before or after merge. It's just there to demonstrate working build/test.Adds a simple GitHub Actions maven build and test for the main branch and pull requests against the main branch.
Type of change
Checklist before requesting a review