test_file_finder 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitlab/merge_request_templates/Release.md +16 -26
- data/Gemfile.lock +1 -1
- data/README.md +31 -1
- data/lefthook.yml +14 -0
- data/lib/test_file_finder/mapping_strategies/direct_matching.rb +1 -1
- data/lib/test_file_finder/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 64f833f5399a750ed6037624d891ba204c34084f38fa0386b36ab5204764449b
|
4
|
+
data.tar.gz: b3a143f9d7f9688e2dd0a78184de063ad660d5c5170482d53ec805de98b8a431
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8a3d7238e5919b2476fb4830e8e1e74aa469ba79cf8c13bd71259cd0f9744b1d2c0c8b1cb04420b34f2742c1052de18608699df978b2d9e6d5e06e47f3dfd1ee
|
7
|
+
data.tar.gz: '0094c17ad5b530d9ec46ad1d31eecb5c41ea090042b9981967b0b4f739e7b8266aea4d1f0c7dd3fa8e935311bee518ad9e6cdde0644bbc7bec705a8b9a7535db'
|
@@ -1,35 +1,25 @@
|
|
1
|
-
<!-- Replace
|
2
|
-
|
3
|
-
|
1
|
+
<!-- Replace `<PREVIOUS_VERSION>` with the previous version number, `<COMMIT_UPDATING_VERSION>` with the latest
|
2
|
+
commit from this merge request, and `<NEW_VERSION>` with the upcoming version number. -->
|
3
|
+
## Diff
|
4
4
|
|
5
|
-
-
|
5
|
+
https://gitlab.com/gitlab-org/ruby/gems/test_file_finder/-/compare/<PREVIOUS_VERSION>...<COMMIT_UPDATING_VERSION>
|
6
6
|
|
7
|
-
|
7
|
+
## Checklist
|
8
8
|
|
9
|
-
|
10
|
-
|
9
|
+
- [ ] Run `bundle install` locally to update the `Gemfile.lock` file
|
10
|
+
- [ ] Ensure the diff link above is up-to-date.
|
11
|
+
- [ ] Add release notes to the [Changelog](#changelog) section below.
|
12
|
+
- [ ] Based on the diff and the release notes, update the `version.rb` according to [SemVer](https://semver.org).
|
11
13
|
|
12
|
-
|
14
|
+
## Changelog
|
13
15
|
|
14
|
-
|
16
|
+
<!--
|
17
|
+
Paste output of:
|
15
18
|
|
16
|
-
-
|
19
|
+
curl https://gitlab.com/api/v4/projects/gitlab-org%2Fruby%2Fgems%2Ftest_file_finder/repository/changelog?version=<NEW_VERSION> | jq -r ".notes"
|
17
20
|
|
18
|
-
|
21
|
+
NOTE: Skip `v` in `<NEW_VERSION>`. For example, Use `version=0.3.0` instead of `version=v0.3.0`.
|
19
22
|
|
20
|
-
|
23
|
+
-->
|
21
24
|
|
22
|
-
|
23
|
-
|
24
|
-
- !ddd <Title of the ddd MR>.
|
25
|
-
```
|
26
|
-
|
27
|
-
- Checklist before merging:
|
28
|
-
- [ ] Diff link is up-to-date.
|
29
|
-
- [ ] Based on the diff, `lib/test_file_finder/version.rb` is updated, according to [SemVer](https://semver.org).
|
30
|
-
- [ ] Release notes are accurate.
|
31
|
-
|
32
|
-
- Checklist after merging:
|
33
|
-
- [ ] [Update the release notes for the newly created tag](docs/release_process.md#how-to).
|
34
|
-
|
35
|
-
/label ~tooling ~"tooling::workflow"
|
25
|
+
/label ~"type::maintenance" ~"maintenance::dependency"
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -151,6 +151,15 @@ tff.test_files
|
|
151
151
|
|
152
152
|
An example mapping file is available in `fixtures/mapping.json`.
|
153
153
|
|
154
|
+
It's also possible to **return a percentage of test files** with the `limit_percentage` and `limit_min` arguments (only available in ruby):
|
155
|
+
|
156
|
+
```ruby
|
157
|
+
tff = TestFileFinder::FileFinder.new(paths: file_paths)
|
158
|
+
# Return 50% of the test files, with a minimum of 14 test files.
|
159
|
+
tff.use TestFileFinder::MappingStrategies::DirectMatching.load('mapping.json', limit_percentage: 50, limit_min: 14)
|
160
|
+
tff.test_files
|
161
|
+
```
|
162
|
+
|
154
163
|
##### `--project-path project_path` and `--merge-request-iid merge_request_iid`
|
155
164
|
|
156
165
|
`TestFileFinder` can be used with both GitLab project path and merge request IID to get the test files that failed in the project merge request.
|
@@ -174,7 +183,28 @@ tff.test_files
|
|
174
183
|
|
175
184
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
176
185
|
|
177
|
-
To install this gem onto your local machine, run `bundle exec rake install`.
|
186
|
+
To install this gem onto your local machine, run `bundle exec rake install`.
|
187
|
+
|
188
|
+
### Activate lefthook locally
|
189
|
+
|
190
|
+
```shell
|
191
|
+
lefthook install
|
192
|
+
```
|
193
|
+
|
194
|
+
## Release Process
|
195
|
+
|
196
|
+
We release `test_file_finder` on an ad-hoc basis. There is no regularity to when
|
197
|
+
we release, we just release when we make a change - no matter the size of the
|
198
|
+
change.
|
199
|
+
|
200
|
+
To release a new version:
|
201
|
+
|
202
|
+
1. Create a Merge Request.
|
203
|
+
1. Use Merge Request template [Release.md](https://gitlab.com/gitlab-org/ruby/gems/test_file_finder/-/blob/master/.gitlab/merge_request_templates/Release.md).
|
204
|
+
1. Follow the instructions.
|
205
|
+
1. After the Merge Request has been merged, a new gem version is [published automatically](https://gitlab.com/gitlab-org/components/gem-release).
|
206
|
+
|
207
|
+
See [!49](https://gitlab.com/gitlab-org/ruby/gems/test_file_finder/-/merge_requests/49) as an example.
|
178
208
|
|
179
209
|
## Contributing
|
180
210
|
|
data/lefthook.yml
CHANGED
@@ -16,3 +16,17 @@ pre-push:
|
|
16
16
|
files: git diff --name-only --diff-filter=d $(git merge-base origin/master HEAD)..HEAD
|
17
17
|
glob: '*.{rb,rake}'
|
18
18
|
run: bundle exec rubocop --parallel --force-exclusion {files}
|
19
|
+
|
20
|
+
# Changelog git trailer for the first commit of the branch
|
21
|
+
changelog-on-first-commit:
|
22
|
+
run: |
|
23
|
+
git fetch origin master
|
24
|
+
first_commit_message=$(git log --format=%B -n 1 $(git log origin/master..HEAD --pretty=format:"%h" | tail -1))
|
25
|
+
if ! echo ${first_commit_message} | grep "Changelog:"; then
|
26
|
+
echo Could not find a Changelog: git trailer on the first commit for this branch.
|
27
|
+
echo
|
28
|
+
echo Please add a trailer by amending the git commit message.
|
29
|
+
echo
|
30
|
+
echo See https://docs.gitlab.com/ee/development/changelog.html#overview for more info.
|
31
|
+
exit 1
|
32
|
+
fi
|
@@ -47,7 +47,7 @@ module TestFileFinder
|
|
47
47
|
test_files = @map.fetch(file, [])
|
48
48
|
|
49
49
|
if limit_percentage
|
50
|
-
sample_size = (limit_percentage * test_files.count).round
|
50
|
+
sample_size = ((limit_percentage / 100.0) * test_files.count).round
|
51
51
|
sample_size = limit_min if limit_min && sample_size <= limit_min
|
52
52
|
|
53
53
|
test_files = test_files.sample(sample_size)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: test_file_finder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GitLab
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-03-
|
11
|
+
date: 2024-03-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|