Skip to content

Commit 95b7390

Browse files
committed
describe testing in CONTRIBUTING.md
1 parent dbe4c46 commit 95b7390

File tree

1 file changed

+29
-17
lines changed

1 file changed

+29
-17
lines changed

CONTRIBUTING.md

Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -143,31 +143,34 @@ npm run serve
143143
git push
144144
```
145145

146-
## Maintain `popular_actions.go`
146+
## Maintain auto-generated sources
147147

148-
[`popular_actions.go`](./popular_actions.go) is generated automatically with `go generate`. The command runs
149-
[`generate-popular-actions`](./scripts/generate-popular-actions) script.
148+
Some files are generated by scripts in [`scripts/`](./scripts) directory. These files are kept up-to-date by CI workflows.
150149

151-
The script also can detect new releases of popular actions on GitHub by giving `-d` flag.
150+
### Maintain `popular_actions.go`
152151

153-
Detecting new release and updating `popular_actions.go` are run weekly on CI by [`generate`](.github/workflows/generate.yaml)
154-
workflow. Runs can be checked [here](https://github.com/rhysd/actionlint/actions/workflows/generate.yaml).
152+
[`popular_actions.go`](./popular_actions.go) is a data set of metadata of popular actions hosted on GitHub. It is generated
153+
automatically with `go generate`. The command runs [`generate-popular-actions`](./scripts/generate-popular-actions) script.
155154

156-
## Maintain `all_webhooks.go`
155+
The script also can detect new major releases of popular actions on GitHub by giving `-d` flag.
156+
157+
The [`generate`](.github/workflows/generate.yaml) CI workflow weekly runs to detect new major releases and update
158+
`popular_actions.go`. Runs can be found [here](https://github.com/rhysd/actionlint/actions/workflows/generate.yaml).
159+
160+
### Maintain `all_webhooks.go`
157161

158162
[`all_webhooks.go`](./all_webhooks.go) is a table all webhooks supported by GitHub Actions to trigger workflows. Note that
159163
not all webhooks are supported by GitHub Actions.
160164

161-
It is generated automatically with `go generate`. The command runs [`generate-webhook-events`](./scripts/generate-webhook-events)
162-
script.
165+
It is generated automatically with `go generate` running [`generate-webhook-events`](./scripts/generate-webhook-events) script.
163166

164167
It fetches [`events-that-trigger-workflows.md`](https://github.com/github/docs/blob/main/content/actions/learn-github-actions/events-that-trigger-workflows.md),
165168
parses the markdown document, and extracts webhook names and their types. For more details, see
166-
[README.md at the script](./scripts/generate-webhook-events/README.md).
169+
[README.md at the script directory](./scripts/generate-webhook-events/README.md).
167170

168171
Updating `all_webhooks.go` is run weekly on CI by [`generate`](.github/workflows/generate.yaml) workflow.
169172

170-
## Maintain `actionlint-matcher.json`
173+
### Maintain `actionlint-matcher.json`
171174

172175
[`actionlint-matcher.json`](.github/actionlint-matcher.json) is a matcher configuration to extract error annotations from outputs
173176
of `actionlint` command. See [the document](docs/usage.md#problem-matchers) for its usage.
@@ -178,7 +181,7 @@ file is not modified manually.
178181
It is generated by [`generate-actionlint-matcher`](./scripts/generate-actionlint-matcher) script. See the README.md file for the
179182
usage of the script and how to run the tests for it.
180183

181-
## Maintain `availability.go`
184+
### Maintain `availability.go`
182185

183186
[`availability.go`](./availability.go) is a table for conversion from workflow key (like `jobs.<job_id>.if`) to availability of
184187
contexts and special functions. GitHub Actions limits contexts and functions in certain places. For example:
@@ -194,8 +197,17 @@ Update for `availability.go` is run weekly on CI by [`generate`](.github/workflo
194197

195198
## Testing
196199

197-
- All examples in ['Checks' document](docs/checks.md) are put in [the examples directory](testdata/examples) and tested in
198-
[`linter_test.go`](linter_test.go).
199-
- I cloned GitHub top 1000 repositories and extracted 1400+ workflow files. And I tried actionlint with the collected workflow
200-
files. All bugs found while the trial were fixed and I confirmed no more false positives.
201-
200+
All tests are automated.
201+
202+
- Unit tests are implemented in `*_test.go` files for testing the corresponding APIs. Test data for unit tests are put in
203+
`testdata/` directory.
204+
- UI tests based on matching to error messages are implemented in `linter_test.go` and all test data are stored in `testdata/`
205+
directory.
206+
- `testdata/examples/` contains tests for all examples in ['Checks' document](docs/checks.md). `*.yaml` files are an input
207+
workflow and `*.out` files are expected error messages.
208+
- `testdata/ok/` contains 'OK' tests. All workflow files in this directory should cause no errors.
209+
- `testdata/err/` contains 'Error' tests. Each `*.yaml` files are workflow inputs and corresponding `*.out` files are expected
210+
error messages (one error per line).
211+
- `testdata/projects/` contains 'Project' tests. Each directories represent a single project (meaning a repository on GitHub).
212+
Corresponding `*.out` files are expected error messages. Empty `*.out` file means the test case should cause no errors.
213+
'Project' test is used for use cases where multiple files are related (reusable workflows, local actions, config files, ...).

0 commit comments

Comments
 (0)