OpenLiberty / liberty-tools-intellij

IntelliJ IDEA extension for Liberty
https://plugins.jetbrains.com/plugin/14856-open-liberty-tools
Eclipse Public License 2.0
13 stars 26 forks source link

Mac automated testing: use the correct version of IntelliJ #1132

Open turkeylurkey opened 6 days ago

turkeylurkey commented 6 days ago

There is a message from IntelliJ that we are testing the x86 version of IntelliJ on Mac.

image

We are experiencing performance issues during testing on the Mac. We should make sure we are installing the native version of the software (on Mac that is Apple Silicon) to ensure we are getting the best performance we can get.

vaisakhkannan commented 3 days ago

@turkeylurkey , I had a chat in the JetBrains Slack channel, and they explained the reason behind this issue/warning. They mentioned that this might occur if we use a JVM with the wrong architecture—for example, running Gradle with an x86 Java Runtime on an amd64 machine. I was able to reproduce the issue and then checked the Gradle version using the command ./gradlew --version.

Screenshot 2024-11-28 at 1 06 42 PM

I found that it is showing as x86_64.

vaisakhkannan commented 3 days ago

I visited the page https://adoptium.net/en-GB/marketplace/ and downloaded the Temurin JDK as specified in the configuration shown in the screenshot below.

Screenshot 2024-11-28 at 3 45 19 PM

I installed Java, specified the Java JDK in the Project Structure section of the LTI project, and then built the project, but it still shows as x86_64 after executing the above command.

What I did was try to download the JDK from the Project Structure section in IntelliJ using the specified configuration

Screenshot 2024-11-28 at 3 52 06 PM

Tried executing the command ./gradlew --version, then confirmed that it using aarch64

Screenshot 2024-11-28 at 3 59 53 PM

What I understood is that we need to ensure we download and install the aarch64 version of the JDK (for Mac M1, M2, M3 chips) and set this JDK for the LTI project. Then, we should try building the project. After doing this, I no longer received the warning.

@turkeylurkey , I assume you are using a Mac laptop with an M1, M2, or M3 chip. Could you try using the aarch64 version of the JDK and check if the warning persists?

vaisakhkannan commented 3 days ago

I am thinking that we need to check whether our GHA IntelliJ is aarch64 or x86_64. Based on the OS, we are using macOS-latest.

Based on macOS-latest, I see it is mentioned as macOS 14 Arm64, so I was thinking the machine is aarch64 https://github.com/actions/runner-images .

Screenshot 2024-11-28 at 6 15 38 PM

So I tried to update the SEMERU_ARCHIVE_MAC_SHA256 that is aarch64 java sha256 value.

https://developer.ibm.com/languages/java/semeru-runtimes/downloads/

After this, I can see the build is failing when I pushed the changes in GHA.

https://github.com/vaisakhkannan/liberty-tools-intellij/actions/runs/12068802978

But when I specify x64 JAVA sha256 value the build starts running

https://github.com/vaisakhkannan/liberty-tools-intellij/actions/runs/12068890775

If GHA Mac IntelliJ is running on x86_64, there might be a possibility of slowness in the machine, as indicated by the warning. I wonder if that could be the reason for the slowness in Mac.

@turkeylurkey , Do you think we need to confirm whether the IntelliJ IDE is AArch64 or x86_64 using the Remote Robot UI?

turkeylurkey commented 3 days ago

I already use the aarch64 version of IntelliJ on my Mac. The error message was captured from a github actions machine. If we can be sure we are downloading and using the aarch64 version of IntelliJ I don't think we need to add a test case to check it every time.

It looks like if you fix the url for downloading the jdk then the gradle build that pulls IntelliJ will pull the aarch64 version. This would be good to validate somehow.

turkeylurkey commented 3 days ago

Maybe when the IDE under test starts and we use curl to detect it started maybe the text it sends indicates what architecture it is using. Or maybe there is a command line way to display the details of IntelliJ.

vaisakhkannan commented 2 days ago

Hi @turkeylurkey , I fixed the URL for downloading the aarch64 JDK, and the Gradle build now pulls the aarch64 version of IntelliJ. I confirmed this by writing a new test to check whether the warning appears. Additionally, I verified the IDE version by checking the "About" section in IntelliJ. Based on these steps, I can confirm that updating to the aarch64 JDK resolved the issue.

video of warning present in x64 jdk

https://github.com/user-attachments/assets/b52a5d67-b4e4-496b-a3a4-bc15d299a6d3

video of warning not present in aarch64 jdk

https://github.com/user-attachments/assets/d266c9ec-b619-4116-9857-43419efe5a48

Paul, what do you think? Should I open a PR for this against the main branch or the 2024.2 support feature branch?

turkeylurkey commented 2 days ago

Thank you for showing the before and after. Unfortunately the github cloud contains some Macs that run the x86 processors. You can use the uname -m command to detect the current architecture. Could you add a test to keep the old behaviour when x86 is detected and the new one when arm64 is detected? You would also have to parameterize that test so that it could detect the architecture and test for the correct JVM.

Finally, it is too early to make a pull request because I don't think this is needed for 24.0.12. I think the work to put out that release will be increasing soon.

vaisakhkannan commented 2 days ago

Yes, that's correct @turkeylurkey . We can now wait for the release of 20.0.12. I am ready to raise the PR for the UI changes that support 2024.3. Once your STE fix is merged, then need to rebase the feature branch with the main branch and I can raise the PR immediately. Hopefully, I can raise the PR this on Monday, since you are about to merge your PR.