actionlint
The atago project wrote these specs on its own initiative and runs them in its own CI, to exercise atago against a real program. They are not actionlint’s official test suite, and the actionlint project is not affiliated with atago.
Summary #
1 suite · 9 scenarios
Contents #
- actionlint (GitHub Actions workflow linter) — 9 scenarios
- version prints a semantic version
- a valid workflow passes silently
- an undefined needs dependency is reported on stdout
- an unknown runner label is reported
- an invalid expression is reported
- multiple problems in one file are all reported
- the JSON format is a structured oracle over the findings
- -ignore removes a matching finding
- stdin mode lints piped content under the given filename
actionlint (GitHub Actions workflow linter) #
Source: test/e2e/thirdparty/actionlint/actionlint.atago.yaml
Scenario: version prints a semantic version #
only when actionlint -version succeeds
When #
actionlint -version
Then #
- exit code is
0 - stdout matches
/^v[0-9]+\.[0-9]+\.[0-9]+/
Scenario: a valid workflow passes silently #
only when actionlint -version succeeds
Given #
- Fixture file
good.ymlis created.
Inputs #
Fixture good.yml:
name: good
on: push
jobs:
build:
runs-on: ubuntu-latest
steps:
- run: echo hello
When #
actionlint -shellcheck= good.yml
Then #
- exit code is
0 - stdout is empty
- stderr is empty
Scenario: an undefined needs dependency is reported on stdout #
only when actionlint -version succeeds
Given #
- Fixture file
badneeds.ymlis created.
Inputs #
Fixture badneeds.yml:
name: badneeds
on: push
jobs:
build:
runs-on: ubuntu-latest
needs: [nonexistent]
steps:
- run: echo hi
When #
actionlint -shellcheck= badneeds.yml
Then #
- exit code is
1 - stdout contains
needs job "nonexistent" which does not exist,[job-needs] - stderr is empty
Scenario: an unknown runner label is reported #
only when actionlint -version succeeds
Given #
- Fixture file
badlabel.ymlis created.
Inputs #
Fixture badlabel.yml:
name: badlabel
on: push
jobs:
build:
runs-on: [ubuntu-nonsense-9999]
steps:
- run: echo hi
When #
actionlint -shellcheck= badlabel.yml
Then #
- exit code is
1 - stdout contains
label "ubuntu-nonsense-9999" is unknown,[runner-label]
Scenario: an invalid expression is reported #
only when actionlint -version succeeds
Given #
- Fixture file
badexpr.ymlis created.
Inputs #
Fixture badexpr.yml:
name: badexpr
on: push
jobs:
build:
runs-on: ubuntu-latest
steps:
- run: echo ${{ github.event.foo.bar( }}
When #
actionlint -shellcheck= badexpr.yml
Then #
- exit code is
1 - stdout contains
[expression]
Scenario: multiple problems in one file are all reported #
only when actionlint -version succeeds
Given #
- Fixture file
two.ymlis created.
Inputs #
Fixture two.yml:
name: two
on: push
jobs:
build:
runs-on: [ubuntu-nonsense-9999]
needs: [ghost]
steps:
- run: echo hi
When #
actionlint -shellcheck= two.yml
Then #
- exit code is
1 - stdout contains
[job-needs],[runner-label]
Scenario: the JSON format is a structured oracle over the findings #
only when actionlint -version succeeds
Given #
- Fixture file
two.ymlis created.
Inputs #
Fixture two.yml:
name: two
on: push
jobs:
build:
runs-on: [ubuntu-nonsense-9999]
needs: [ghost]
steps:
- run: echo hi
When #
actionlint -shellcheck= -format '{{json .}}' two.yml
Then #
- exit code is
1 - stdout at
$has length 2 - stdout at
$[0].kindequalsjob-needs - stdout at
$[1].kindequalsrunner-label
Scenario: -ignore removes a matching finding #
only when actionlint -version succeeds
Given #
- Fixture file
two.ymlis created.
Inputs #
Fixture two.yml:
name: two
on: push
jobs:
build:
runs-on: [ubuntu-nonsense-9999]
needs: [ghost]
steps:
- run: echo hi
When #
actionlint -shellcheck= -ignore 'label .* is unknown' two.yml
Then #
- exit code is
1 - stdout contains
[job-needs] - stdout does not contain
[runner-label]
Scenario: stdin mode lints piped content under the given filename #
only when actionlint -version succeeds
Given #
- Fixture file
piped.ymlis created.
Inputs #
Fixture piped.yml:
name: piped
on: push
jobs:
build:
runs-on: ubuntu-latest
needs: [ghost]
steps:
- run: echo hi
stdin for actionlint:
(read from file piped.yml)
When #
actionlint -shellcheck= -stdin-filename fromstdin.yml -
Then #
- exit code is
1 - stdout contains
fromstdin.yml,[job-needs]