variables:
  - &node_image 'node:16-alpine'
  - &when_path
      # related config files
      - ".woodpecker/web.yml"
      # web source code
      - "web/**"

pipeline:
  deps:
    image: *node_image
    commands:
      - cd web/
      - yarn install --frozen-lockfile
    when:
      path: *when_path

  lint:
    group: test
    image: *node_image
    commands:
      - cd web/
      - yarn lint
    when:
      path: *when_path

  formatcheck:
    group: test
    image: *node_image
    commands:
      - cd web/
      - yarn formatcheck
    when:
      path: *when_path

  typecheck:
    group: test
    image: *node_image
    commands:
      - cd web/
      - yarn typecheck
    when:
      path: *when_path

  test:
    group: test
    image: *node_image
    commands:
      - cd web/
      - yarn test
    when:
      path: *when_path

