ci: test samples and examples with a packaged bolt build#2372
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2372 +/- ##
=======================================
Coverage 92.59% 92.59%
=======================================
Files 36 36
Lines 7472 7472
Branches 653 653
=======================================
Hits 6919 6919
Misses 545 545
Partials 8 8 ☔ View full report in Codecov by Sentry. |
zimeg
left a comment
There was a problem hiding this comment.
📝 Leaving a few notes from findings during the most recent adventures. I'm so open to thoughts and changing the goal of this PR.
IMO testing samples with npm pack might be nice to split into a separate change, but I'm rambling now...
| - name: Package the latest changes to bolt-js | ||
| run: npm i && npm pack . && rm -rf node_modules | ||
| - name: Install example dependencies for testing | ||
| working-directory: ${{ matrix.example }} | ||
| run: npm i && npm link @slack/bolt | ||
| run: npm i && npm i ../../slack-bolt-*.tgz |
There was a problem hiding this comment.
Some TILs are included here, though I believe this can still be improved:
npm packwill package@slack/boltas if it's going to be releasednode_modulesof the bolt-js repo must be removed or nested directories can make use of these pacakges
The *.tgz file seems ideal for testing in a production environment like this since it lets us build bolt-js then remove its node_modules before testing a sample!
I'm not thrilled with the relative paths here, but am interested in if this is an approach we're alright taking?
There was a problem hiding this comment.
Using relative path here should be fine, if something changes and this path is broken, the test should fail and inform us that the path is broken
zimeg
left a comment
There was a problem hiding this comment.
📝 A few notes for the kind reviewer!
With the changes in #2421 landing, tests across these samples are passing. I plan to follow up with similar skipLibCheck updates across sample apps used in testing, but for now I think this contains a nice improvement to tests 🔬 ✨
| "resolveJsonModule": true, | ||
| "rootDir": "src", | ||
| "skipLibCheck": true, | ||
| "skipLibCheck": false, |
There was a problem hiding this comment.
Nice thanks 💯 it makes sense to set this as false, allows the CI to validate against the packages used by the project
| "resolveJsonModule": true, | ||
| "allowSyntheticDefaultImports": true, | ||
| "allowJs": true, | ||
| "skipLibCheck": false, |
There was a problem hiding this comment.
This overrides the default extend value: https://www.npmjs.com/package/@tsconfig/node18
WilliamBergamin
left a comment
There was a problem hiding this comment.
This is great 💯 using npm pack rather then npm link brings this test closer to the end user experience and should allow us to catch unexpected behaviors
thanks for working on this 🚀
Any thoughts on updating the maintainers_guide to recommend npm pack for local testing?
| "resolveJsonModule": true, | ||
| "rootDir": "src", | ||
| "skipLibCheck": true, | ||
| "skipLibCheck": false, |
There was a problem hiding this comment.
Nice thanks 💯 it makes sense to set this as false, allows the CI to validate against the packages used by the project
| - name: Package the latest changes to bolt-js | ||
| run: npm i && npm pack . && rm -rf node_modules | ||
| - name: Install example dependencies for testing | ||
| working-directory: ${{ matrix.example }} | ||
| run: npm i && npm link @slack/bolt | ||
| run: npm i && npm i ../../slack-bolt-*.tgz |
There was a problem hiding this comment.
Using relative path here should be fine, if something changes and this path is broken, the test should fail and inform us that the path is broken
|
@WilliamBergamin thanks a ton for the review and feedback! I'm hoping to merge this soon, but am sharing a few more thoughts:
I'm most excited for this. Finding this gap in our testing was difficult with a combination of the above
Super great call and added in d72132f! I was worried this would add some overhead to fast iteration but I remembered the The tests are all passing now, but before merging I want to make a few changes to the |
|
☝️ Changes to samples have been made, but are failing tests with the current With the other updates made here I think it's a good time to merge this. All for the sake of testing 🔬 ✨ |
WilliamBergamin
left a comment
There was a problem hiding this comment.
Nice thanks for making this happen 💯
I left 2 comments one is a NIT that can be ignored if you feel the style is off
|
|
||
| #### Local Development | ||
|
|
||
| Using in progress changes made to this package in another app is sometimes useful in experiments. A packaged build of Bolt for JavaScript can be created with `npm pack` and installed in a project with `npm install ../slack-bolt-*.tgz`. The packaged build includes dependencies published with Bolt for JavaScript, including required peer dependencies but not devDependencies, to imitate actual installations. |
There was a problem hiding this comment.
Nit: what do you think about making this in point/step format
| Using in progress changes made to this package in another app is sometimes useful in experiments. A packaged build of Bolt for JavaScript can be created with `npm pack` and installed in a project with `npm install ../slack-bolt-*.tgz`. The packaged build includes dependencies published with Bolt for JavaScript, including required peer dependencies but not devDependencies, to imitate actual installations. | |
| Using in progress changes made to this package in an app can be useful for development. | |
| Use the pack command to package the project | |
| ```zsh | |
| npm pack | |
| ``` | |
| Install the `slack-bolt-*.tgz` to use your changes | |
| ```zsh | |
| npm install path/to/bolt-js/slack-bolt-*.tgz | |
| ``` | |
| The packaged build includes dependencies published with Bolt for JavaScript, including required peer dependencies but not devDependencies, to imitate actual installations. |
|
|
||
| Using in progress changes made to this package in another app is sometimes useful in experiments. A packaged build of Bolt for JavaScript can be created with `npm pack` and installed in a project with `npm install ../slack-bolt-*.tgz`. The packaged build includes dependencies published with Bolt for JavaScript, including required peer dependencies but not devDependencies, to imitate actual installations. | ||
|
|
||
| Remove cached project dependencies with `rm -rf node_modules` between those steps to keep the cache clean. |
There was a problem hiding this comment.
Maybe we should mention removing the package-lock.json as well 🤔
And I don't think we need the force flag for this, but correct me if I'm wrong
| Remove cached project dependencies with `rm -rf node_modules` between those steps to keep the cache clean. | |
| Remove cached project dependencies with `rm -r node_modules package-lock.json ` between those steps to keep the cache clean. |
There was a problem hiding this comment.
I've been relying on the npm command to keep the package-lock.json most relevant, but for development it seems alright to regenerate this afresh! Good call 👏
I also tend to prefer rm -rf because it's "really fast" but sometimes permissions catch me 😉
|
@WilliamBergamin Ooh I'm way more a fan of spaced sections. I was hoping to match the surrounding sections with this change, but IMO revisiting this guide to use command sections would be most ideal 👁️🗨️ |
Summary
This PR explores broken builds due to missing
@types/expressfrom the most recent release 👀Preview
npm packwithout removingnode_modulesnpm packand removingnode_modulesNotes
@types/expressback intodependenciesseems like a fix to the above errors, but this was difficult to confirm with local setups. Hoping to improve our CI testing and return@types/expressin perhaps another PR to prevent this regression in future changes 😓Requirements