duel 0.1.1 → 0.1.2
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/CHANGELOG.md +67 -1
- data/README.md +20 -2
- data/docs/ci.md +495 -61
- data/docs/configuration.md +80 -0
- data/docs/how-it-works.md +4 -1
- data/lib/duel/baseline.rb +30 -4
- data/lib/duel/cli.rb +170 -28
- data/lib/duel/config.rb +71 -0
- data/lib/duel/init.rb +41 -7
- data/lib/duel/runner.rb +1 -1
- data/lib/duel/summary.rb +5 -3
- data/lib/duel/templates/duel.gitlab-ci.yml.erb +148 -0
- data/lib/duel/templates/duel.rb.erb +13 -0
- data/lib/duel/templates/perf-comment.yml.erb +59 -0
- data/lib/duel/templates/perf.yml.erb +116 -46
- data/lib/duel/version.rb +1 -1
- data/sig/duel/baseline.rbs +14 -1
- data/sig/duel/cli.rbs +64 -2
- data/sig/duel/config.rbs +36 -0
- data/sig/duel/init.rbs +13 -0
- data/sig/duel/runner.rbs +15 -3
- data/sig/duel/summary.rbs +3 -1
- metadata +3 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4cc965d0ce98a08843bc8c1e1c2029045f029a9a4ae3cb05c6fa44c4a1dd7cc4
|
|
4
|
+
data.tar.gz: 54a78bbafc884061376d691fe80f6db3e034d837dcf3d2a8448d50522758f669
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 28a9a52155e5aa377428a359b2fb0c5c17b6518f9c2af07c473afb66b772c5e46825bb5f712df21590d60d65e35f2446e9412e93013cca2332bcc5bb99f94da0
|
|
7
|
+
data.tar.gz: be20c6a67c205344149983ae8e01d49570eb2406d4ff2a4dcf828ea3ab03a260faa7ce782fec119f8257b9138b15bc877b2747f4f7fb1c9c4b3ae2a8c60a4a07
|
data/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,71 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.1.2] - 2026-11-02
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- `c.fail_on = :pull_requests` (or `duel --fail-on pull_requests`) fails
|
|
15
|
+
a regression only in a pull request (or a merge queue), and outside
|
|
16
|
+
GitHub Actions. On GitHub Actions, a regression in a push, the
|
|
17
|
+
schedule, or a run by hand passes, with a warning, and the workflow
|
|
18
|
+
that `duel init` writes comments on a pushed commit with the report,
|
|
19
|
+
as `c.comment` says, which notifies the commit's author. The default,
|
|
20
|
+
`:every_run`, fails every run, as before, and comments on no commit.
|
|
21
|
+
- `c.push_base = :last_passed` compares a push with the last commit
|
|
22
|
+
that Duel passed, which a branch marks (`duel/passed/main` for
|
|
23
|
+
`main`, and each branch the workflow guards has its own), instead of
|
|
24
|
+
the commit before the push, so slowdowns too small for any one push to
|
|
25
|
+
fail add up until they fail one. The workflow that `duel init` writes
|
|
26
|
+
moves the branch when a push passes. The default, `:before`, compares
|
|
27
|
+
a push with the commit before it, as before.
|
|
28
|
+
- `c.accept_label` names a pull request label that accepts a regression:
|
|
29
|
+
with it, the regression passes, with a warning, and the report says
|
|
30
|
+
so. The workflow that `duel init` writes passes the pull request's
|
|
31
|
+
labels to `duel` (`DUEL_LABELS`), or for a push, the labels of the
|
|
32
|
+
pull request that merged it. By default, there's no such label.
|
|
33
|
+
- `duel init --gitlab` writes GitLab CI jobs to include from
|
|
34
|
+
`.gitlab-ci.yml`, instead of GitHub Actions workflows. They compare a
|
|
35
|
+
merge request with the branch it targets, comment on it, and with
|
|
36
|
+
project access tokens, comment on a pushed commit and mark a push
|
|
37
|
+
passed. On GitLab CI, `duel` reads a merge request's target and labels,
|
|
38
|
+
writes its decisions to `DUEL_OUTPUT` as variables, and where only a
|
|
39
|
+
merge request fails (`c.fail_on`), exits with status 3 for a
|
|
40
|
+
regression outside one, which the job lets fail, as a warning.
|
|
41
|
+
- The workflow that `duel init` writes runs for a merge queue
|
|
42
|
+
(`merge_group`), and compares its group with the queue's base, so the
|
|
43
|
+
Duel check can be required with a merge queue.
|
|
44
|
+
|
|
45
|
+
### Changed
|
|
46
|
+
|
|
47
|
+
- To upgrade a project that ran `duel init` before 0.1.2, delete
|
|
48
|
+
`.github/workflows/perf.yml` (or `perf-<its path>.yml`, for a project
|
|
49
|
+
in a subdirectory) and run `duel init` again, then carry over any
|
|
50
|
+
edits of your own. It writes both workflows, and skips the files that
|
|
51
|
+
exist, such as `.duel.rb`. Kept, the old workflow comments on a pull
|
|
52
|
+
request itself, and with the new one, every comment comes twice.
|
|
53
|
+
- A pull request gets its comment from a second workflow that `duel init`
|
|
54
|
+
writes, `.github/workflows/perf-comment.yml`, which runs once the Perf
|
|
55
|
+
workflow has (`workflow_run`), with a token that can write, so a pull
|
|
56
|
+
request from a fork gets a comment too. It runs none of the pull
|
|
57
|
+
request's code, and trusts only what Duel could have said in the
|
|
58
|
+
report's artifact. The Perf workflow no longer has a Comment job, and
|
|
59
|
+
for a project in a subdirectory, it's named for the directory, as
|
|
60
|
+
`Perf (gems/parser)`.
|
|
61
|
+
- The workflow that `duel init` writes cancels a pull request's run
|
|
62
|
+
when a newer push to the pull request starts one. Every other run,
|
|
63
|
+
such as a push's to `main`, still runs to the end.
|
|
64
|
+
- A push whose commit before it isn't in the history now reports that
|
|
65
|
+
there's no commit to compare against, and passes, from `duel` itself.
|
|
66
|
+
The workflow no longer checks this in its Compare step.
|
|
67
|
+
|
|
68
|
+
### Fixed
|
|
69
|
+
|
|
70
|
+
- On GitHub Actions, a pull request is compared with the branch that it
|
|
71
|
+
targets (`GITHUB_BASE_REF`), not the main branch. A pull request into
|
|
72
|
+
a stable branch, or into another pull request's branch, was compared
|
|
73
|
+
with `main`.
|
|
74
|
+
|
|
10
75
|
## [0.1.1] - 2026-10-26
|
|
11
76
|
|
|
12
77
|
### Added
|
|
@@ -357,6 +422,7 @@ needs Ruby 3.4 or later (or JRuby 10, or TruffleRuby 40).
|
|
|
357
422
|
Anything marked `@api private`, in lib/ and sig/, may change in any
|
|
358
423
|
release.
|
|
359
424
|
|
|
360
|
-
[Unreleased]: https://github.com/sferik/duel-ruby/compare/v0.1.
|
|
425
|
+
[Unreleased]: https://github.com/sferik/duel-ruby/compare/v0.1.2...HEAD
|
|
426
|
+
[0.1.2]: https://github.com/sferik/duel-ruby/compare/v0.1.1...v0.1.2
|
|
361
427
|
[0.1.1]: https://github.com/sferik/duel-ruby/compare/v0.1.0...v0.1.1
|
|
362
428
|
[0.1.0]: https://github.com/sferik/duel-ruby/releases/tag/v0.1.0
|
data/README.md
CHANGED
|
@@ -201,6 +201,7 @@ the limit, use `--timeout`.
|
|
|
201
201
|
| `0` | Nothing got slower, or there was nothing to compare. |
|
|
202
202
|
| `1` | Something got slower, or a benchmark failed. |
|
|
203
203
|
| `2` | Duel couldn't compare. |
|
|
204
|
+
| `3` | Something got slower outside a merge request on GitLab CI, where only a merge request fails ([`c.fail_on`](docs/configuration.md#fail-only-a-pull-request)). The job that `duel init --gitlab` writes lets it fail, as a warning. |
|
|
204
205
|
|
|
205
206
|
## Run Duel in CI
|
|
206
207
|
|
|
@@ -215,6 +216,10 @@ duel:
|
|
|
215
216
|
GIT_DEPTH: 0 # the baseline comes from history
|
|
216
217
|
```
|
|
217
218
|
|
|
219
|
+
`duel init --gitlab` writes GitLab CI jobs for you, which compare a
|
|
220
|
+
merge request with the branch it targets and comment on it. See
|
|
221
|
+
[Run Duel on GitLab CI](docs/ci.md#run-duel-on-gitlab-ci).
|
|
222
|
+
|
|
218
223
|
To run Duel from Rake, define a task with `Duel::RakeTask`. Any
|
|
219
224
|
arguments after the task's name are passed to `duel`:
|
|
220
225
|
|
|
@@ -225,8 +230,10 @@ Duel::RakeTask.new(:perf_since_release, "--base", "last-release")
|
|
|
225
230
|
```
|
|
226
231
|
|
|
227
232
|
`duel init` writes a GitHub Actions workflow,
|
|
228
|
-
`.github/workflows/perf.yml
|
|
229
|
-
|
|
233
|
+
`.github/workflows/perf.yml`, and a second one,
|
|
234
|
+
`.github/workflows/perf-comment.yml`, that comments on a pull request,
|
|
235
|
+
a fork's too. It compares each pull request with the
|
|
236
|
+
branch that it targets, each push to `main` with the commit before it, and, on a
|
|
230
237
|
schedule, your last release, to catch slow creep. It also comments on a
|
|
231
238
|
pull request with Duel's report when a benchmark fails. For the
|
|
232
239
|
workflow, and for a branch that upgrades Ruby, see
|
|
@@ -304,6 +311,17 @@ but nothing to compare, or never, set
|
|
|
304
311
|
in `.duel.rb`. For more information, see
|
|
305
312
|
[Comment on a pull request](docs/ci.md#comment-on-a-pull-request).
|
|
306
313
|
|
|
314
|
+
In a project where people push to `main` directly, set
|
|
315
|
+
[`c.fail_on = :pull_requests`](docs/configuration.md#fail-only-a-pull-request)
|
|
316
|
+
to pass a regression in a push, with a warning, and comment on the
|
|
317
|
+
pushed commit with the report instead. To compare each push with the
|
|
318
|
+
last commit that passed, instead of the commit before it, so that small
|
|
319
|
+
slowdowns add up until they fail a push, set
|
|
320
|
+
[`c.push_base = :last_passed`](docs/configuration.md#compare-a-push-with-the-last-commit-that-passed).
|
|
321
|
+
To accept a regression that's on purpose, label the pull request, as
|
|
322
|
+
[`c.accept_label`](docs/configuration.md#accept-a-regression-with-a-label)
|
|
323
|
+
says.
|
|
324
|
+
|
|
307
325
|
### Show that a project is guarded
|
|
308
326
|
|
|
309
327
|
To show that Duel guards your project, add its badge to your README,
|