diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index bc6c0cf..2d9f1eb 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -8,15 +8,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - uses: actions/setup-node@v4 - - uses: tree-sitter/setup-action@v2 - with: - install-cli: true + - uses: ./.github/workflows/treesitter.yaml # Because our tree-sitter code is in a subdirectory, # and working-directory does not apply to uses, we # are forced to specify calls to the CI ourselves. # See https://github.com/orgs/community/discussions/25742 - - run: tree-sitter generate - working-directory: ./tree-sitter-p4 - run: tree-sitter test working-directory: ./tree-sitter-p4 diff --git a/.github/workflows/treesitter.yaml b/.github/workflows/treesitter.yaml new file mode 100644 index 0000000..7bdf3a7 --- /dev/null +++ b/.github/workflows/treesitter.yaml @@ -0,0 +1,23 @@ +on: [workflow_call] + +name: Install Treesitter + +jobs: + install-treesitter: + name: Install Treesitter + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v4 + - uses: tree-sitter/setup-action@v2 + with: + install-cli: true + generate-treesitter: + name: Generate Grammar + needs: install-treesitter + # Because our tree-sitter code is in a subdirectory, + # and working-directory does not apply to uses, we + # are forced to specify calls to the CI ourselves. + # See https://github.com/orgs/community/discussions/25742 + - run: tree-sitter generate + working-directory: ./tree-sitter-p4