-
Notifications
You must be signed in to change notification settings - Fork 97
chore: document knapsack to knapsack_pro #126
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
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
# Migration steps: from Knapsack to Knapsack Pro | ||
|
||
Follow these steps to migrate from `knapsack` to `knapsack_pro` in 10 minutes. | ||
|
||
Commands are provided to help you with each step. | ||
|
||
> [!TIP] | ||
> On Linux, you need to remove the `''` part from the `sed` commands. Also, you can ignore the `sed: no input files` warning that is printed when there's no substitution to perform. | ||
|
||
## Steps | ||
|
||
- [ ] Remove the `knapsack` gem: | ||
```bash | ||
bundle remove knapsack | ||
``` | ||
|
||
- [ ] Remove `Knapsack.load_tasks` from the `Rakefile` if present: | ||
```bash | ||
sed -i '' '/Knapsack\.load_tasks/d' Rakefile | ||
``` | ||
|
||
- [ ] Replace `require "knapsack"` with `require "knapsack_pro"`: | ||
```bash | ||
grep --files-with-matches --recursive "require.*knapsack" . | xargs sed -i '' "s/'knapsack'/'knapsack_pro'/g" | ||
grep --files-with-matches --recursive "require.*knapsack" . | xargs sed -i '' 's/"knapsack"/"knapsack_pro"/g' | ||
``` | ||
|
||
- [ ] Remove the following code from the test runner configuration: | ||
```diff | ||
- Knapsack.tracker.config({ | ||
- enable_time_offset_warning: true, | ||
- time_offset_in_seconds: 30 | ||
- }) | ||
|
||
- Knapsack.report.config({ | ||
- test_file_pattern: 'spec/**{,/*/**}/*_spec.rb', # ⬅️ Take note of this one for later | ||
- report_path: 'knapsack_custom_report.json' | ||
- }) | ||
``` | ||
|
||
- [ ] Replace `Knapsack` with `KnapsackPro`: | ||
```bash | ||
grep --files-with-matches --recursive "Knapsack\." . | xargs sed -i '' 's/Knapsack\./KnapsackPro./g' | ||
grep --files-with-matches --recursive "Knapsack::" . | xargs sed -i '' 's/Knapsack::/KnapsackPro::/g' | ||
``` | ||
|
||
- [ ] Rename `KnapsackPro::Adapters::RspecAdapter` to `KnapsackPro::Adapters::RSpecAdapter`: | ||
```bash | ||
grep --files-with-matches --recursive "KnapsackPro::Adapters::RspecAdapter" . | xargs sed -i '' 's/RspecAdapter/RSpecAdapter/g' | ||
``` | ||
|
||
- [ ] Remove any line that mentions `KNAPSACK_GENERATE_REPORT` or `KNAPSACK_REPORT_PATH`: | ||
```bash | ||
grep --files-with-matches --recursive "KNAPSACK_GENERATE_REPORT" . | xargs sed -i '' '/KNAPSACK_GENERATE_REPORT/d' | ||
grep --files-with-matches --recursive "KNAPSACK_REPORT_PATH" . | xargs sed -i '' '/KNAPSACK_REPORT_PATH/d' | ||
``` | ||
|
||
- [ ] Rename ENVs from `KNAPSACK_X` to `KNAPSACK_PRO_X`: | ||
```bash | ||
grep --files-with-matches --recursive "KNAPSACK_" . | xargs sed -i '' 's/KNAPSACK_/KNAPSACK_PRO_/g' | ||
``` | ||
|
||
- [ ] Remove all the reports: | ||
```bash | ||
rm knapsack_*_report.json | ||
``` | ||
|
||
- [ ] [Configure Knapsack Pro](https://docs.knapsackpro.com/knapsack_pro-ruby/guide/) | ||
|
||
- [ ] Ensure all the CI commands are updated: | ||
```bash | ||
grep --files-with-matches --recursive "knapsack:spinach" . | xargs sed -i '' 's/knapsack:spinach/knapsack_pro:spinach/g' | ||
grep --files-with-matches --recursive "knapsack:" . | xargs sed -i '' 's/knapsack:/knapsack_pro:queue:/g' | ||
grep --files-with-matches --recursive "CI_NODE_TOTAL" . | xargs sed -i '' 's/CI_NODE_TOTAL/KNAPSACK_PRO_CI_NODE_TOTAL/g' | ||
grep --files-with-matches --recursive "CI_NODE_INDEX" . | xargs sed -i '' 's/CI_NODE_INDEX/KNAPSACK_PRO_CI_NODE_INDEX/g' | ||
``` | ||
|
||
- [ ] If you removed `test_file_pattern` when deleting `Knapsack.report.config`, use [`KNAPSACK_PRO_TEST_FILE_PATTERN`](https://docs.knapsackpro.com/ruby/reference/#knapsack_pro_test_file_pattern) instead |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,44 @@ | ||
# knapsack gem | ||
# Knapsack | ||
|
||
Knapsack splits tests evenly across parallel CI nodes to run fast CI build and save you time. | ||
<p align="center"> | ||
<a href="https://knapsackpro.com?utm_source=github&utm_medium=readme&utm_campaign=knapsack_gem&utm_content=hero_logo"> | ||
<img alt="Knapsack" src="./.github/assets/knapsack-diamonds.png" width="300" height="300" style="max-width: 100%;" /> | ||
</a> | ||
</p> | ||
|
||
| | knapsack gem | knapsack_pro gem | | ||
| -------------------------------------------- | ------------ | ---------------- | | ||
| __Is free__ | ✓ Yes | ✓ Yes, [free plan](https://knapsackpro.com?utm_source=github&utm_medium=readme&utm_campaign=knapsack_gem&utm_content=free_plan) | | ||
| __Regular Mode - a static tests split__ | ✓ Yes | ✓ Yes | | ||
| __Queue Mode - a dynamic tests split__ <br>([ensures all CI nodes finish work at the same time](https://docs.knapsackpro.com/2020/how-to-speed-up-ruby-and-javascript-tests-with-ci-parallelisation)) | No | ✓ Yes | | ||
| __Auto [split slow RSpec test file](https://knapsackpro.com/faq/question/how-to-split-slow-rspec-test-files-by-test-examples-by-individual-it) between parallel CI nodes__ <br>(a single test file can be auto split by test examples between parallel jobs) | No | ✓ Yes | | ||
| Tracking tests timing per commit, branch | No | ✓ Yes | | ||
| Support for other programming languages | No | ✓ Yes | | ||
| Support for CI providers | limited | ✓ Yes | | ||
| __Installation README__ | [Install README](http://docs.knapsackpro.com/ruby/knapsack) | [Install README](https://docs.knapsackpro.com) | | ||
<h3 align="center">Speed up your tests</h3> | ||
<p align="center">Run your 1-hour test suite in 2 minutes with optimal parallelisation on your existing CI infrastructure</p> | ||
|
||
[Features of knapsack vs knapsack_pro Ruby gem](https://knapsackpro.com/features/ruby_knapsack_pro_vs_knapsack?utm_source=github&utm_medium=readme&utm_campaign=knapsack_gem&utm_content=ruby_knapsack_pro_vs_knapsack) | ||
--- | ||
|
||
# Do you use Heroku? | ||
<div align="center"> | ||
<a href="https://rubygems.org/gems/knapsack"> | ||
<img alt="Gem Version" src="https://badge.fury.io/rb/knapsack.svg" /> | ||
</a> | ||
</div> | ||
|
||
Do you know Knapsack Pro Ruby gem is available as Heroku add-on? It works with your current CI server. | ||
https://elements.heroku.com/addons/knapsack-pro | ||
<br /> | ||
<br /> | ||
|
||
Knapsack Pro has Queue Mode that will split Ruby & JS tests in a dynamic way across parallel CI nodes to ensure each parallel job takes a similar time. Thanks to that there is no bottleneck in your CI pipelines. | ||
Knapsack wraps your current test runner and works with your existing CI infrastructure to split tests optimally. | ||
|
||
__See introduction how the Knapsack Pro add-on works__ | ||
https://youtu.be/rmXES2N0_QU | ||
It comes in two flavors, `knapsack` and `knapsack_pro`: | ||
|
||
You may also find useful article how to run parallel dynos on Heroku CI to complete tests faster | ||
https://docs.knapsackpro.com/2019/how-to-run-tests-faster-on-heroku-ci-with-parallel-dynos | ||
| | `knapsack` | `knapsack_pro` | | ||
| ------------------------------- | ---------- | --------------------------------------- | | ||
| Free | ✅ | ✅ [Free plan](https://knapsackpro.com?utm_source=github&utm_medium=readme&utm_campaign=knapsack_gem&utm_content=free_plan) | | ||
| Static split | ✅ | ✅ | | ||
| [Dynamic split](https://docs.knapsackpro.com/overview/#queue-mode-dynamic-split) | ❌ | ✅ | | ||
| [Split by test examples](https://docs.knapsackpro.com/ruby/split-by-test-examples/) | ❌ | ✅ | | ||
| Graphs, metrics, and stats | ❌ | ✅ | | ||
| Programming languages | 🤞 (Ruby) | ✅ (Ruby, Cypress, Jest, SDK/API) | | ||
| CI providers | 🤞 Limited | ✅ (All) | | ||
| [Heroku add-on](https://elements.heroku.com/addons/knapsack-pro) | ❌ | ✅ | | ||
| Additional features | ❌ | 🤘 ([Overview](https://docs.knapsackpro.com/overview/)) | | ||
| | [Install](http://docs.knapsackpro.com/ruby/knapsack) | [Install](https://docs.knapsackpro.com) | | ||
|
||
## Do you know | ||
[`knapsack` vs `knapsack_pro` full comparison](https://knapsackpro.com/features/ruby_knapsack_pro_vs_knapsack?utm_source=github&utm_medium=readme&utm_campaign=knapsack_gem&utm_content=ruby_knapsack_pro_vs_knapsack) | ||
|
||
* Knapsack Pro is risk-free integration! Knapsack Pro runs tests in Fallback Mode if your CI servers can't reach our API for any reason. | ||
* We don't need access to your repository. Knapsack Pro is just wrapper around test runner like RSpec, Cucumber, Minitest etc. | ||
* Hundreds of developers use Knapsack Pro every day to run fast CI builds. | ||
* It works with other programming languages. | ||
# Migrate from `knapsack` to `knapsack_pro` | ||
|
||
If you are already using `knapsack` and want to give `knapsack_pro` a try, here's [how to migrate in 10 minutes](./MIGRATE_TO_KNAPSACK_PRO.md). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need this? Was something failing because ostruct was not loaded?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests for Ruby v2.3 started failing.
I didn't investigate it much, but maybe a change in a patch version (2.3.x) triggers that?