Skip to content

test: verifying test, lint, clirr, and graalvm in checks #456

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

Merged
merged 13 commits into from
Mar 29, 2022

Conversation

suztomo
Copy link
Member

@suztomo suztomo commented Mar 28, 2022

My attempt to run "test", "lint", and "clirr" in downstream tests. These checks ensure the maven-surefire-plugin, fmt-maven-plugin, and clirr-maven-plugin work as expected in the 2 client libraries (GAPIC and hand-written).

I don't intent to catch every failure cases in every downstream libraries, but I believe this setup will catch 90% of cases where plugin upgrades don't work in downstream repositories (and we would re-release the shared config again). Example: #452

CC: @Neenu1995

What if upgrading fmt-maven-plugin require adjusting Java code?

This PR changes the lint as a required check. This may introduce circular dependency.

For example, upgrading google-java-format to 1.15 requires code change in the downstream repository #452 (comment)
This require code change in the repository:

 /** Static utility methods for working with Errors returned from the service. */
 public class Errors {
-  private Errors() {};
+  private Errors() {}
+  ;

But we first would need to release the shared config before making the formatting change. How do we deal with it?

=> We can run mvn com.coveo:fmt-maven-plugin:format in the script to format the code before running com.coveo:fmt-maven-plugin:check:

Screen Shot 2022-03-28 at 4 11 07 PM

@suztomo suztomo requested a review from a team as a code owner March 28, 2022 19:05
@suztomo
Copy link
Member Author

suztomo commented Mar 28, 2022

This detected the #452 in the check. Good:

Screen Shot 2022-03-28 at 3 07 56 PM

@suztomo
Copy link
Member Author

suztomo commented Mar 28, 2022

We would need to update the required checks:

Screen Shot 2022-03-28 at 3 10 13 PM

suztomo added 5 commits March 28, 2022 15:13
The following simple Python script can generate the list

for j in [8, 11]:
  for r in ["java-trace", "java-bigquery"]:
    for t in ["test", "lint", "clirr"]:
      print('    - "build (%s, %s, %s)"' % (j, r, t))
@generated-files-bot
Copy link

Warning: This pull request is touching the following templated files:

  • .github/sync-repo-settings.yaml

@suztomo suztomo requested a review from Neenu1995 March 28, 2022 19:53
@suztomo
Copy link
Member Author

suztomo commented Mar 28, 2022

We would need to update the required checks:

In this PR, I keep the existing required "dependencies" checks as they are, but this PR adds new checks as required.

@suztomo
Copy link
Member Author

suztomo commented Mar 29, 2022

The GraalVM test failed because it didn't run with GraalVM:

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  16.201 s
[INFO] Finished at: 2022-03-29T16:45:43Z
[INFO] ------------------------------------------------------------------------
Error:  Failed to execute goal org.graalvm.buildtools:native-maven-plugin:0.9.11:test (test-native) on project google-cloud-orgpolicy: Execution test-native of goal org.graalvm.buildtools:native-maven-plugin:0.9.11:test failed: A required class was missing while executing org.graalvm.buildtools:native-maven-plugin:0.9.11:test: org/graalvm/nativeimage/hosted/Feature

Note: probably I do not go for this option. I could setup GraalVM
binary in GitHub Actions but this does not reflect what we would
have in downstream repositories.
@suztomo
Copy link
Member Author

suztomo commented Mar 29, 2022

This ayltai/setup-graalvm is handy:

Screen Shot 2022-03-29 at 12 55 05 PM

Note: probably I might not go for this option to install GraalVM. I could setup GraalVM binary in GitHub Actions like this, but this does not reflect what we would have in downstream repositories, which use testing-infra-docker.

How can we ensure the GraalVM version in testing-infra-docker and native-image-version from the shared config?

(Maybe manually synching the version still works)

@suztomo suztomo added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Mar 29, 2022
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Mar 29, 2022
@suztomo
Copy link
Member Author

suztomo commented Mar 29, 2022

- java-orgpolicy
steps:
- uses: actions/checkout@v2
- uses: stCarolas/setup-maven@v4
Copy link
Member Author

Choose a reason for hiding this comment

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

Remove this

- uses: stCarolas/setup-maven@v4
with:
maven-version: 3.8.1
- uses: ayltai/setup-graalvm@v1
Copy link
Member Author

Choose a reason for hiding this comment

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

@Neenu1995 @mpeddada1 Do we allow/ban this GitHub Actins?

Copy link
Contributor

Choose a reason for hiding this comment

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

As long as it doesn't access our secrets we are fine with using any action. But this one looks like it is not being actively developed anymore. So may not be a good long term solution.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks. I'll use this then.

I see the owner maintains the repository. https://github.com/ayltai/setup-graalvm/commits/master
When we need alternative we can just use curl and unzip the content.

Copy link
Contributor

Choose a reason for hiding this comment

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

My bad. I saw the last release was in May 2021. Looks like it is being being actively developed.

@suztomo
Copy link
Member Author

suztomo commented Mar 29, 2022

11 minutes to finish GraalVM test. Not too bad but I will revisit this long wait time by asking feedback among the devs here in few months.

@suztomo
Copy link
Member Author

suztomo commented Mar 29, 2022

168cc88 should fail at the GraalVM test. As per @mpeddada1 , native-maven-plugin 0.9.11 and GraalVM 21.2.0 are incompatible. Let's see whether this new test can detect the incompatibility.

@suztomo suztomo changed the title test: verifying test, lint, and clirr in checks test: verifying test, lint, clirr, and graalvm in checks Mar 29, 2022
@mpeddada1
Copy link
Contributor

Nice! It caught the incompatibility:

Failed to execute goal org.graalvm.buildtools:native-maven-plugin:0.9.11:test (test-native) on project google-cloud-orgpolicy: Execution of /opt/hostedtoolcache/GraalVM/java11-linux-amd64-21.2.0/x64/bin/native-image @/tmp/native-image1865512348312126488args org.graalvm.junit.platform.NativeImageJUnitLauncher returned non-zero result -> [Help 1]

@mpeddada1
Copy link
Contributor

@suztomo @Neenu1995 Is there any way we can keep this test consistent with the version in the testing-docker-infra?

@suztomo
Copy link
Member Author

suztomo commented Mar 29, 2022

@mpeddada1 I don't think it's possible. I leave a comment in YAML file: https://github.com/googleapis/java-shared-config/pull/456/files#r837768926

If it's possible, then the question is which version of the container testing-docker-infra should this repository reference? Latest release, main, or certain versions.

Comment on lines +57 to +62
# When a new version of native-maven-plugin fails to run in a downstream
# library, it's likely to be an incompatibility with the GraalVM version.
# In that case, you need to upgrade the Docker container used in the
# tests in the downstream repositories (not just this value below).
# Example: https://github.com/googleapis/testing-infra-docker/pull/195
graalvm-version: 22.0.0.2
Copy link
Member Author

Choose a reason for hiding this comment

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

Added an instruction on how to upgrade GraalVM version in testing-infra-docker.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you!

@suztomo suztomo added the automerge Merge the pull request once unit tests and other checks pass. label Mar 29, 2022
@mpeddada1
Copy link
Contributor

@mpeddada1 I don't think it's possible. I leave a comment in YAML file: https://github.com/googleapis/java-shared-config/pull/456/files#r837768926
If it's possible, then the question is which version of the container testing-docker-infra should this repository reference? Latest release, main, or certain versions.

The official page usually recommends being as specific as possible with the version tag. Yeah you're right, it might also be difficult to automate because there is a chance that the tag we specify won't be available on https://github.com/graalvm/container/pkgs/container/jdk. Manual upgrade sounds good for now! The comment will be helpful.

@suztomo suztomo removed the automerge Merge the pull request once unit tests and other checks pass. label Mar 29, 2022
@Neenu1995
Copy link
Contributor

If we want to use the exact same image in test-infra-docker, then we will have to move the tests to kokoro. But I don't think that is a direction we want to take.

@suztomo suztomo merged commit d5c45b8 into googleapis:main Mar 29, 2022
@suztomo suztomo deleted the lint_downstream branch March 29, 2022 19:09
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.

4 participants