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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 42ce8ef84263c84c281c4e0002f011ce595841daeca4d5da6689a7a34edca1d7
4
- data.tar.gz: 755701aacdd1fd4af7810366daf3e3c8a10d75a6bea3b749e9f2c1d375b78f76
3
+ metadata.gz: 64f833f5399a750ed6037624d891ba204c34084f38fa0386b36ab5204764449b
4
+ data.tar.gz: b3a143f9d7f9688e2dd0a78184de063ad660d5c5170482d53ec805de98b8a431
5
5
  SHA512:
6
- metadata.gz: 600e982684b54d6b4c35fbdd613df7c6cb595dac85acddc3dc8cef300b882ee100565fa2eac362dfde1cc8cdca645a6c2dd5347f97411f7d06bb749e0520a946
7
- data.tar.gz: 510046d569019470b0fbcf6ec24e007de694b3d6611a78fe58ff979db81208c66e7fe68ae0dfe071f78334a57f3ea68756c337f726bedd59722bb038000bc6b0
6
+ metadata.gz: 8a3d7238e5919b2476fb4830e8e1e74aa469ba79cf8c13bd71259cd0f9744b1d2c0c8b1cb04420b34f2742c1052de18608699df978b2d9e6d5e06e47f3dfd1ee
7
+ data.tar.gz: '0094c17ad5b530d9ec46ad1d31eecb5c41ea090042b9981967b0b4f739e7b8266aea4d1f0c7dd3fa8e935311bee518ad9e6cdde0644bbc7bec705a8b9a7535db'
@@ -1,35 +1,25 @@
1
- <!-- Replace `v4.5.0` with the previous release here, and `e18d76b309e42888759c1effe96767f13e34ae55`
2
- with the latest commit from https://gitlab.com/gitlab-org/ci-cd/test_file_finder/commits/master that will be included in the release. -->
3
- - Diff: https://gitlab.com/gitlab-org/ci-cd/test_file_finder/compare/v4.5.0...e18d76b309e42888759c1effe96767f13e34ae55
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
- - Release notes:
5
+ https://gitlab.com/gitlab-org/ruby/gems/test_file_finder/-/compare/<PREVIOUS_VERSION>...<COMMIT_UPDATING_VERSION>
6
6
 
7
- <!-- Keep the sections order but remove the empty sections -->
7
+ ## Checklist
8
8
 
9
- ```markdown
10
- ### New features and features updates
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
- - !aaa <Title of the aaa MR>.
14
+ ## Changelog
13
15
 
14
- ### Fixes
16
+ <!--
17
+ Paste output of:
15
18
 
16
- - !bbb <Title of the bbb MR>.
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
- ### Doc changes
21
+ NOTE: Skip `v` in `<NEW_VERSION>`. For example, Use `version=0.3.0` instead of `version=v0.3.0`.
19
22
 
20
- - !ccc <Title of the ccc MR>.
23
+ -->
21
24
 
22
- ### Other changes (tooling, technical debt)
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
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- test_file_finder (0.3.0)
4
+ test_file_finder (0.3.1)
5
5
  faraday (>= 1.0, < 3.0, != 2.0.0)
6
6
 
7
7
  GEM
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`. 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 tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
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)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TestFileFinder
4
- VERSION = '0.3.0'
4
+ VERSION = '0.3.1'
5
5
  end
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.0
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-21 00:00:00.000000000 Z
11
+ date: 2024-03-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday