nukadoko 0.6.0 → 0.7.0
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 +541 -3
- data/README.ja.md +20 -5
- data/README.md +12 -6
- data/docs/ci.ja.md +542 -0
- data/docs/ci.md +635 -0
- data/docs/commands.ja.md +1524 -0
- data/docs/commands.md +1281 -0
- data/docs/engines.json +19 -0
- data/docs/execution-events.ja.md +336 -0
- data/docs/execution-events.md +423 -0
- data/docs/glossary.json +1348 -0
- data/docs/guide.ja.md +733 -0
- data/docs/guide.md +815 -0
- data/docs/intent.ja.md +133 -0
- data/docs/intent.md +156 -0
- data/docs/layout.ja.md +442 -0
- data/docs/layout.md +399 -0
- data/docs/releasing.ja.md +186 -0
- data/docs/releasing.md +237 -0
- data/docs/ruby/reference.ja.md +302 -0
- data/docs/ruby/reference.md +368 -0
- data/docs/spec.ja.md +8916 -0
- data/docs/spec.md +11250 -0
- data/docs/tutorial.ja.md +451 -0
- data/docs/tutorial.md +458 -0
- data/docs/typescript/adopting.ja.md +231 -0
- data/docs/typescript/adopting.md +251 -0
- data/docs/typescript/doors.ja.md +301 -0
- data/docs/typescript/doors.md +329 -0
- data/docs/typescript/migration-playwright-test.ja.md +189 -0
- data/docs/typescript/migration-playwright-test.md +212 -0
- data/docs/typescript/migration.ja.md +391 -0
- data/docs/typescript/migration.md +505 -0
- data/docs/typescript/reference.ja.md +176 -0
- data/docs/typescript/reference.md +197 -0
- data/docs/typescript/upgrading.ja.md +1774 -0
- data/docs/typescript/upgrading.md +2224 -0
- data/docs/web-app.ja.md +627 -0
- data/docs/web-app.md +659 -0
- data/docs/writing-scenarios.ja.md +544 -0
- data/docs/writing-scenarios.md +563 -0
- data/lib/nukadoko/base.rb +12 -5
- data/lib/nukadoko/changed_files.rb +95 -0
- data/lib/nukadoko/check.rb +459 -51
- data/lib/nukadoko/claim_drops.rb +271 -0
- data/lib/nukadoko/claim_line.rb +24 -4
- data/lib/nukadoko/claim_rules.rb +143 -1
- data/lib/nukadoko/claim_sides.rb +157 -9
- data/lib/nukadoko/cli.rb +395 -48
- data/lib/nukadoko/codes.json +246 -21
- data/lib/nukadoko/codes.rb +21 -4
- data/lib/nukadoko/command.rb +120 -13
- data/lib/nukadoko/command_help.rb +128 -0
- data/lib/nukadoko/compat.rb +469 -0
- data/lib/nukadoko/criteria.rb +1 -1
- data/lib/nukadoko/definition.rb +157 -7
- data/lib/nukadoko/error_frames.rb +6 -3
- data/lib/nukadoko/events/count.rb +146 -0
- data/lib/nukadoko/events/counted.rb +114 -0
- data/lib/nukadoko/events/format.rb +257 -0
- data/lib/nukadoko/events/lists.rb +154 -0
- data/lib/nukadoko/events/path.rb +285 -0
- data/lib/nukadoko/events/read.rb +284 -0
- data/lib/nukadoko/events/reader.rb +490 -0
- data/lib/nukadoko/events/selection.rb +252 -0
- data/lib/nukadoko/events/tally.rb +438 -0
- data/lib/nukadoko/features.rb +2 -2
- data/lib/nukadoko/fixtures.rb +160 -35
- data/lib/nukadoko/http_recording.rb +6 -2
- data/lib/nukadoko/intent.rb +364 -0
- data/lib/nukadoko/intent_file.rb +81 -0
- data/lib/nukadoko/intent_view.rb +190 -0
- data/lib/nukadoko/js_json.rb +2 -1
- data/lib/nukadoko/judge.rb +2 -2
- data/lib/nukadoko/judgment_file.rb +1 -1
- data/lib/nukadoko/judgments.rb +4 -4
- data/lib/nukadoko/measure_mcp.rb +202 -0
- data/lib/nukadoko/parts.rb +8 -2
- data/lib/nukadoko/path_view.rb +252 -0
- data/lib/nukadoko/place_rows.rb +161 -0
- data/lib/nukadoko/program.rb +1265 -51
- data/lib/nukadoko/program_log.rb +122 -0
- data/lib/nukadoko/program_shape.rb +385 -0
- data/lib/nukadoko/project_fixtures.rb +43 -10
- data/lib/nukadoko/project_program.rb +5 -4
- data/lib/nukadoko/repeated_prefix.rb +310 -0
- data/lib/nukadoko/report_run.rb +3 -3
- data/lib/nukadoko/run.rb +1148 -159
- data/lib/nukadoko/run_record.rb +70 -46
- data/lib/nukadoko/scaffold.rb +24 -6
- data/lib/nukadoko/schema.rb +15 -2
- data/lib/nukadoko/secrets.rb +55 -5
- data/lib/nukadoko/states.rb +478 -0
- data/lib/nukadoko/step.rb +71 -2
- data/lib/nukadoko/step_fixtures.rb +52 -3
- data/lib/nukadoko/summary.rb +799 -29
- data/lib/nukadoko/table.rb +4 -2
- data/lib/nukadoko/text_fit.rb +20 -7
- data/lib/nukadoko/trace.rb +152 -45
- data/lib/nukadoko/tree_passes.rb +95 -33
- data/lib/nukadoko/underneath.rb +311 -0
- data/lib/nukadoko/version.rb +1 -1
- data/lib/nukadoko/vocabulary.rb +166 -23
- data/lib/nukadoko/walk.rb +2 -2
- data/lib/nukadoko/walk_step.rb +1 -1
- data/lib/nukadoko.rb +23 -0
- data/llms.txt +41 -34
- data/sig/generated/nukadoko/base.rbs +4 -4
- data/sig/generated/nukadoko/changed_files.rbs +42 -0
- data/sig/generated/nukadoko/check.rbs +147 -10
- data/sig/generated/nukadoko/claim_drops.rbs +135 -0
- data/sig/generated/nukadoko/claim_line.rbs +11 -0
- data/sig/generated/nukadoko/claim_rules.rbs +49 -4
- data/sig/generated/nukadoko/claim_sides.rbs +63 -12
- data/sig/generated/nukadoko/cli.rbs +80 -7
- data/sig/generated/nukadoko/codes.rbs +19 -4
- data/sig/generated/nukadoko/command.rbs +68 -1
- data/sig/generated/nukadoko/command_help.rbs +18 -0
- data/sig/generated/nukadoko/compat.rbs +392 -0
- data/sig/generated/nukadoko/criteria.rbs +1 -1
- data/sig/generated/nukadoko/definition.rbs +50 -0
- data/sig/generated/nukadoko/error_frames.rbs +1 -1
- data/sig/generated/nukadoko/events/count.rbs +69 -0
- data/sig/generated/nukadoko/events/counted.rbs +70 -0
- data/sig/generated/nukadoko/events/format.rbs +163 -0
- data/sig/generated/nukadoko/events/lists.rbs +47 -0
- data/sig/generated/nukadoko/events/path.rbs +161 -0
- data/sig/generated/nukadoko/events/read.rbs +109 -0
- data/sig/generated/nukadoko/events/reader.rbs +226 -0
- data/sig/generated/nukadoko/events/selection.rbs +100 -0
- data/sig/generated/nukadoko/events/tally.rbs +227 -0
- data/sig/generated/nukadoko/features.rbs +6 -4
- data/sig/generated/nukadoko/fixtures.rbs +67 -11
- data/sig/generated/nukadoko/http_recording.rbs +1 -1
- data/sig/generated/nukadoko/intent.rbs +132 -0
- data/sig/generated/nukadoko/intent_file.rbs +46 -0
- data/sig/generated/nukadoko/intent_view.rbs +69 -0
- data/sig/generated/nukadoko/judgment_file.rbs +1 -1
- data/sig/generated/nukadoko/judgments.rbs +1 -1
- data/sig/generated/nukadoko/measure_mcp.rbs +104 -0
- data/sig/generated/nukadoko/parts.rbs +2 -2
- data/sig/generated/nukadoko/path_view.rbs +105 -0
- data/sig/generated/nukadoko/place_rows.rbs +43 -0
- data/sig/generated/nukadoko/program.rbs +627 -23
- data/sig/generated/nukadoko/program_log.rbs +67 -0
- data/sig/generated/nukadoko/program_shape.rbs +147 -0
- data/sig/generated/nukadoko/project_fixtures.rbs +16 -3
- data/sig/generated/nukadoko/project_program.rbs +2 -1
- data/sig/generated/nukadoko/repeated_prefix.rbs +172 -0
- data/sig/generated/nukadoko/report_run.rbs +1 -1
- data/sig/generated/nukadoko/run.rbs +286 -41
- data/sig/generated/nukadoko/run_record.rbs +20 -12
- data/sig/generated/nukadoko/scaffold.rbs +3 -0
- data/sig/generated/nukadoko/schema.rbs +5 -0
- data/sig/generated/nukadoko/secrets.rbs +26 -3
- data/sig/generated/nukadoko/states.rbs +214 -0
- data/sig/generated/nukadoko/step.rbs +58 -1
- data/sig/generated/nukadoko/step_fixtures.rbs +39 -0
- data/sig/generated/nukadoko/summary.rbs +256 -2
- data/sig/generated/nukadoko/table.rbs +3 -2
- data/sig/generated/nukadoko/trace.rbs +108 -33
- data/sig/generated/nukadoko/tree_passes.rbs +36 -8
- data/sig/generated/nukadoko/underneath.rbs +141 -0
- data/sig/generated/nukadoko/vocabulary.rbs +45 -6
- data/skills/nukadoko/SKILL.md +18 -18
- data/skills/nukadoko/references/checking-steps.md +16 -83
- data/skills/nukadoko/references/diagnosing.md +6 -6
- data/skills/nukadoko/references/evidence.md +19 -6
- data/skills/nukadoko/references/exploring.md +22 -7
- data/skills/nukadoko/references/fixtures.md +12 -32
- data/skills/nukadoko/references/judgments.md +12 -0
- data/skills/nukadoko/references/maintenance.md +1 -1
- data/skills/nukadoko/references/merge-risk.md +1 -1
- data/skills/nukadoko/references/parts.md +46 -23
- data/skills/nukadoko/references/{perturbed-worlds.md → perturbed-systems.md} +30 -12
- data/skills/nukadoko/references/program.md +168 -169
- data/skills/nukadoko/references/reviewing.md +20 -20
- data/skills/nukadoko/references/ruby/checking-steps.md +106 -0
- data/skills/nukadoko/references/ruby/examples/cli.md +212 -0
- data/skills/nukadoko/references/ruby/fixtures.md +34 -0
- data/skills/nukadoko/references/ruby/program.md +112 -0
- data/skills/nukadoko/references/ruby/step-files.md +115 -0
- data/skills/nukadoko/references/running.md +34 -34
- data/skills/nukadoko/references/scenario-rules.md +7 -6
- data/skills/nukadoko/references/states.md +7 -1
- data/skills/nukadoko/references/step-files.md +41 -120
- data/skills/nukadoko/references/typescript/checking-steps.md +129 -0
- data/skills/nukadoko/references/{examples → typescript/examples}/cli.md +1 -1
- data/skills/nukadoko/references/{examples → typescript/examples}/http-api.md +6 -6
- data/skills/nukadoko/references/{examples → typescript/examples}/workflow.md +1 -1
- data/skills/nukadoko/references/typescript/fixtures.md +56 -0
- data/skills/nukadoko/references/typescript/program.md +111 -0
- data/skills/nukadoko/references/typescript/step-files.md +104 -0
- data/skills/nukadoko/references/verdicts.md +10 -10
- data/skills/nukadoko/references/writing-steps.md +67 -67
- data/skills/nukadoko/references/writing-the-feature.md +1 -1
- data/skills/nukadoko-verification/SKILL.md +13 -8
- metadata +103 -7
- data/skills/nukadoko/references/ruby.md +0 -80
data/docs/ci.md
ADDED
|
@@ -0,0 +1,635 @@
|
|
|
1
|
+
# Running nukadoko in CI
|
|
2
|
+
|
|
3
|
+
A recipe, not a requirement: `nuka check` and `nuka run` are ordinary CLI
|
|
4
|
+
commands that exit `0` when everything holds and non-zero the moment
|
|
5
|
+
something is wrong (see [README.md](../README.md#running-this-in-ci) and
|
|
6
|
+
"CLI summary" in [docs/spec.md](spec.md#cli-summary)), so any CI system can
|
|
7
|
+
run them. This page fills in what a two-line excerpt cannot: two whole
|
|
8
|
+
workflow files (one job for a CLI or API project, and a browser
|
|
9
|
+
project's workflow), the Ruby browser workflow as a CircleCI config, why
|
|
10
|
+
three of their lines exist, and the four things a
|
|
11
|
+
project coming from `npx playwright test` usually has to add by hand
|
|
12
|
+
that `nuka run` never does on its own.
|
|
13
|
+
|
|
14
|
+
## A CLI or API project: one job
|
|
15
|
+
|
|
16
|
+
A project set up with `nuka init` already has one command that runs
|
|
17
|
+
`nuka run`: the `scenarios` task in a Ruby project's `Rakefile`, and the
|
|
18
|
+
`test:scenarios` script in a TypeScript project's `package.json`. With
|
|
19
|
+
no target, `nuka run` runs `featuresDir`, and
|
|
20
|
+
before it executes anything it reports what `nuka check` reports for those
|
|
21
|
+
scenarios and exits `2` when one is an error, without running anything. A
|
|
22
|
+
failed scenario exits `1`. A step in the job that has to tell the two
|
|
23
|
+
apart reads `$?`: `2` means fix the invocation or the suite before it can
|
|
24
|
+
run (a bad flag, an invalid config, a missing target, a `check` error),
|
|
25
|
+
and `1` means it ran and something is red. One job is therefore the
|
|
26
|
+
whole gate for a project whose steps never open a browser:
|
|
27
|
+
|
|
28
|
+
<!-- engine: ruby -->
|
|
29
|
+
```yaml
|
|
30
|
+
jobs:
|
|
31
|
+
scenarios:
|
|
32
|
+
runs-on: ubuntu-latest
|
|
33
|
+
permissions:
|
|
34
|
+
contents: read
|
|
35
|
+
steps:
|
|
36
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
37
|
+
- uses: ruby/setup-ruby@b3aaceaef7e0ee231b499e7b5f49c03fc1d32199 # v1.338.0
|
|
38
|
+
with:
|
|
39
|
+
ruby-version: "3.4"
|
|
40
|
+
bundler-cache: true
|
|
41
|
+
# The Rakefile's `scenarios` task; `bundle exec nuka run` when the
|
|
42
|
+
# project has no such task.
|
|
43
|
+
- run: bundle exec rake scenarios
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
<!-- engine: typescript -->
|
|
47
|
+
```yaml
|
|
48
|
+
jobs:
|
|
49
|
+
scenarios:
|
|
50
|
+
runs-on: ubuntu-latest
|
|
51
|
+
permissions:
|
|
52
|
+
contents: read
|
|
53
|
+
steps:
|
|
54
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
55
|
+
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
|
|
56
|
+
with:
|
|
57
|
+
node-version: 24
|
|
58
|
+
- run: npm ci --ignore-scripts
|
|
59
|
+
- run: npm run test:scenarios
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
`node-version` can be any release nukadoko runs on: 22.18 or later on the
|
|
63
|
+
22 line, or 23.6 or later, the releases that load a `.ts` file without a
|
|
64
|
+
flag. 24 is the long-term-support line these files use. `ruby-version`
|
|
65
|
+
can be 3.4 or later, the releases the gem runs on, and `bundler-cache:
|
|
66
|
+
true` runs `bundle install` and caches the installed gems between runs.
|
|
67
|
+
|
|
68
|
+
Nothing here installs a browser, or Playwright itself. The Ruby job needs
|
|
69
|
+
no Node at all: the gem's `request` fixture sends its requests without
|
|
70
|
+
Playwright. In the TypeScript job, `playwright` is an
|
|
71
|
+
optional peer dependency of nukadoko, so `npm ci` brings it in only for a
|
|
72
|
+
project that lists it in its own `devDependencies`. A step that needs it in
|
|
73
|
+
a project that does not list it stops this job at the check, as
|
|
74
|
+
`playwright-missing`, before any scenario runs.
|
|
75
|
+
|
|
76
|
+
`nuka check` on its own still has two uses: `additionalFeatureDirs`, which
|
|
77
|
+
only `nuka check` walks, and a gate that has to stay seconds
|
|
78
|
+
long when the run does not. That gate takes the targets the run takes,
|
|
79
|
+
files or directories (`nuka check features/checkout`), and reports the
|
|
80
|
+
errors the run would stop on for them.
|
|
81
|
+
|
|
82
|
+
## A browser project: a workflow you can copy whole
|
|
83
|
+
|
|
84
|
+
This is one file, `.github/workflows/nukadoko.yml`. It runs `nuka check` on
|
|
85
|
+
every push and pull request (seconds, no browser), `nuka run` after it
|
|
86
|
+
passes (the gate that actually executes), and on a pull request `nuka run
|
|
87
|
+
--base` against the pull request's base, so the run judges what the
|
|
88
|
+
change did to each criterion. With no target, `nuka check`
|
|
89
|
+
also prints notes, what is rotting rather than what is broken; they never
|
|
90
|
+
fail the job unless `--fail-on` names their code. The two commands sit in
|
|
91
|
+
two jobs so a failed check stops the work before a browser
|
|
92
|
+
is installed. `nuka run` checks its own scenarios again before it executes,
|
|
93
|
+
which costs one more step discovery and no browser.
|
|
94
|
+
|
|
95
|
+
A browser project lists `playwright` in its own `devDependencies`, at the
|
|
96
|
+
version nukadoko is tested against (`npm install -D -E playwright@1.63.0`):
|
|
97
|
+
nukadoko declares it as an optional peer dependency and does not install it.
|
|
98
|
+
The `npm ci` lines below then bring in the package in every job, and only
|
|
99
|
+
the `run` job downloads a browser for it.
|
|
100
|
+
|
|
101
|
+
A Ruby browser project needs Node too, in the `run` job only. The gem
|
|
102
|
+
drives the browser through its dependency `playwright-ruby-client`, which
|
|
103
|
+
starts the driver of the Node `playwright` package, by default with `npx
|
|
104
|
+
playwright`. The project lists `playwright` at the same version in a
|
|
105
|
+
`package.json` of its own (in a project with no `package.json`, the same
|
|
106
|
+
`npm install` writes one), and the `run` job sets up Node, installs that
|
|
107
|
+
package, and installs Chromium, the one browser the Ruby engine launches.
|
|
108
|
+
The `check` job needs only Ruby: the Ruby engine's `nuka check` does not
|
|
109
|
+
look for the package. The Ruby engine does not write to
|
|
110
|
+
`$GITHUB_STEP_SUMMARY`, so the Ruby `run` job ends with a step that puts
|
|
111
|
+
the summary there with `nuka report --format markdown`.
|
|
112
|
+
|
|
113
|
+
<!-- engine: ruby -->
|
|
114
|
+
```yaml
|
|
115
|
+
name: nukadoko
|
|
116
|
+
|
|
117
|
+
on:
|
|
118
|
+
push:
|
|
119
|
+
branches: [main]
|
|
120
|
+
pull_request:
|
|
121
|
+
|
|
122
|
+
jobs:
|
|
123
|
+
check:
|
|
124
|
+
runs-on: ubuntu-latest
|
|
125
|
+
permissions:
|
|
126
|
+
contents: read
|
|
127
|
+
steps:
|
|
128
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
129
|
+
- uses: ruby/setup-ruby@b3aaceaef7e0ee231b499e7b5f49c03fc1d32199 # v1.338.0
|
|
130
|
+
with:
|
|
131
|
+
ruby-version: "3.4"
|
|
132
|
+
bundler-cache: true
|
|
133
|
+
# PR gate: static, seconds, no browser and no Node. Put this on
|
|
134
|
+
# every PR; it can fail before anything runs. Its notes (what is
|
|
135
|
+
# rotting rather than what is broken) leave the exit code alone; add
|
|
136
|
+
# `--fail-on <code>` for each note the team has agreed to gate on.
|
|
137
|
+
- run: bundle exec nuka check
|
|
138
|
+
|
|
139
|
+
run:
|
|
140
|
+
needs: check
|
|
141
|
+
runs-on: ubuntu-latest
|
|
142
|
+
permissions:
|
|
143
|
+
contents: read
|
|
144
|
+
steps:
|
|
145
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
146
|
+
- uses: ruby/setup-ruby@b3aaceaef7e0ee231b499e7b5f49c03fc1d32199 # v1.338.0
|
|
147
|
+
with:
|
|
148
|
+
ruby-version: "3.4"
|
|
149
|
+
bundler-cache: true
|
|
150
|
+
# The gem drives the browser through playwright-ruby-client, which
|
|
151
|
+
# starts the driver of the Node `playwright` package with
|
|
152
|
+
# `npx playwright`. These two lines bring in Node and that package,
|
|
153
|
+
# at the version the project's own package.json pins.
|
|
154
|
+
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
|
|
155
|
+
with:
|
|
156
|
+
node-version: 24
|
|
157
|
+
- run: npm ci --ignore-scripts
|
|
158
|
+
# `nuka run` opens a browser; install it here, not on the `check`
|
|
159
|
+
# job above, which never launches one. The Ruby engine launches
|
|
160
|
+
# Chromium only. `--with-deps` is a Linux-runner requirement: without
|
|
161
|
+
# it, Playwright's own browser binary is present but missing the
|
|
162
|
+
# system libraries it needs to actually launch.
|
|
163
|
+
- run: npx playwright install --with-deps chromium
|
|
164
|
+
# No step starts the app under test: `nuka run` builds and starts
|
|
165
|
+
# it from the program in nukadoko.config.rb, on a port of its own,
|
|
166
|
+
# waits until its ready path answers, and stops it after the
|
|
167
|
+
# scenarios (docs/spec.md "Program").
|
|
168
|
+
# Merge/deploy gate: executes, writes step records.
|
|
169
|
+
- if: github.event_name != 'pull_request'
|
|
170
|
+
run: bundle exec nuka run features/
|
|
171
|
+
# On a pull request, compare with its base (docs/spec.md
|
|
172
|
+
# "Verdicts"). The checkout is shallow, so fetch the base's one
|
|
173
|
+
# commit first. The branch name goes through env, never straight
|
|
174
|
+
# into the script.
|
|
175
|
+
- if: github.event_name == 'pull_request'
|
|
176
|
+
env:
|
|
177
|
+
BASE_REF: ${{ github.base_ref }}
|
|
178
|
+
run: |
|
|
179
|
+
git fetch --no-tags --depth=1 origin "$BASE_REF:refs/remotes/origin/$BASE_REF"
|
|
180
|
+
bundle exec nuka run features/ --base "origin/$BASE_REF"
|
|
181
|
+
# The Ruby engine does not append to $GITHUB_STEP_SUMMARY, so this
|
|
182
|
+
# step puts the newest run's Markdown summary on this job's summary
|
|
183
|
+
# page, a red run's too.
|
|
184
|
+
- if: always()
|
|
185
|
+
run: bundle exec nuka report --format markdown >> "$GITHUB_STEP_SUMMARY"
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
<!-- engine: typescript -->
|
|
189
|
+
```yaml
|
|
190
|
+
name: nukadoko
|
|
191
|
+
|
|
192
|
+
on:
|
|
193
|
+
push:
|
|
194
|
+
branches: [main]
|
|
195
|
+
pull_request:
|
|
196
|
+
|
|
197
|
+
jobs:
|
|
198
|
+
check:
|
|
199
|
+
runs-on: ubuntu-latest
|
|
200
|
+
permissions:
|
|
201
|
+
contents: read
|
|
202
|
+
steps:
|
|
203
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
204
|
+
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
|
|
205
|
+
with:
|
|
206
|
+
node-version: 24
|
|
207
|
+
- run: npm ci --ignore-scripts
|
|
208
|
+
# PR gate: static, seconds, no browser. Put this on every PR; it can
|
|
209
|
+
# fail before anything runs. Its notes (what is rotting rather than
|
|
210
|
+
# what is broken) leave the exit code alone; add `--fail-on <code>`
|
|
211
|
+
# for each note the team has agreed to gate on.
|
|
212
|
+
- run: npx nuka check
|
|
213
|
+
|
|
214
|
+
run:
|
|
215
|
+
needs: check
|
|
216
|
+
runs-on: ubuntu-latest
|
|
217
|
+
permissions:
|
|
218
|
+
contents: read
|
|
219
|
+
steps:
|
|
220
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
221
|
+
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
|
|
222
|
+
with:
|
|
223
|
+
node-version: 24
|
|
224
|
+
- run: npm ci --ignore-scripts
|
|
225
|
+
# `nuka run` opens a browser; install it here, not on the `check`
|
|
226
|
+
# job above, which never launches one. `chromium` is
|
|
227
|
+
# `browserType`'s own default (docs/spec.md "Environments and
|
|
228
|
+
# secrets"); add `firefox`/`webkit` too if `browserType` names one
|
|
229
|
+
# of them. `--with-deps` is a Linux-runner requirement: without it,
|
|
230
|
+
# Playwright's own browser binary is present but missing the system
|
|
231
|
+
# libraries it needs to actually launch.
|
|
232
|
+
- run: npx playwright install --with-deps chromium
|
|
233
|
+
# No step starts the app under test: `nuka run` builds and starts
|
|
234
|
+
# it from the program in nukadoko.config.ts, on a port of its own, waits until its
|
|
235
|
+
# ready path answers, and stops it after the scenarios
|
|
236
|
+
# (docs/spec.md "Program"). `nuka run` never reads
|
|
237
|
+
# playwright.config.ts, so its `webServer` field starts nothing.
|
|
238
|
+
# Merge/deploy gate: executes, writes step records. Its Markdown
|
|
239
|
+
# run summary appears on this job's summary page by itself, since
|
|
240
|
+
# `nuka run` appends to $GITHUB_STEP_SUMMARY whenever it is set.
|
|
241
|
+
- if: github.event_name != 'pull_request'
|
|
242
|
+
run: npx nuka run features/
|
|
243
|
+
# On a pull request, compare with its base (docs/spec.md
|
|
244
|
+
# "Verdicts"). The checkout is shallow, so fetch the base's one
|
|
245
|
+
# commit first. The branch name goes through env, never straight
|
|
246
|
+
# into the script.
|
|
247
|
+
- if: github.event_name == 'pull_request'
|
|
248
|
+
env:
|
|
249
|
+
BASE_REF: ${{ github.base_ref }}
|
|
250
|
+
run: |
|
|
251
|
+
git fetch --no-tags --depth=1 origin "$BASE_REF:refs/remotes/origin/$BASE_REF"
|
|
252
|
+
npx nuka run features/ --base "origin/$BASE_REF"
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
On a `pull_request` event the checkout is the merge commit GitHub made of
|
|
256
|
+
the branch and the base branch's tip, so comparing it with
|
|
257
|
+
`origin/<base branch>` compares exactly what the pull request changes. A
|
|
258
|
+
checkout that is not such a merge commit (a branch checked out as it is,
|
|
259
|
+
on a local machine or a `push` event) compares with the merge base
|
|
260
|
+
instead: `nuka run --base "$(git merge-base HEAD origin/main)"`. Against
|
|
261
|
+
the tip of a base branch that moved on since the branch began, a
|
|
262
|
+
criterion added there reads as `removed`, and one changed there reads as
|
|
263
|
+
changed by the branch, although the branch never touched either. A
|
|
264
|
+
new or changed criterion also runs against the base's code, which the run
|
|
265
|
+
builds from the base's own config in a tree under the run
|
|
266
|
+
directory, and an unchanged one runs under the base's steps when they
|
|
267
|
+
changed. The job therefore needs what building the base needs. In
|
|
268
|
+
TypeScript, the base resolves packages from this checkout's
|
|
269
|
+
`node_modules`. Only the rows that need the base or the old system run
|
|
270
|
+
there, so the extra time is one build
|
|
271
|
+
and the scenarios that changed, plus every unchanged scenario when the
|
|
272
|
+
step files changed. Without the fetch, `nuka run` refuses with
|
|
273
|
+
`base-shallow` and prints the same `git fetch` as its `do:` line.
|
|
274
|
+
|
|
275
|
+
## Why the workflow above pins actions, skips install scripts, and limits permissions
|
|
276
|
+
|
|
277
|
+
In August 2026, several widely used npm packages were compromised. The
|
|
278
|
+
attack path started with a `preinstall` hook in `package.json`, which npm
|
|
279
|
+
runs automatically the moment `npm install` starts, before anyone running
|
|
280
|
+
it has read a line of the package's own code. That hook scanned more than
|
|
281
|
+
200 file paths for AWS credentials, GitHub personal access tokens, npm
|
|
282
|
+
tokens, and SSH keys, and sent whatever it found to a server outside the
|
|
283
|
+
project. With a stolen GitHub token, the same attack went on to inject a
|
|
284
|
+
workflow into `.github/workflows/`, one that read every repository
|
|
285
|
+
secret with `toJSON(secrets)` and wrote the result into a build artifact.
|
|
286
|
+
|
|
287
|
+
Three lines in the workflow above answer three parts of that path.
|
|
288
|
+
|
|
289
|
+
- **`uses:` names a commit, not a tag.** A tag such as `@v4` can move: a
|
|
290
|
+
compromised maintainer account can repoint it to different code
|
|
291
|
+
without changing the string a reader sees in the workflow file. A
|
|
292
|
+
commit SHA cannot move the same way, which is why the workflow above
|
|
293
|
+
names one. The two SHAs above are also each action's newest release as
|
|
294
|
+
of this writing, `checkout` v7.0.1 and `setup-node` v7.0.0, three
|
|
295
|
+
majors ahead of the `v4` tag this file used before; a fresh pin was
|
|
296
|
+
the moment to move onto it. Pinning to a SHA trades away the automatic
|
|
297
|
+
updates a floating tag carries: nothing here moves the pin forward on
|
|
298
|
+
its own. Something has to do that by hand, or with a tool built for
|
|
299
|
+
it; Dependabot can update a SHA pin, and it is one option among
|
|
300
|
+
several, not a requirement of this recipe. The Ruby jobs pin
|
|
301
|
+
`ruby/setup-ruby` the same way, to the commit of v1.338.0, the release
|
|
302
|
+
this repository's own CI uses.
|
|
303
|
+
- **`npm ci --ignore-scripts` turns off the hook the attack above used.**
|
|
304
|
+
This repository's own `.npmrc` already sets `ignore-scripts=true`, so
|
|
305
|
+
the effect already holds here without the flag on the CI line. The
|
|
306
|
+
flag is written into the line anyway, because a reader who copies this
|
|
307
|
+
recipe into another project takes the YAML, not this repository's
|
|
308
|
+
`.npmrc`; without the flag in the line itself, that other project
|
|
309
|
+
installs every dependency's scripts by default, the same default the
|
|
310
|
+
attack above relied on. In the Ruby workflow, the `npm ci` line of the
|
|
311
|
+
`run` job, which brings in Playwright's driver, carries the flag for the
|
|
312
|
+
same reason.
|
|
313
|
+
- **`permissions: contents: read` limits what a token inside the job can
|
|
314
|
+
do.** What a step can do with GitHub's own token is set by the
|
|
315
|
+
`permissions:` block, not decided case by case; job-level `permissions:
|
|
316
|
+
contents: read` scopes that token to reading repository contents, so
|
|
317
|
+
even a step that has already been compromised cannot use it to push a
|
|
318
|
+
commit or write a new workflow file. This repository's own default
|
|
319
|
+
workflow permission is already `read`, and it holds zero repository
|
|
320
|
+
secrets, but a reader who copies this recipe brings the YAML, not this
|
|
321
|
+
repository's account-level settings; a repository with different
|
|
322
|
+
defaults needs the block written into the file itself to hold the same
|
|
323
|
+
line.
|
|
324
|
+
|
|
325
|
+
## The four things this adds beyond `npx playwright test`
|
|
326
|
+
|
|
327
|
+
A team arriving with a working Playwright Test CI setup already has most
|
|
328
|
+
of the above; these four are what changes.
|
|
329
|
+
|
|
330
|
+
- **The browser install line names an engine.** On a fresh runner, `npx
|
|
331
|
+
playwright test` gets away with `npx playwright install --with-deps`
|
|
332
|
+
alone, since Playwright itself reads which browser to install from the
|
|
333
|
+
project's own `playwright.config.ts`. nukadoko has no
|
|
334
|
+
`playwright.config.ts` of its own to read that from:
|
|
335
|
+
`browserType` in `nukadoko.config.ts` picks the engine (`"chromium"` by
|
|
336
|
+
default), so the install command above names it explicitly. Firefox and
|
|
337
|
+
webkit each need their own binary too (see "Environments and
|
|
338
|
+
secrets" in [docs/spec.md](spec.md)); add the ones `browserType` (or a
|
|
339
|
+
test matrix across it) actually needs. The Ruby engine reads no
|
|
340
|
+
`browserType` and launches Chromium only, so its install line names
|
|
341
|
+
`chromium` and nothing else.
|
|
342
|
+
- **The app under test starts from the program in the config, not from
|
|
343
|
+
`webServer`.** `nuka run` and `nuka do` read `playwright.config.ts` for
|
|
344
|
+
nothing at all (see
|
|
345
|
+
[docs/typescript/migration-playwright-test.md](typescript/migration-playwright-test.md)), so
|
|
346
|
+
its `webServer` field starts nothing. The program's `build`,
|
|
347
|
+
`prepare`, and `serve` do that job, and a program that does not start
|
|
348
|
+
fails the run with `program-start-failed` and the end of its log, not
|
|
349
|
+
with an `ECONNREFUSED` in the first step that touches `page` or
|
|
350
|
+
`request` (see "Program" in [docs/spec.md](spec.md#program)).
|
|
351
|
+
- **What a run leaves behind is bounded, and the rest is not.** `nuka run`
|
|
352
|
+
keeps the newest `retention.runs` runs and removes older ones itself at
|
|
353
|
+
the end of every run (see "Artifacts" in
|
|
354
|
+
[docs/spec.md](spec.md#artifacts)), so on a persistent runner
|
|
355
|
+
`.nukadoko/runs/` and the export output stay the size of that many
|
|
356
|
+
runs. What it never removes is an `allure-results/` directory
|
|
357
|
+
written before nukadoko kept a per-run manifest of its files. A
|
|
358
|
+
GitHub-hosted runner is a fresh virtual machine per job, so it does not
|
|
359
|
+
matter there. A self-hosted or otherwise persistent runner has two
|
|
360
|
+
fixes for it: `rm -rf .nukadoko` at the start of the job, or
|
|
361
|
+
`nuka clean` (see its own `--help`), which does the same thing more
|
|
362
|
+
narrowly.
|
|
363
|
+
|
|
364
|
+
## What a team adds on top
|
|
365
|
+
|
|
366
|
+
Five things the workflow above leaves to the team, each small.
|
|
367
|
+
|
|
368
|
+
- **The run summary as a pull request comment.** The job summary page
|
|
369
|
+
already shows it, but a reviewer reads the pull request: the feature in
|
|
370
|
+
the diff and the summary beside it, which is the evidence of what ran at
|
|
371
|
+
that commit, and, from the `--base` run above, what each criterion came
|
|
372
|
+
to against the pull request's base. Where the approval is recorded, the pull request review or
|
|
373
|
+
anything else, is the team's process; nukadoko records the evidence, not
|
|
374
|
+
the approval (see "Review" in [docs/spec.md](spec.md#review)).
|
|
375
|
+
`nuka report --format markdown --out <path>` writes the same Markdown of
|
|
376
|
+
the newest run to a file, and one more step posts it:
|
|
377
|
+
|
|
378
|
+
<!-- engine: ruby -->
|
|
379
|
+
```yaml
|
|
380
|
+
# in the `run` job, which then needs `pull-requests: write` beside
|
|
381
|
+
# `contents: read`, after its `nuka run` steps
|
|
382
|
+
- run: bundle exec nuka report --format markdown --out nukadoko-summary.md
|
|
383
|
+
if: always()
|
|
384
|
+
- name: Comment the run summary on the pull request
|
|
385
|
+
if: always() && github.event_name == 'pull_request' && hashFiles('nukadoko-summary.md') != ''
|
|
386
|
+
env:
|
|
387
|
+
GH_TOKEN: ${{ github.token }}
|
|
388
|
+
run: >-
|
|
389
|
+
gh pr comment ${{ github.event.pull_request.number }}
|
|
390
|
+
--body-file nukadoko-summary.md --edit-last --create-if-none
|
|
391
|
+
```
|
|
392
|
+
|
|
393
|
+
<!-- engine: typescript -->
|
|
394
|
+
```yaml
|
|
395
|
+
# in the `run` job, which then needs `pull-requests: write` beside
|
|
396
|
+
# `contents: read`, after its `nuka run` steps
|
|
397
|
+
- run: npx nuka report --format markdown --out nukadoko-summary.md
|
|
398
|
+
if: always()
|
|
399
|
+
- name: Comment the run summary on the pull request
|
|
400
|
+
if: always() && github.event_name == 'pull_request' && hashFiles('nukadoko-summary.md') != ''
|
|
401
|
+
env:
|
|
402
|
+
GH_TOKEN: ${{ github.token }}
|
|
403
|
+
run: >-
|
|
404
|
+
gh pr comment ${{ github.event.pull_request.number }}
|
|
405
|
+
--body-file nukadoko-summary.md --edit-last --create-if-none
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
`if: always()` is there because a red run is the one a reviewer most
|
|
409
|
+
needs to read. `--edit-last` updates the comment an earlier push left
|
|
410
|
+
instead of adding one per push. Every summary starts with the line
|
|
411
|
+
`<!-- nukadoko:run -->`, so a step that posts other comments too can find
|
|
412
|
+
this one by that marker instead. The summary names what ran: the
|
|
413
|
+
verdict table (one row per criterion, with its verdict and a cell per
|
|
414
|
+
environment), the commit, the environment, the browser, the first line
|
|
415
|
+
of a failed step's error (secrets already redacted), and the command
|
|
416
|
+
that reruns it (see "Records" in [docs/spec.md](spec.md#records)).
|
|
417
|
+
Its `seen` links (the screenshot of each page a Then read, taken right
|
|
418
|
+
after the reading its claims were judged on, or the requests a Then
|
|
419
|
+
that read no page sent) are relative to the run directory, so on the
|
|
420
|
+
job's summary page and in this comment they lead nowhere: GitHub
|
|
421
|
+
resolves them against its own URL, not the run directory. Each link's
|
|
422
|
+
target still ends in the file's path in the run directory, such as
|
|
423
|
+
`steps/<id>/judged/page.png`, which a reviewer opens in the uploaded run
|
|
424
|
+
directory (the next item).
|
|
425
|
+
The `pull-requests: write` permission is the cost: the job that runs the
|
|
426
|
+
suite can then write to the pull request. A pull request from a fork gets
|
|
427
|
+
a read-only token, so the step fails there; a team that takes fork pull
|
|
428
|
+
requests moves it to a separate job.
|
|
429
|
+
- **The run directory as a build artifact.** Everything one `nuka run`
|
|
430
|
+
measured is in one directory, `.nukadoko/runs/<run_id>/`: `run.json`,
|
|
431
|
+
`summary.md`, and each step record with its traces, screenshots, and
|
|
432
|
+
`http.jsonl` (see "The state directory" in [docs/spec.md](spec.md)).
|
|
433
|
+
The paths inside `run.json` are relative to that directory, so a
|
|
434
|
+
downloaded copy reads the same as the one on the runner. One more step
|
|
435
|
+
in the `run` job uploads it:
|
|
436
|
+
|
|
437
|
+
```yaml
|
|
438
|
+
- name: Upload the run directory
|
|
439
|
+
if: always()
|
|
440
|
+
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
|
441
|
+
with:
|
|
442
|
+
name: nukadoko-runs
|
|
443
|
+
path: .nukadoko/runs/
|
|
444
|
+
# `.nukadoko` starts with a dot, and upload-artifact skips every
|
|
445
|
+
# file inside such a directory unless this is set.
|
|
446
|
+
include-hidden-files: true
|
|
447
|
+
if-no-files-found: ignore
|
|
448
|
+
retention-days: 14
|
|
449
|
+
```
|
|
450
|
+
|
|
451
|
+
`if: always()` is there for the same reason as in the comment step: a
|
|
452
|
+
red run is the one somebody downloads. On a GitHub-hosted runner the
|
|
453
|
+
directory holds only this job's run; on a persistent runner it holds
|
|
454
|
+
every run retention kept. Unpacked, its `summary.md` is the one whose
|
|
455
|
+
`seen` links open: each one points at a file beside it. `nuka do`
|
|
456
|
+
records sit in `.nukadoko/do/`,
|
|
457
|
+
outside it, since no CI job runs `nuka do`. A trace holds the browser's
|
|
458
|
+
cookies and a screenshot holds what the page showed, so decide who may
|
|
459
|
+
open the artifact before the first upload (see "What this page does not
|
|
460
|
+
claim" below).
|
|
461
|
+
- **A script that acts on the run's result.** A step that files an issue
|
|
462
|
+
for each failed scenario, or reruns them, reads `run.json` instead of
|
|
463
|
+
stderr: `nuka run features/ --json > run.json` prints it, and the run
|
|
464
|
+
writes the same file to `.nukadoko/runs/<run_id>/run.json`
|
|
465
|
+
either way. Its `scenarios` entries carry each scenario's status, its
|
|
466
|
+
steps with their line, status, step record, and error, and for a failed
|
|
467
|
+
one the `do` command that reruns it (see "Scenarios (the scripted
|
|
468
|
+
path)" in [docs/spec.md](spec.md)). Its `table` holds each criterion's
|
|
469
|
+
verdict, `held`, `proven`, or `failed`, with the reason ("Verdicts" in
|
|
470
|
+
[docs/spec.md](spec.md#verdicts)).
|
|
471
|
+
- **Both sides of a feature switch in one job, not a matrix.** A suite
|
|
472
|
+
that ran the same job once per value of a flag (a `strategy.matrix`
|
|
473
|
+
over `CHECKOUT_V2: ["", "1"]`) declares each value as an environment in
|
|
474
|
+
the program in the config instead, naming its side in `conditions`
|
|
475
|
+
("Verdicts" in [docs/spec.md](spec.md#verdicts)). The step stays
|
|
476
|
+
`nuka run features/`: a run without `--env` runs each of those
|
|
477
|
+
environments, in one job and one run, and the summary's table shows each
|
|
478
|
+
scenario on both sides. A scenario tagged `@with:checkout_v2` is
|
|
479
|
+
required where the flag is on and a control where it is off, and its row
|
|
480
|
+
is `proven` when its Then breaks there. Two jobs can say that each side
|
|
481
|
+
was green; one run can say that the scenario told them apart. The job
|
|
482
|
+
gates on `nuka run`'s exit code, which a control never turns red. A
|
|
483
|
+
JUnit report built from `nuka report --format messages` leaves the
|
|
484
|
+
controls out, so a control never turns it red either; under `--base` it
|
|
485
|
+
does not show an `unproven` or `moved` row as a failure, so it is no
|
|
486
|
+
gate. An Allure report shows a control that
|
|
487
|
+
failed as a failed result named `<scenario> (control)`, by design,
|
|
488
|
+
since that failure is the proof.
|
|
489
|
+
- **`retention.runs` sized to the runner's own pace.** The default keeps
|
|
490
|
+
the newest 20 runs. A persistent runner that runs every merge and every
|
|
491
|
+
night reaches 20 in days, and `nuka report` and `nuka do --use` read only
|
|
492
|
+
the retained runs, so measure the pace for a week before deciding the
|
|
493
|
+
number.
|
|
494
|
+
|
|
495
|
+
## A Ruby project on CircleCI
|
|
496
|
+
|
|
497
|
+
The browser workflow above, as one `.circleci/config.yml` for a Ruby
|
|
498
|
+
project whose `nukadoko.config.rb` has a program. It is one job. `nuka
|
|
499
|
+
check` runs before any step installs a browser, and its exit `1` on an
|
|
500
|
+
error stops the job there. `nuka run` exits `1` when a scenario or a criterion
|
|
501
|
+
failed and `2` when it refused and ran nothing, and CircleCI fails the job
|
|
502
|
+
on any exit other than `0`.
|
|
503
|
+
|
|
504
|
+
<!-- engine: ruby -->
|
|
505
|
+
```yaml
|
|
506
|
+
version: 2.1
|
|
507
|
+
|
|
508
|
+
jobs:
|
|
509
|
+
scenarios:
|
|
510
|
+
docker:
|
|
511
|
+
# cimg/ruby:3.4.13-node, named by its digest
|
|
512
|
+
- image: cimg/ruby@sha256:2b3e8e5d16b1e1f223977665a939b192f96b08318e201a47cd97f041d0924398
|
|
513
|
+
steps:
|
|
514
|
+
# A full clone: the default blobless clone leaves out the files of
|
|
515
|
+
# older commits, and `--base` builds the base commit's tree.
|
|
516
|
+
- checkout:
|
|
517
|
+
method: full
|
|
518
|
+
- run: bundle install
|
|
519
|
+
# A step reads secrets from env files only, never from the job's
|
|
520
|
+
# environment. `envFiles` names this file and .gitignore lists it,
|
|
521
|
+
# so every value in it is redacted from the records. The single
|
|
522
|
+
# quotes keep a `#` in a value.
|
|
523
|
+
- run: printf "API_KEY='%s'\n" "$API_KEY" > .env.ci
|
|
524
|
+
# Static, seconds, no browser: an error stops the job here.
|
|
525
|
+
- run: bundle exec nuka check
|
|
526
|
+
# playwright-ruby-client starts the driver of the Node `playwright`
|
|
527
|
+
# package with `npx playwright`, at the version package.json pins.
|
|
528
|
+
# The Ruby engine launches Chromium only.
|
|
529
|
+
- run: npm ci --ignore-scripts
|
|
530
|
+
- run: npx playwright install --with-deps chromium
|
|
531
|
+
# `nuka run` starts the program in nukadoko.config.rb itself. On a
|
|
532
|
+
# branch, it compares each criterion with where the branch left main.
|
|
533
|
+
- run: |
|
|
534
|
+
if [ "$CIRCLE_BRANCH" = main ]; then
|
|
535
|
+
bundle exec nuka run features/
|
|
536
|
+
else
|
|
537
|
+
git fetch --no-tags origin "main:refs/remotes/origin/main"
|
|
538
|
+
bundle exec nuka run features/ --base "$(git merge-base HEAD origin/main)"
|
|
539
|
+
fi
|
|
540
|
+
# store_artifacts runs after a failed step too: a red run is the one
|
|
541
|
+
# somebody opens.
|
|
542
|
+
- store_artifacts:
|
|
543
|
+
path: .nukadoko/runs
|
|
544
|
+
destination: nukadoko-runs
|
|
545
|
+
|
|
546
|
+
workflows:
|
|
547
|
+
nukadoko:
|
|
548
|
+
jobs:
|
|
549
|
+
- scenarios:
|
|
550
|
+
context: nukadoko-secrets
|
|
551
|
+
```
|
|
552
|
+
|
|
553
|
+
- **The image is named by its digest.** A cimg tag can be repointed: `3.4`
|
|
554
|
+
moved to a new build on 2026-11-19. A digest cannot move, for the same
|
|
555
|
+
reason the GitHub workflows name a commit and not a tag. The `-node`
|
|
556
|
+
variant brings the Node that the Playwright driver runs on. The config
|
|
557
|
+
uses no orb: an orb is code from outside the repository that runs in the
|
|
558
|
+
job, and the steps above need none.
|
|
559
|
+
- **Secrets come from a context or from project environment variables,
|
|
560
|
+
through an env file.** The `env` fixture never reads the process
|
|
561
|
+
environment (see "Environments and secrets" in
|
|
562
|
+
[docs/spec.md](spec.md#environments-and-secrets)), so the job writes each
|
|
563
|
+
value a step reads into an env file. The config names it,
|
|
564
|
+
`Nukadoko.config(envFiles: [".env.ci"], program: ...)`, and `.gitignore`
|
|
565
|
+
lists it. An ignored env file is a secret source, so every value in it
|
|
566
|
+
is redacted from the records. The program gets the job's environment as
|
|
567
|
+
it is ([env](spec.md#env)).
|
|
568
|
+
- **`--base` compares with the merge base.** CircleCI checks the branch
|
|
569
|
+
out as it is, not as a merge commit, so the run compares with the commit
|
|
570
|
+
where the branch left `main`, as for a `push` event above. Name the
|
|
571
|
+
branch that pull requests merge into in place of `main`.
|
|
572
|
+
- **The run directory is the artifact.** `.nukadoko/runs/<run_id>/` holds
|
|
573
|
+
`run.json`, the run summary `summary.md`, and each step record with its
|
|
574
|
+
trace. The Ruby engine writes the summary only there. Traces are not
|
|
575
|
+
redacted (see the next section).
|
|
576
|
+
|
|
577
|
+
## What this page does not claim
|
|
578
|
+
|
|
579
|
+
None of the workflows above has been run inside GitHub Actions itself; nothing
|
|
580
|
+
in this repository can execute one. What was verified instead: the YAML
|
|
581
|
+
parses as valid YAML, `npm run test:scenarios` was run green and red in a
|
|
582
|
+
CLI project with a freshly installed tarball of this package, and every
|
|
583
|
+
`nuka` command in the TypeScript workflows (including
|
|
584
|
+
`nuka run features/`, the directory form used above, not just a single
|
|
585
|
+
feature file) was run against a real, freshly `npm install`ed copy of
|
|
586
|
+
this package. For the Ruby workflows, the gem built from this
|
|
587
|
+
repository's `ruby/` directory, installed through a Gemfile `path:`
|
|
588
|
+
entry, ran `rake scenarios` green and red in a CLI project, and ran each
|
|
589
|
+
`nuka` command they show, `--base` included. A browser scenario ran
|
|
590
|
+
under the Ruby engine with the driver from `npx playwright`, after `npm
|
|
591
|
+
ci --ignore-scripts` installed the `playwright` that a `package.json`
|
|
592
|
+
pinned. The
|
|
593
|
+
pull request comment step under "What a team adds on top" was not run
|
|
594
|
+
either: its `gh pr comment` flags were read from `gh`'s own help, not
|
|
595
|
+
exercised against a real pull request.
|
|
596
|
+
`npx playwright install --with-deps chromium` was checked with its own
|
|
597
|
+
`--dry-run`, not run to completion; `--with-deps` has no effect outside a
|
|
598
|
+
Linux runner, which this repository has none of, so the download itself
|
|
599
|
+
was not exercised here. The two commit SHAs in the `uses:` lines above
|
|
600
|
+
were checked against GitHub's own API, one call each against
|
|
601
|
+
`repos/actions/checkout/git/ref/tags/v7.0.1` and the `setup-node`
|
|
602
|
+
equivalent, confirming each names the commit its comment claims and
|
|
603
|
+
nothing else. The `ruby/setup-ruby` SHA was checked with `git ls-remote
|
|
604
|
+
https://github.com/ruby/setup-ruby`: the tag `v1.338.0` names that
|
|
605
|
+
commit. It is the pin this repository's own CI uses, not the newest
|
|
606
|
+
release. The `upload-artifact` SHA under "What a team adds on top"
|
|
607
|
+
was checked with `git ls-remote https://github.com/actions/upload-artifact`:
|
|
608
|
+
the tag `v7.0.2` names that commit, the newest release tag as of this
|
|
609
|
+
writing, and its `action.yml` there declares each input the step uses.
|
|
610
|
+
The upload step itself was not run. Read the workflow as a starting shape to adapt, not as a
|
|
611
|
+
file this project has watched go green on a real runner.
|
|
612
|
+
|
|
613
|
+
The CircleCI config has not run on CircleCI either. Its `run` steps ran
|
|
614
|
+
in order under `bash -eo pipefail`, on Ruby 3.4.10, in a scratch git
|
|
615
|
+
repository with an `origin`, a gem built from `ruby/` through a Gemfile
|
|
616
|
+
`path:` entry, and a browser scenario. On `main` the run exited `0`. On a
|
|
617
|
+
branch that changed no criterion, the `--base` run held both criteria and
|
|
618
|
+
exited `0`. On a branch that added a scenario the base already passed, it
|
|
619
|
+
exited `1` with `criterion-unproven`. The gem read a secret that holds a
|
|
620
|
+
`#` from the env file whole, and the run redacted it in `http.jsonl`. The image, `checkout`,
|
|
621
|
+
the context, and `store_artifacts` were not exercised: the digest was
|
|
622
|
+
read from Docker Hub's registry for the tag `3.4.13-node`, and the keys
|
|
623
|
+
of `checkout` and `store_artifacts` from CircleCI's configuration
|
|
624
|
+
reference.
|
|
625
|
+
|
|
626
|
+
It also says nothing about where the Allure output goes after the job,
|
|
627
|
+
for a project that renders it with `nuka report --format allure` (a run
|
|
628
|
+
writes none of its own).
|
|
629
|
+
Traces and screenshots are not redacted (see "Environments and
|
|
630
|
+
secrets" in [docs/spec.md](spec.md#environments-and-secrets)): the
|
|
631
|
+
`http.jsonl` beside them has secrets replaced, but a trace holds the
|
|
632
|
+
browser's own state, cookies included, and a screenshot holds whatever the
|
|
633
|
+
page showed. A run directory or an `allure-results/` directory uploaded as
|
|
634
|
+
an artifact, or a generated report posted to a chat, carries all of that. Keep it inside the
|
|
635
|
+
runner, or decide who may open it before the first upload.
|