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

Create ci.yml to build with GitHub Actions #1254

Merged
merged 3 commits into from
Aug 25, 2023

Conversation

mickaelistria
Copy link
Contributor

What it does

Adds GitHub action that validates branches and PRs.
Compared to Jenkinsfile, this workflow can easily be used to enable validation in forks, just by enabling GitHub actions on the forked repository. So it makes it almost free for contributors to get some CI validation, and thus to provide higher quality PRs more easily.

Author checklist

@mickaelistria
Copy link
Contributor Author

I don't think the test failure

2023-07-28T12:58:19.2029933Z org.eclipse.jdt.core.tests.model.InclusionPatternsTests.testNestedSourceFolder2 -- Time elapsed: 0.061 s <<< FAILURE!
2023-07-28T12:58:19.2030137Z junit.framework.ComparisonFailure:
2023-07-28T12:58:19.2030242Z Unexpected deltas.
2023-07-28T12:58:19.2030419Z ----------- Expected ------------
2023-07-28T12:58:19.2030573Z P[*]: {CHILDREN}\n
2023-07-28T12:58:19.2030664Z    src1/src2[*]: {CHILDREN}\n
2023-07-28T12:58:19.2030838Z            <default>[*]: {CHILDREN}\n
2023-07-28T12:58:19.2030920Z                    A.java[+]: {}
2023-07-28T12:58:19.2031083Z ------------ but was ------------
2023-07-28T12:58:19.2031164Z P[*]: {CHILDREN}\n
2023-07-28T12:58:19.2031314Z    src1[+]: {}
2023-07-28T12:58:19.2031473Z --------- Difference is ----------
2023-07-28T12:58:19.2031565Z  expected:<...: {CHILDREN}\n
2023-07-28T12:58:19.2031653Z    src1[/src2[*]: {CHILDREN}\n
2023-07-28T12:58:19.2031739Z            <default>[*]: {CHILDREN}\n
2023-07-28T12:58:19.2031984Z                    A.java][+]: {}> but was:<...: {CHILDREN}\n
2023-07-28T12:58:19.2032085Z    src1[][+]: {}>
2023-07-28T12:58:19.2032348Z    at org.eclipse.jdt.core.tests.junit.extension.TestCase.assertStringEquals(TestCase.java:266)
2023-07-28T12:58:19.2032594Z    at org.eclipse.jdt.core.tests.junit.extension.TestCase.assertEquals(TestCase.java:242)
2023-07-28T12:58:19.2032951Z    at org.eclipse.jdt.core.tests.model.AbstractJavaModelTests.assertDeltas(AbstractJavaModelTests.java:1416)
2023-07-28T12:58:19.2033318Z    at org.eclipse.jdt.core.tests.model.AbstractJavaModelTests.assertDeltas(AbstractJavaModelTests.java:1406)
2023-07-28T12:58:19.2033780Z    at org.eclipse.jdt.core.tests.model.InclusionPatternsTests.testNestedSourceFolder2(InclusionPatternsTests.java:659)

is related to this change. Is this test known as somewhat flaky?

@mickaelistria
Copy link
Contributor Author

So the test indeed seems flaky, as it was already reported in #420 (comment)

@mickaelistria
Copy link
Contributor Author

@rgrunber If this is merged, then I think we can close #1234 and keep only #1230 and my local build on GitHub actions should be enough to demo what works or not.

uses: actions/setup-java@v3
with:
java-version: |
8
Copy link
Member

Choose a reason for hiding this comment

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

Does it mean, ecj will run on Java 8? That is not possible.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, it just makes Java 8 will be available on the CI machine.

Copy link
Member

Choose a reason for hiding this comment

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

... and why do we need Java 8 on CI machine?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Tycho requires Java 8 to properly resolve Java 8 APIs. It can be turned off and the current Java runtime can be used instead (Java 17), but we've seen cases where some API disappear in newer versions and thus the code targetting Java 8 that cannot be compiled any longer by Java 17.
IIRC, Java 8 is also installed on Jenkins and configured in java toolchains.

Copy link
Member

Choose a reason for hiding this comment

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

the code targetting Java 8 that cannot be compiled any longer by Java 17.

We do not have code targeting Java 8 AFAIK, and annotations don't use any Java 8 specific API's, so why all this overhead adding something we don't need?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You need to ensure compatibility with Java 8 if you target Java 8 (in https://github.com/eclipse-jdt/eclipse.jdt.core/blob/master/org.eclipse.jdt.annotation_v1/META-INF/MANIFEST.MF#L8 ). Compatibility cannot be verified at build-time without a Java 8 installation being visible to Tycho.
The build config here is similar to Jenkins one. I wouldn't make it a requirement to chnage the build config to something too different from "main" build.
If you wish to get rid of the requirement of having Java 8 installed for build to succeed, please open another issue; it can be changed from pom.xml, but this would also affect the Jenkins build. It's another topic.

17
20
mvn-toolchain-id: |
JavaSE-1.8
Copy link
Member

Choose a reason for hiding this comment

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

Here also Java 8?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, this is a specific Tycho/OSGi label here: tycho wants a toolchain that has the BREE name as id to properly resolve it, and for Java 8, it's JavaSE-1.8. See eclipse-tycho/tycho#2670 .
Note that this particular workaround is necessary for the older org.eclipse.jdt.annotations bundle only.

.github/workflows/ci.yml Outdated Show resolved Hide resolved
.github/workflows/ci.yml Outdated Show resolved Hide resolved
@mickaelistria
Copy link
Contributor Author

@rgrunber Anything left that prevents from merging here?

Copy link
Contributor

@rgrunber rgrunber left a comment

Choose a reason for hiding this comment

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

If there's no other opposition, I'll merge this soon after the freeze ?

@mickaelistria , wait I assume branch freeze policy still applies so we're waiting until 4.30..

@akurtakov
Copy link
Contributor

Releng improvements (like this one) are in general not under freeze together with docs/examples/tests changes.

.github/workflows/ci.yml Outdated Show resolved Hide resolved
* --batch-mode
* remove extra space
* split commands as 2 lines.
@rgrunber rgrunber merged commit 816bc73 into eclipse-jdt:master Aug 25, 2023
6 of 7 checks passed
@rgrunber rgrunber added this to the 4.29 RC1 milestone Aug 25, 2023
@mickaelistria
Copy link
Contributor Author

Thank you! That will be pretty useful for people willing to experiment with JDT to have CI enabled out-of-the-box in their fork!

@stephan-herrmann
Copy link
Contributor

@mickaelistria Seems you're not done here, see https://www.eclipse.org/lists/jdt-dev/msg02287.html

@mickaelistria
Copy link
Contributor Author

Thanks for the heads-up and sorry for this inconvenience. I hope #1389 fixes it.

robstryker pushed a commit to robstryker/eclipse.jdt.core that referenced this pull request Jul 18, 2024
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.

5 participants