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) #

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.yml is 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.yml is 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.yml is 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.yml is 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.yml is 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.yml is 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].kind equals job-needs
  • stdout at $[1].kind equals runner-label

Scenario: -ignore removes a matching finding #

only when actionlint -version succeeds

Given #

  • Fixture file two.yml is 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.yml is 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]