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

CI - Reuse organisation's workflows to lint, test, tag and publish #13

Merged
merged 4 commits into from
Nov 3, 2021

Conversation

MrChocolatine
Copy link
Member

@MrChocolatine MrChocolatine commented Nov 1, 2021

Build

Update ember-cli to version 3.28.3 (#13)

Update @embroider/test-setup to v0.47.1 (#13)

CI

Reuse organisation's workflow to run lint & tests (#13)

This change also activates the tests for Embroider, where a specific configuration had to be found in order to make these tests pass. See the commits stack.

Reuse organisation's workflow to run tag & publish (#13)

@MrChocolatine MrChocolatine changed the title ci reuse org workflows CI - Reuse organisation's workflows to lint, test, tag and publish Nov 1, 2021
@MrChocolatine MrChocolatine added internal Addon internal implem, no impact for users dependencies Pull requests that update a dependency file labels Nov 1, 2021
@MrChocolatine
Copy link
Member Author

MrChocolatine commented Nov 2, 2021

We currently have an error during the tests with Embroider:

https://github.com/peopledoc/ember-reading-time/actions/runs/1409500930

Related issue:

embroider-build/embroider#1004


Edit

Apparently we can't do much because of a setting for Webpack v4:

embroider-build/embroider#1004 (comment)


Edit

I found a fix, see the commits stack.

@MrChocolatine MrChocolatine force-pushed the ci-reuse-org-workflows branch 19 times, most recently from 6418ad3 to 04634c8 Compare November 3, 2021 09:01
@GreatWizard GreatWizard marked this pull request as ready for review November 3, 2021 10:28
@GreatWizard GreatWizard requested a review from a team as a code owner November 3, 2021 10:28
```
ember-cli-update --to 3.28
```
These changes aim to fix the following errors:
https://github.com/peopledoc/ember-reading-time/actions/runs/1409500930

_Extract of the error:_

```
  - broccoliBuilderErrorStack: ModuleNotFoundError: Module not found:
  Error: Can't resolve 'stream' in '/home/runner/work/ember-reading-time/ember-reading-time/node_modules/reading-time/lib/stream.js'
Did you mean './stream'?
Requests that should resolve in the current directory need to start with './'.
Requests that start with a name are treated as module requests and resolve
within module directories (node_modules).
If changing the source code is not an option there is also a resolve
options called 'preferRelative' which tries to resolve these kind of
requests in the current directory too.

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core
modules by default.
This is no longer the case. Verify if you need this module and configure
a polyfill for it.

If you want to include a polyfill, you need to:
	- add a fallback 'resolve.fallback: { "stream": require.resolve("stream-browserify") }'
	- install 'stream-browserify'
```

During the Embroider tests the Node.js module `stream` couldn't be found
because, in these tests, Webpack v5 is used, instead of the v4 used by
`ember-auto-import@v1` (see `yarn why webpack`).

This code was telling Webpack to include the polyfill for `stream`:
https://github.com/peopledoc/ember-reading-time/blob/v1.0.0/index.js#L7-L11

But this was only understood by Webpack v4:
- embroider-build/embroider#1004 (comment)
- https://v4.webpack.js.org/configuration/node/#other-node-core-libraries

In Webpack v5, Node.js polyfills are *NOT* automatically included:
- https://gist.github.com/ef4/d2cf5672a93cf241fd47c020b9b3066a
- https://github.com/ef4/ember-auto-import/blob/v2.2.3/docs/upgrade-guide-2.0.md#webpack-5-upgrade
- https://webpack.js.org/configuration/node/

  > As of webpack 5, You can configure only `global`, `__filename` or
  > `__dirname` under `node` option. If you're looking for how to
  > polyfill `fs` alike in Node.js under webpack 5, please check
  > `resolve.fallback` for help.
@MrChocolatine MrChocolatine merged commit ab8c425 into master Nov 3, 2021
@MrChocolatine MrChocolatine deleted the ci-reuse-org-workflows branch November 3, 2021 10:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file internal Addon internal implem, no impact for users
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants