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

[RNMobile] Address failing mobile tests #24020

Merged
merged 11 commits into from
Apr 21, 2022

Conversation

SiobhyB
Copy link

@SiobhyB SiobhyB commented Apr 20, 2022

Fixes a recent breakage in the native build, which can be viewed here: https://app.circleci.com/pipelines/github/wordpress-mobile/gutenberg-mobile/17096/workflows/37583660-a955-4550-ac07-9fdab16dd5b8/jobs/93001

The error logs associated with this breakage can be viewed here, and is related to files that were moved in #23817. (click for more ⤵︎)
error jetpack/projects/plugins/jetpack/extensions/shared/icons.scss: @**********/jetpack-base-styles/gutenberg-base-styles could not be resolved in /home/circleci/project/jetpack/projects/plugins/jetpack/extensions/shared/@**********/jetpack-base-styles,/home/circleci/project,jetpack/projects/plugins/jetpack/extensions/shared,/home/circleci/project/gutenberg/packages/react-native-editor/src,/home/circleci/project/gutenberg/packages/base-styles
  ╷
9 │ @import '@**********/jetpack-base-styles/gutenberg-base-styles';
  │         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  ╵
  stdin 9:9  root stylesheet.
Error: @**********/jetpack-base-styles/gutenberg-base-styles could not be resolved in /home/circleci/project/jetpack/projects/plugins/jetpack/extensions/shared/@**********/jetpack-base-styles,/home/circleci/project,jetpack/projects/plugins/jetpack/extensions/shared,/home/circleci/project/gutenberg/packages/react-native-editor/src,/home/circleci/project/gutenberg/packages/base-styles
  ╷
9 │ @import '@**********/jetpack-base-styles/gutenberg-base-styles';
  │         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  ╵
  stdin 9:9  root stylesheet

Related PRs

Changes proposed in this Pull Request:

  • I believe Gutenberg's base styles are already imported to the native build via this function in the sass-transformer.js file and that attempting to re-import them via the Jetpack package is causing the error.
  • The @automattic/jetpack-base-styles/gutenberg-base-styles import referenced in the Contact Info block's style.native.scss file has been removed.
  • A native-specific version of the icons file has been created, for the purpose of removing the @automattic/jetpack-base-styles/gutenberg-base-styles import.
  • In the Contact Info block's style.native.scss file, I tested changing the values of the colours with other values from core's _colors.native.scss file. I confirmed they loaded as expected, Gutenberg's base files seem to be loaded on the native side without the Jetpack import/package.

Further Investigations

Below, I've detailed other approaches I've experimented with, leading to my decision to ultimately remove references to the imports. (click for more ⤵︎)
  • The same error can be reproduced by attempting to use @automattic/jetpack-base-styles/gutenberg-base-styles in the style.native.scss files for any of the core Gutenberg blocks. So, this isn't specific to how the package is being loaded in Jetpack.
  • I experimented with installing the @automattic/jetpack-base-styles package, via the instructions here, in the Gutenberg Mobile directory. The same error persisted.
  • Replacing gutenberg-base-styles with any of the other options offered by the package (e.g. @automattic/jetpack-base-style/styles brought more success, with the tests either passing or producing more specific errors related to syntax.
  • I was also able to get the tests to pass by replacing the import directly with the files contents:
@import '@wordpress/base-styles/z-index';
@import '@wordpress/base-styles/colors';
@import '@wordpress/base-styles/variables';
@import '@wordpress/base-styles/breakpoints';
@import '@wordpress/base-styles/mixins';
@import '@wordpress/base-styles/animations';

I think, ideally, we'd get the @automattic/jetpack-base-styles/gutenberg-base-styles working with the native build rather than just removing it, to future-proof against further breakages. I haven't been able to figure out a way to do this, however. I'd be grateful for any other thoughts or input.

Jetpack product discussion

N/A

Does this pull request change what data or activity we track or use?

No, it doesn't.

Testing instructions:

Verify tests pass
  • With this PR's Jetpack and Gutenberg Mobile branches checked out, run npm run bundle from the Gutenberg Mobile directory and verify the command completes with no error.
  • The tests can also be verified by confirming all of the automated tests succeed on the Gutenberg Mobile PR.
Check for regressions
  • With this PR's branches checked out, load the mobile editor and verify that the Contact Info and Embed blocks are still styled as expected. The removal of the imports should not impact these blocks.

@github-actions
Copy link
Contributor

github-actions bot commented Apr 20, 2022

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ⚠️ All commits were linted before commit.
  • ✅ Add a "[Status]" label (In Progress, Needs Team Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


The e2e test report can be found here. Please note that it can take a few minutes after the e2e tests checks are complete for the report to be available.


Once your PR is ready for review, check one last time that all required checks (other than "Required review") appearing at the bottom of this PR are passing or skipped.
Then, add the "[Status] Needs Team review" label and ask someone from your team review the code.
Once you’ve done so, switch to the "[Status] Needs Review" label; someone from Jetpack Crew will then review this PR and merge it to be included in the next Jetpack release.


Jetpack plugin:

  • Next scheduled release: May 3, 2022.
  • Scheduled code freeze: April 25, 2022.

@github-actions github-actions bot added the [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! label Apr 20, 2022
@github-actions github-actions bot added [Block] Contact Info [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ labels Apr 20, 2022
@matticbot
Copy link
Contributor

Caution: This PR has changes that must be merged to WordPress.com
Hello SiobhyB! These changes need to be synced to WordPress.com - If you 're an a11n, please commandeer and confirm D79174-code works as expected before merging this PR. Once this PR is merged, please commit the changes to WP.com. Thank you!
This revision will be updated with each commit to this PR

@SiobhyB SiobhyB changed the title [RNMobile] Fix failing rnmobile build [RNMobile] Fix failing mobile tests Apr 20, 2022
@SiobhyB SiobhyB changed the title [RNMobile] Fix failing mobile tests [RNMobile] Address failing mobile tests Apr 20, 2022
@SiobhyB SiobhyB added [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. and removed [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! labels Apr 21, 2022
@SiobhyB SiobhyB requested review from fluiddot, geriux and kraftbj April 21, 2022 06:03
@SiobhyB SiobhyB marked this pull request as ready for review April 21, 2022 06:03
@kraftbj kraftbj merged commit 0911928 into master Apr 21, 2022
@kraftbj kraftbj deleted the rnmobile/update-path-to-base-styles branch April 21, 2022 21:54
@github-actions github-actions bot removed the [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. label Apr 21, 2022
@github-actions github-actions bot added this to the jetpack/10.9 milestone Apr 21, 2022
@github-actions
Copy link
Contributor

Great news! One last step: head over to your WordPress.com diff, D79174-code, and deploy it.
Once you've done so, come back to this PR and add a comment with your changeset ID.

Thank you!

@kraftbj
Copy link
Contributor

kraftbj commented Apr 21, 2022

r244179-wpcom

@fluiddot
Copy link
Contributor

fluiddot commented Apr 22, 2022

Thanks @SiobhyB for addressing this issue 🙇 .

I believe Gutenberg's base styles are already imported to the native build via this function in the sass-transformer.js file and that attempting to re-import them via the Jetpack package is causing the error.

@SiobhyB Good catch! Yep, as you pointed out, it looks like it wouldn't be necessary to import the base styles as we're already doing it in the sass-transformer file 👍 .

I think, ideally, we'd get the @automattic/jetpack-base-styles/gutenberg-base-styles working with the native build rather than just removing it, to future-proof against further breakages. I haven't been able to figure out a way to do this, however. I'd be grateful for any other thoughts or input.

Agreed, I think this fix will work for the short term, but I advocate trying to fix the root cause because we might require importing statements like that in the future. Being this said, I'd proceed with this fix and probably open an issue as a follow-up with this information.

I haven't investigated further the issue, but looks like it's related to importing styles via @import referencing a module (e.g. @import '@automattic/jetpack-base-styles/gutenberg-base-styles'; vs @import '../../shared/styles/gutenberg-base-styles.scss';). I'm wondering if we actually support this type of import in React Native, maybe that's the root cause, as I don't see this type of import in Gutenberg code 🤔 .

@SiobhyB
Copy link
Author

SiobhyB commented Apr 22, 2022

Agreed, I think this fix will work for the short term, but I advocate trying to fix the root cause because we might require importing statements like that in the future. Being this said, I'd proceed with this fix and probably open an issue as a follow-up with this information.

Thanks @fluiddot! I've gone ahead to create a separate issue for investigating the root cause of this error at wordpress-mobile/gutenberg-mobile#4786.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Contact Info [Package] Blocks [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ Touches WP.com Files
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants