aboutsummaryrefslogtreecommitdiffstats
path: root/.github/workflows/test-queries.yml
blob: 738bad9a477118eabeb32d9497e00d244b0a8591 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
name: Test queries

on:
  push:
    branches:
      - 'master'
  pull_request:
    types: [opened, synchronize, reopened, ready_for_review]
    branches:
      - 'master'

# Cancel any in-progress CI runs for a PR if it is updated
concurrency:
  group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
  cancel-in-progress: true

defaults:
  run:
    shell: bash

jobs:
  check_compilation:
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, windows-2022, macos-latest]
        cc: [ gcc, clang ]
        nvim_tag: [ stable ]
        exclude:
          - os: ubuntu-latest
            cc: clang
            nvim_tag: stable

          - os: macos-latest
            cc: gcc
            nvim_tag: stable

          - os: windows-2022
            cc: clang
            nvim_tag: stable

        include:
          - os: windows-2022
            cc: cl
            nvim_tag: stable

          - os: ubuntu-latest
            cc: gcc
            nvim_tag: nightly

    name: Parser compilation
    runs-on: ${{ matrix.os }}
    env:
      CC: ${{ matrix.cc }}
      NVIM: ${{ matrix.os == 'windows-2022' && 'nvim-win64\\bin\\nvim.exe' || 'nvim' }}
      ALLOWED_INSTALLATION_FAILURES: ${{ matrix.os == 'windows-2022' && 'rnoweb' }}
    steps:
      - uses: actions/checkout@v2
      - uses: ilammy/msvc-dev-cmd@v1
      - uses: actions/setup-node@v2

      - name: Install and prepare Neovim
        env:
          NVIM_TAG: ${{ matrix.nvim_tag }}
          TREE_SITTER_CLI_TAG: v0.20.6
        run: |
          bash ./scripts/ci-install-${{ matrix.os }}.sh

      - name: Setup Parsers Cache
        id: parsers-cache
        uses: actions/cache@v2
        with:
          path: |
            ./parser/
            ~/AppData/Local/nvim/pack/nvim-treesitter/start/nvim-treesitter/parser/
          key: ${{ matrix.os }}-${{ matrix.cc }}-${{ matrix.nvim_tag }}-parsers-v1-${{ hashFiles('./lockfile.json', './lua/nvim-treesitter/parsers.lua', './lua/nvim-treesitter/install.lua', './lua/nvim-treesitter/shell_selectors.lua') }}

      - name: Compile parsers
        run: $NVIM --headless -c "lua require'nvim-treesitter.install'.prefer_git=false" -c "TSInstallSync all" -c "q"

      - name: Post compile Windows
        if: matrix.os == 'windows-2022'
        run: cp -r ~/AppData/Local/nvim/pack/nvim-treesitter/start/nvim-treesitter/parser/* parser

      - name: Check query files
        run: $NVIM --headless -c "luafile ./scripts/check-queries.lua" -c "q"