hastci 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +7 -0
- data/README.md +68 -20
- data/bin/hastci-rspec +1 -1
- data/lib/hastci/adapters/rspec/runner.rb +11 -0
- data/lib/hastci/config.rb +6 -2
- data/lib/hastci/session.rb +1 -1
- data/lib/hastci/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ea7c58f1b590502ae7258d6ded75619b5389d602ca474de3626de52ef65c1580
|
|
4
|
+
data.tar.gz: 8fe736f73a92b44e7d9f6a3e6b8fe569f48a3cf9114890e89e128132886cc2b4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 69d3a81ad390852e5c28d4caf6900b4429a7d4d7d6781fd2eef97d8589b2027baef9b1241861fd7bf3001d5ecebc628aad4bf1c7373bcc92f51909798970df20
|
|
7
|
+
data.tar.gz: 54e1101e729ebf74cfbc06e857970c1d6966205f522d79b59e22ab93bd752c84ce74bc986c6cd05a6915253a2885ec0196ea0f9fe17ee74c88f543ad568f9b81
|
data/.rubocop.yml
ADDED
data/README.md
CHANGED
|
@@ -1,43 +1,91 @@
|
|
|
1
|
-
# HastCI
|
|
1
|
+
# HastCI RSpec
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/hastci`. To experiment with that code, run `bin/console` for an interactive prompt.
|
|
3
|
+
Distributed test execution for RSpec. Workers pull tests from a central queue, so faster workers automatically run more tests.
|
|
6
4
|
|
|
7
5
|
## Installation
|
|
8
6
|
|
|
9
|
-
|
|
7
|
+
Add to your Gemfile:
|
|
10
8
|
|
|
11
|
-
|
|
9
|
+
```ruby
|
|
10
|
+
group :development, :test do
|
|
11
|
+
gem "hastci-rspec"
|
|
12
|
+
end
|
|
13
|
+
```
|
|
12
14
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
### GitHub Actions
|
|
18
|
+
|
|
19
|
+
HastCI auto-detects GitHub Actions and configures itself from the environment.
|
|
20
|
+
|
|
21
|
+
```yaml
|
|
22
|
+
jobs:
|
|
23
|
+
test:
|
|
24
|
+
runs-on: ubuntu-latest
|
|
25
|
+
strategy:
|
|
26
|
+
matrix:
|
|
27
|
+
ci_node_index: [0, 1, 2, 3]
|
|
28
|
+
|
|
29
|
+
steps:
|
|
30
|
+
- uses: actions/checkout@v6
|
|
31
|
+
- uses: ruby/setup-ruby@v1
|
|
32
|
+
with:
|
|
33
|
+
bundler-cache: true
|
|
34
|
+
|
|
35
|
+
- name: Run tests
|
|
36
|
+
run: bundle exec hastci-rspec
|
|
37
|
+
env:
|
|
38
|
+
CI_NODE_INDEX: ${{ matrix.ci_node_index }}
|
|
39
|
+
HASTCI_API_KEY: ${{ secrets.HASTCI_API_KEY }}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
For matrix builds with multiple dimensions (e.g., Ruby versions), use `HASTCI_SUBRUN_ID` to create separate test queues:
|
|
43
|
+
|
|
44
|
+
```yaml
|
|
45
|
+
strategy:
|
|
46
|
+
matrix:
|
|
47
|
+
ruby-version: ["3.2", "3.3", "3.4"]
|
|
48
|
+
ci_node_index: [0, 1]
|
|
49
|
+
|
|
50
|
+
# ...
|
|
51
|
+
|
|
52
|
+
env:
|
|
53
|
+
CI_NODE_INDEX: ${{ matrix.ci_node_index }}
|
|
54
|
+
HASTCI_API_KEY: ${{ secrets.HASTCI_API_KEY }}
|
|
55
|
+
HASTCI_SUBRUN_ID: ruby-${{ matrix.ruby-version }}
|
|
15
56
|
```
|
|
16
57
|
|
|
17
|
-
|
|
58
|
+
### Generic CI
|
|
59
|
+
|
|
60
|
+
For other CI systems, set the required environment variables:
|
|
18
61
|
|
|
19
62
|
```bash
|
|
20
|
-
|
|
63
|
+
export HASTCI_API_KEY="your-api-key"
|
|
64
|
+
export HASTCI_RUN_KEY="unique-run-identifier" # e.g., build-123-abc
|
|
65
|
+
export CI_NODE_INDEX="0" # 0, 1, 2... for each parallel worker
|
|
66
|
+
|
|
67
|
+
bundle exec hastci-rspec
|
|
21
68
|
```
|
|
22
69
|
|
|
23
|
-
##
|
|
70
|
+
## Configuration
|
|
24
71
|
|
|
25
|
-
|
|
72
|
+
| Variable | Required | Description |
|
|
73
|
+
|----------|----------|-------------|
|
|
74
|
+
| `HASTCI_API_KEY` | Yes | API key for HastCI |
|
|
75
|
+
| `HASTCI_RUN_KEY` | Generic CI only | Unique identifier for this test run |
|
|
76
|
+
| `CI_NODE_INDEX` | Yes | Worker index (0, 1, 2...) |
|
|
77
|
+
| `HASTCI_WORKER_ID` | No | Custom worker ID (overrides `CI_NODE_INDEX`) |
|
|
78
|
+
| `HASTCI_SUBRUN_ID` | No | Distinguishes matrix variations (GitHub Actions) |
|
|
79
|
+
| `HASTCI_API_URL` | No | Custom API endpoint |
|
|
26
80
|
|
|
27
81
|
## Development
|
|
28
82
|
|
|
29
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests.
|
|
30
|
-
|
|
31
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
|
83
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests.
|
|
32
84
|
|
|
33
85
|
## Contributing
|
|
34
86
|
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/wojtodzio/hastci.
|
|
87
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/wojtodzio/hastci.
|
|
36
88
|
|
|
37
89
|
## License
|
|
38
90
|
|
|
39
91
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
|
40
|
-
|
|
41
|
-
## Code of Conduct
|
|
42
|
-
|
|
43
|
-
Everyone interacting in the HastCI project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/wojtodzio/hastci/blob/main/CODE_OF_CONDUCT.md).
|
data/bin/hastci-rspec
CHANGED
|
@@ -25,6 +25,7 @@ module HastCI
|
|
|
25
25
|
@clock = clock
|
|
26
26
|
|
|
27
27
|
@options = ::RSpec::Core::ConfigurationOptions.new(argv)
|
|
28
|
+
add_default_path_if_needed(@options, configuration)
|
|
28
29
|
@configuration = configuration
|
|
29
30
|
@world = world
|
|
30
31
|
end
|
|
@@ -190,6 +191,16 @@ module HastCI
|
|
|
190
191
|
end
|
|
191
192
|
# :nocov:
|
|
192
193
|
end
|
|
194
|
+
|
|
195
|
+
def add_default_path_if_needed(options, configuration)
|
|
196
|
+
files = options.options[:files_or_directories_to_run]
|
|
197
|
+
return unless files.empty?
|
|
198
|
+
|
|
199
|
+
default_path = configuration.default_path
|
|
200
|
+
return unless default_path
|
|
201
|
+
|
|
202
|
+
files << default_path
|
|
203
|
+
end
|
|
193
204
|
end
|
|
194
205
|
end
|
|
195
206
|
end
|
data/lib/hastci/config.rb
CHANGED
|
@@ -5,7 +5,7 @@ require "securerandom"
|
|
|
5
5
|
module HastCI
|
|
6
6
|
class Config
|
|
7
7
|
DEFAULT_API_BASE_URL = "https://hastci.com"
|
|
8
|
-
DEFAULT_CLAIM_BATCH_SIZE =
|
|
8
|
+
DEFAULT_CLAIM_BATCH_SIZE = 2
|
|
9
9
|
DEFAULT_HEARTBEAT_INTERVAL = 15
|
|
10
10
|
DEFAULT_SEEDING_TIMEOUT = 300
|
|
11
11
|
DEFAULT_LOG_LEVEL = "INFO"
|
|
@@ -33,12 +33,16 @@ module HastCI
|
|
|
33
33
|
run_attempt = env.fetch("GITHUB_RUN_ATTEMPT")
|
|
34
34
|
commit_sha = env.fetch("GITHUB_SHA")
|
|
35
35
|
node_index = env.fetch("CI_NODE_INDEX")
|
|
36
|
+
subrun_id = env["HASTCI_SUBRUN_ID"]
|
|
37
|
+
|
|
38
|
+
base_run_key = "gha-#{run_id}-#{run_attempt}-#{commit_sha}"
|
|
39
|
+
run_key = subrun_id ? "#{base_run_key}-#{subrun_id}" : base_run_key
|
|
36
40
|
|
|
37
41
|
new(
|
|
38
42
|
api_key: env.fetch("HASTCI_API_KEY"),
|
|
39
43
|
api_base_url: env.fetch("HASTCI_API_URL", DEFAULT_API_BASE_URL),
|
|
40
44
|
api_max_retries: env["HASTCI_API_MAX_RETRIES"]&.to_i,
|
|
41
|
-
run_key:
|
|
45
|
+
run_key: run_key,
|
|
42
46
|
worker_id: "gha-worker-#{node_index}",
|
|
43
47
|
commit_sha: commit_sha,
|
|
44
48
|
claim_batch_size: env.fetch("HASTCI_CLAIM_BATCH_SIZE", DEFAULT_CLAIM_BATCH_SIZE).to_i,
|
data/lib/hastci/session.rb
CHANGED
data/lib/hastci/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: hastci
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Wojciech Wrona
|
|
@@ -46,6 +46,7 @@ extra_rdoc_files: []
|
|
|
46
46
|
files:
|
|
47
47
|
- ".envrc"
|
|
48
48
|
- ".rspec"
|
|
49
|
+
- ".rubocop.yml"
|
|
49
50
|
- ".standard.yml"
|
|
50
51
|
- ".zed/settings.json"
|
|
51
52
|
- CHANGELOG.md
|