name: Rizin CI tree-sitter test

on:
  pull_request:
    paths:
      - 'shlr/tree-sitter/*'
      - 'shlr/tree-sitter/lib/*'
      - 'shlr/tree-sitter/lib/**/*'
      - 'shlr/rizin-shell-parser/*'
      - 'shlr/rizin-shell-parser/**/*'
    branches:
      - master

jobs:
  build:
    name: rizin-shell-parser-tests
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - uses: actions/setup-node@v1
      with:
        node-version: '12.x'
    - run: cd shlr/rizin-shell-parser/ && npm install
    - name: Run tests
      run: |
        cd shlr/rizin-shell-parser
        export PATH=${PATH}:./node_modules/.bin
        tree-sitter generate
        tree-sitter test
