minitest-mergify 2026.10.8

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 1f8329ced091f90450e17fd2609fb2f0c4b2473a4c9b4a3dcb2894976ca7cca1
4
+ data.tar.gz: ca3816579117094718c11e849cac1674eff03803feb7302c63533cd2710acc31
5
+ SHA512:
6
+ metadata.gz: d7a4608e8303cfe68b9b9a27fac19ec798ffc0deecd61987823903fba281f6d741a97c647e1ca936b05731282e7235b3c6855f78346e43d35d5332577e79a146
7
+ data.tar.gz: ef2e7eabb0d85e518a066e94fabebf9a212afe436a40e8018c50d013f782e5747fafcb86a4b90f923960bc43f4c012a689fdcb251c740c58ef60fe448571c8be
data/LICENSE ADDED
@@ -0,0 +1,31 @@
1
+ Copyright © 2021-2026 Mergify. All rights reserved.
2
+
3
+ This software is proprietary to Mergify and is not open source.
4
+
5
+ Mergify grants anyone who obtains a copy a non-exclusive, non-transferable,
6
+ revocable, royalty-free licence to download, install, copy and run this
7
+ software, unmodified, solely for use with the Mergify service, including as a
8
+ dependency of a project that uses the Mergify service. You may make copies
9
+ available within your organisation, including in internal package mirrors,
10
+ container images and CI environments, for that same purpose.
11
+
12
+ Except to the extent applicable law expressly permits it, you may not modify or
13
+ create derivative works of this software, distribute it outside the purposes
14
+ above, reverse engineer it, or use it to build or operate a product or service
15
+ that competes with Mergify.
16
+
17
+ Use of the Mergify service is governed by the Mergify Terms of Service
18
+ (https://mergify.com/tos) or by your written agreement with Mergify, which
19
+ prevails over this notice where it covers this software.
20
+
21
+ THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
+ IMPLIED. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, MERGIFY SHALL NOT BE
23
+ LIABLE FOR ANY DAMAGES ARISING FROM ITS USE, EXCEPT AS PROVIDED IN YOUR
24
+ AGREEMENT WITH MERGIFY.
25
+
26
+ Some files carry their own licence notice, which applies to them instead of
27
+ this one.
28
+
29
+ This licence is governed by French law.
30
+
31
+ Third-party components and their licenses are listed in THIRD_PARTY_LICENSES.
data/README.md ADDED
@@ -0,0 +1,129 @@
1
+ # minitest-mergify
2
+
3
+ Minitest plugin for [Mergify Test Engine](https://docs.mergify.com/test-engine/).
4
+
5
+ ## Features
6
+
7
+ - **Test tracing** — Sends OpenTelemetry traces for every test to Mergify's API
8
+ - **Test quarantine** — Quarantines failing tests so they don't block CI
9
+ - **Test selection** — Runs first the tests that failed in a merge-queue bisection step, and stops once one fails again
10
+ - **Flaky test detection** — Reruns new tests to catch flaky ones before they merge
11
+
12
+ ## Installation
13
+
14
+ Add to your Gemfile:
15
+
16
+ ```ruby
17
+ gem 'minitest-mergify'
18
+ ```
19
+
20
+ Then run `bundle install`, and require the plugin where your suite sets up
21
+ Minitest, before its tests are defined, such as in `test/test_helper.rb`:
22
+
23
+ ```ruby
24
+ require 'minitest/mergify'
25
+ ```
26
+
27
+ Minitest 6 loads only the plugins a suite asks for, so the line is needed
28
+ there. Minitest 5 also loads the plugin by itself, but only once the tests are
29
+ defined: keep the line there too, or a spec test with no body (`it "does a
30
+ thing"` without a block) is reported without its line, under the file of
31
+ another test of its `describe`.
32
+
33
+ It supports Minitest 5.19 and later, on Ruby 3.1 and later, and Minitest 6 on
34
+ Ruby 3.2 and later: tests in classes and in `describe` blocks, run in one
35
+ process, in Minitest's threads (`parallelize_me!`) or in Rails' parallel
36
+ workers (`parallelize`). It runs on `mergify-ci-core`, which Bundler installs
37
+ with it and which ships precompiled for Linux (glibc 2.30 or newer, and musl),
38
+ macOS and Windows.
39
+
40
+ ## Configuration
41
+
42
+ Set the `MERGIFY_TOKEN` environment variable with your Mergify API token.
43
+
44
+ The plugin activates automatically when running in CI (detected via the `CI`
45
+ environment variable). To enable outside CI, set `MERGIFY_CI_ENABLE=true`.
46
+
47
+ ### Environment Variables
48
+
49
+ | Variable | Description | Default |
50
+ |---|---|---|
51
+ | `MERGIFY_TOKEN` | Mergify API authentication token | (required) |
52
+ | `MERGIFY_API_URL` | Mergify API endpoint | `https://api.mergify.com` |
53
+ | `MERGIFY_CI_ENABLE` | Force-enable outside CI | `false` |
54
+ | `MERGIFY_CI_DEBUG` | Print the spans instead of sending them, and upload nothing | `false` |
55
+ | `MERGIFY_TRACEPARENT` | W3C distributed trace context | — |
56
+ | `MERGIFY_TEST_JOB_NAME` | Mergify test job name | — |
57
+ | `MERGIFY_FAIL_FIRST_ENABLE` | Set to `false` to never run first what a merge-queue bisection step of this job failed before (see below) | `true` |
58
+
59
+ ### Quarantine
60
+
61
+ A test quarantined in Mergify's dashboard still runs and is still reported, as
62
+ failed when it fails, but its failure does not fail the run: Minitest counts it
63
+ as a skip. A test quarantined while the repository uploaded JUnit reports is
64
+ known under the name minitest-junit and minitest-reporters gave it,
65
+ `UserTest.test_valid`, and is quarantined under that name too.
66
+
67
+ ### Fail First
68
+
69
+ When Mergify's merge queue splits a batch that failed, the tests that failed
70
+ in the step above are the ones that tell the next split apart. The plugin asks
71
+ Mergify whether the run is such a bisection step and, if so, runs those tests
72
+ first, and stops the run once one failed again, so the queue can split again
73
+ without waiting for the rest of the suite.
74
+
75
+ **This is on by default.** A job turns it off with
76
+ `MERGIFY_FAIL_FIRST_ENABLE=false` (or `no`, `off`, `0`; any other value keeps
77
+ it on). `MERGIFY_TEST_SELECTION_ENABLE`, its former name, is still read while
78
+ the new one is unset or empty, and the summary at the end of the run says to
79
+ switch. It asks about
80
+ the tests Minitest's own filters (`-n`, `-e`, Rails' `file:line`) left, and at
81
+ the end of the run sends Mergify what it concluded (the counts and the failing
82
+ tests), which the next step is answered from. Any error, timeout, or
83
+ unrecognised answer runs the suite as usual.
84
+
85
+ It only ever asks in a build of a merge-queue batch, the only builds a
86
+ bisection step can be: on GitHub Actions, the event of the draft pull request
87
+ the queue opened; on any other build, the queue's git note on the branch, one
88
+ `git ls-remote` against `origin` that runs while the tests are being collected.
89
+ Every other build asks nothing and sends nothing. Of a batch's builds, only
90
+ those below a failed batch, and not retrying their own checks, ask: the
91
+ others cannot be a bisection step, and send their results only when the
92
+ batch holds two pull requests or more, so a bisection step may read them, or
93
+ when they failed. A build where git cannot answer (no `origin`, credentials
94
+ the test step does not hold) asks, as it would without this.
95
+
96
+ ### Flaky detection
97
+
98
+ On a pull request, a test the target branch does not have yet is new: once the
99
+ suite is over, the plugin reruns it, within a time budget Mergify sets, and if
100
+ a run fails, the test is flaky and the job fails. Minitest's own summary still
101
+ counts the test as passed; the exit code and the report below it say
102
+ otherwise. On a branch with no target, such as a push to main, it reruns the
103
+ tests Mergify knows as unhealthy instead, to report whether they still are,
104
+ without failing the job. The reruns go through Minitest itself, so they run
105
+ where the test ran: in one process, in Minitest's threads, or in Rails'
106
+ parallel workers.
107
+
108
+ ### Test names
109
+
110
+ A test in a class is named as Minitest names it, `UserTest#test_valid`. A test
111
+ in a `describe` block is named by its file, its `describe` blocks and its text,
112
+ `test/models/user_test.rb > User > when banned > cannot log in`: Minitest
113
+ numbers an `it` by its position, which would rename every test below one added.
114
+ A text its `describe` repeats keeps Minitest's number, so the two stay apart.
115
+
116
+ ## Development
117
+
118
+ ```bash
119
+ rbenv install # install the Ruby version from .ruby-version (if needed)
120
+ bundle install
121
+ (cd ../mergify-ci-core && bundle install)
122
+ bundle exec rake test # compiles mergify-ci-core's extension, then runs the suite
123
+ bundle exec rake lint
124
+ ```
125
+
126
+ ## License
127
+
128
+ Proprietary — see the LICENSE shipped with the gem. Use is governed by the
129
+ [Mergify Terms of Service](https://mergify.com/tos).