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

Lock React version to ~18.2.0 #1148

Merged
merged 10 commits into from
Apr 28, 2024
Merged

Conversation

JGreenlee
Copy link
Collaborator

React 19 and React 18.3 are out (https://react.dev/blog/2024/04/25/react-19-upgrade-guide#react-18-3), but the React Native ecosystem is still on React 18.2. We need to lock the versions down until the React Native packages update.

React 19 and React 18.3 are out (https://react.dev/blog/2024/04/25/react-19-upgrade-guide#react-18-3), but the React Native ecosystem is still on React 18.2.
We need to lock the versions down until the React Native packages update.
Copy link

codecov bot commented Apr 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 27.32%. Comparing base (22cbf2f) to head (d188a78).
Report is 28 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1148   +/-   ##
=======================================
  Coverage   27.32%   27.32%           
=======================================
  Files         113      113           
  Lines        4816     4816           
  Branches     1037     1037           
=======================================
  Hits         1316     1316           
- Misses       3498     3500    +2     
+ Partials        2        0    -2     
Flag Coverage Δ
unit 27.32% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

see 12 files with indirect coverage changes

@JGreenlee
Copy link
Collaborator Author

I fixed the error from #1143 (comment), but the build workflows are still failing. May be a separate issue

@JGreenlee
Copy link
Collaborator Author

@shankari Any ideas? I fixed the React dependency issue, but CI still failed on both osx-build-android and osx-build-ios.

I was able to build Android locally

@shankari
Copy link
Contributor

The iOS failure is because the default iOS has been upgraded to 15, so unrelated to this

clang: error: SDK does not contain 'libarclite' at the path '/Applications/Xcode_15.0.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc/libarclite_iphonesimulator.a'; try increasing the minimum deployment target

@shankari
Copy link
Contributor

The android error is

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
* What went wrong:

Could not open settings generic class cache for settings file '/Users/runner/work/e-mission-phone/e-mission-phone/platforms/android/settings.gradle' (/Users/runner/.gradle/caches/7.6/scripts/dqjrgsw17c62wbpoagod92e1e).
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
> BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 65

according to https://stackoverflow.com/questions/68597899/bug-exception-in-phase-semantic-analysis-in-source-unit-buildscript-unsup, this is due to an incompatible java version

@shankari
Copy link
Contributor

I think all these failures are because the github runners were recently upgraded and we hadn't locked down all the versions, or the way that we locked down the versions failed.

For android, we do attempt to lock down the version

  echo "Default java version"
  java -version
  echo "Setting to Java 11 instead"
  export JAVA_HOME=$JAVA_HOME_11_X64
  java -version
  echo "Checking gradle"
  which gradle
  gradle -version

but apparently it didn't work

Default java version
openjdk version "21.0.3" 2024-04-16 LTS
OpenJDK Runtime Environment Temurin-21.0.3+9 (build 21.0.3+9-LTS)
OpenJDK 64-Bit Server VM Temurin-21.0.3+9 (build 21.0.3+9-LTS, mixed mode)
Setting to Java 11 instead
openjdk version "21.0.3" 2024-04-16 LTS
OpenJDK Runtime Environment Temurin-21.0.3+9 (build 21.0.3+9-LTS)
OpenJDK 64-Bit Server VM Temurin-21.0.3+9 (build 21.0.3+9-LTS, mixed mode)
Checking gradle
/opt/homebrew/bin/gradle

I wonder if the GitHub runners have removed Java 11

@shankari
Copy link
Contributor

iOS is now using the correct version but is broken

ld: file not found: /Applications/Xcode_14.3.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc/libarclite_iphonesimulator.a

This is the same issue
https://stackoverflow.com/a/75729977

Falling back even further to 14.1, which i know works.

For the android issue, maybe I need to change the PATH as well and not just the JAVA_HOME
Let's try that too, and add some more printout statements.

Before this, we set only the `JAVA_HOME` to pin the java version
This was working until a couple of days ago, when, even after setting the
version, the java version was not changed.

This may be due to the location for the java executable changing, so let's try
to set the PATH as well

Also print out several environment variables to help debug further

Related info:
e-mission#1148 (comment)
e-mission#1148 (comment)
@shankari
Copy link
Contributor

Failure on android seems to be because this is now an ARM machine. So instead of using $JAVA_HOME_11_X64, we need to use JAVA_HOME_11_arm64

JAVA_HOME=/Users/runner/hostedtoolcache/Java_Temurin-Hotspot_jdk/21.0.3-9.0/arm64/Contents/Home/
JAVA_HOME_17_arm64=/Users/runner/hostedtoolcache/Java_Temurin-Hotspot_jdk/17.0.11-9/arm64/Contents/Home/
JAVA_HOME_11_arm64=/Users/runner/hostedtoolcache/Java_Temurin-Hotspot_jdk/11.0.23-9/arm64/Contents/Home/

The error in iOS seems to be because

  sudo xcode-select -s /Applications/Xcode_14.1.app
  echo "Version should now be 14.1, re-checking "
  xcode-select --print-path
  shell: /bin/bash -e {0}
xcode-select: error: invalid developer directory '/Applications/Xcode_14.1.app'

But it should be around:
https://github.com/actions/runner-images/blob/main/images/macos/macos-13-Readme.md#xcode

Let's check the version of the image that we are using...

@shankari
Copy link
Contributor

Ah, we currently specify

  build:
    # The type of runner that the job will run on
    runs-on: macos-latest

But macos-latest is now macos-14, which does indeed have

  1. JAVA_HOME_11_arm64: https://github.com/actions/runner-images/blob/main/images/macos/macos-14-arm64-Readme.md#java
  2. xcode 14.3.1: https://github.com/actions/runner-images/blob/main/images/macos/macos-14-arm64-Readme.md#xcode

So let's just use xcode 13 for now, at least in this PR for iOS and then fix it while fixing e-mission/e-mission-docs#1060

For android, let's try to keep the most latest mac, but switch the environment variable

@shankari
Copy link
Contributor

This does fall back to android 11, but we still get a failure

Default java version
openjdk version "21.0.3" 2024-04-16 LTS
OpenJDK Runtime Environment Temurin-21.0.3+9 (build 21.0.3+9-LTS)
OpenJDK 64-Bit Server VM Temurin-21.0.3+9 (build 21.0.3+9-LTS, mixed mode)
Java full path
/usr/bin/java
Setting to Java 11 instead
/usr/bin/java
openjdk version "11.0.23" 2024-04-16
OpenJDK Runtime Environment Temurin-11.0.23+9 (build 11.0.23+9)
OpenJDK 64-Bit Server VM Temurin-11.0.23+9 (build 11.0.23+9, mixed mode)
Checking gradle
/opt/homebrew/bin/gradle

------------------------------------------------------------
Gradle 8.7
------------------------------------------------------------


Checking Java JDK and Android SDK versions
ANDROID_HOME=/Users/runner/Library/Android/sdk (recommended setting)
ANDROID_SDK_ROOT=/Users/runner/Library/Android/sdk (DEPRECATED)
Using Android SDK: /Users/runner/Library/Android/sdk
Starting a Gradle Daemon (subsequent builds will be faster)

FAILURE: Build failed with an exception.

* What went wrong:
Could not open settings generic class cache for settings file '/Users/runner/work/e-mission-phone/e-mission-phone/platforms/android/settings.gradle' (/Users/runner/.gradle/caches/7.6/scripts/dqjrgsw17c62wbpoagod92e1e).
> BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 65

Let's downgrade this to xcode 13 as well and confirm that it is fixed

@shankari
Copy link
Contributor

So this was all about the mac version.

0d0b212
flipped the checks from failing to passing although the java version was incorrect

  echo "Default java version"
  java -version
  echo "Java full path"
  which java
  echo "Setting to Java 11 instead"
  export JAVA_HOME=$JAVA_HOME_11_arm64
  which java
  java -version
  echo "Checking gradle"
  which gradle
  gradle -version

Default java version
openjdk version "17.0.11" 2024-04-16
OpenJDK Runtime Environment Temurin-17.0.11+9 (build 17.0.11+9)
OpenJDK 64-Bit Server VM Temurin-17.0.11+9 (build 17.0.11+9, mixed mode)
Java full path
/usr/bin/java
Setting to Java 11 instead
/usr/bin/java
openjdk version "21.0.3" 2024-04-16 LTS
OpenJDK Runtime Environment Temurin-21.0.3+9 (build 21.0.3+9-LTS)
OpenJDK 64-Bit Server VM Temurin-21.0.3+9 (build 21.0.3+9-LTS, mixed mode)
Checking gradle
/usr/local/bin/gradle

Note that we still get the gradle warning but no error, and then we actually fix the gradle warning.
This may also be due to the fact that I removed the PATH modification, but for now, let's just pin to OSX 13 to get everything to work properly and then make the changes in a principled fashion

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.6/userguide/command_line_interface.html#sec:command_line_warnings

BUILD SUCCESSFUL in 5s
1 actionable task: 1 executed
Subproject Path: CordovaLib
Subproject Path: app
Downloading https://services.gradle.org/distributions/gradle-7.6-all.zip
...............10%................20%................30%................40%...............50%................60%................70%................80%...............90%................100%

Because apparently the default version, even on the OSX 13 runner, is now xcode 15
e-mission#1148 (comment)
@shankari
Copy link
Contributor

using macos 13 is not enough since the default xcode has changed. We do still need to pin xcode

Run xcode-select --print-path
/Applications/Xcode_15.0.1.app/Contents/Developer

@shankari
Copy link
Contributor

Now, everything passed except for the code coverage. I know it has worked in the past, so will try to rerun in a bit

@shankari
Copy link
Contributor

Yay! Everything is finally passing with minimal changes.
Squash merging to avoid commit churn....

@jiji14
Copy link
Contributor

jiji14 commented Apr 30, 2024

@JGreenlee @shankari Thanks for taking care of the issue

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.

3 participants