|
| 1 | +name: Test |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + pull_request: |
| 8 | + workflow_dispatch: |
| 9 | + inputs: |
| 10 | + denops_branch: |
| 11 | + description: "Denops branch to test" |
| 12 | + required: false |
| 13 | + default: "main" |
| 14 | + |
| 15 | +defaults: |
| 16 | + run: |
| 17 | + shell: bash --noprofile --norc -eo pipefail {0} |
| 18 | + |
| 19 | +env: |
| 20 | + DENOPS_BRANCH: ${{ github.event.inputs.denops_branch || 'main' }} |
| 21 | + |
| 22 | +jobs: |
| 23 | + check: |
| 24 | + strategy: |
| 25 | + matrix: |
| 26 | + runner: |
| 27 | + - ubuntu-latest |
| 28 | + deno_version: |
| 29 | + - "1.x" |
| 30 | + - "2.x" |
| 31 | + runs-on: ${{ matrix.runner }} |
| 32 | + steps: |
| 33 | + - run: git config --global core.autocrlf false |
| 34 | + if: runner.os == 'Windows' |
| 35 | + - uses: actions/checkout@v4 |
| 36 | + - uses: denoland/[email protected] |
| 37 | + with: |
| 38 | + deno-version: "${{ matrix.deno_version }}" |
| 39 | + - uses: actions/cache@v4 |
| 40 | + with: |
| 41 | + key: deno-${{ hashFiles('**/*') }} |
| 42 | + restore-keys: deno- |
| 43 | + path: | |
| 44 | + /home/runner/.cache/deno/deps/https/deno.land |
| 45 | + - name: Lint check |
| 46 | + run: deno lint |
| 47 | + - name: Format check |
| 48 | + run: deno fmt --check |
| 49 | + - name: Type check |
| 50 | + run: deno task check |
| 51 | + - name: Gen check |
| 52 | + run: | |
| 53 | + deno task gen |
| 54 | + git diff --exit-code |
| 55 | +
|
| 56 | + test: |
| 57 | + strategy: |
| 58 | + matrix: |
| 59 | + runner: |
| 60 | + - windows-latest |
| 61 | + - macos-latest |
| 62 | + - ubuntu-latest |
| 63 | + deno_version: |
| 64 | + - "1.x" |
| 65 | + - "2.x" |
| 66 | + host_version: |
| 67 | + - vim: "v9.1.0448" |
| 68 | + nvim: "v0.10.0" |
| 69 | + runs-on: ${{ matrix.runner }} |
| 70 | + timeout-minutes: 15 |
| 71 | + steps: |
| 72 | + - run: git config --global core.autocrlf false |
| 73 | + if: runner.os == 'Windows' |
| 74 | + |
| 75 | + - uses: actions/checkout@v4 |
| 76 | + |
| 77 | + - uses: denoland/[email protected] |
| 78 | + with: |
| 79 | + deno-version: "${{ matrix.deno_version }}" |
| 80 | + |
| 81 | + - name: Get denops |
| 82 | + run: | |
| 83 | + git clone https://github.com/vim-denops/denops.vim /tmp/denops.vim |
| 84 | + echo "DENOPS_TEST_DENOPS_PATH=/tmp/denops.vim" >> "$GITHUB_ENV" |
| 85 | +
|
| 86 | + - name: Try switching denops branch |
| 87 | + run: | |
| 88 | + git -C /tmp/denops.vim switch ${{ env.DENOPS_BRANCH }} || true |
| 89 | + git -C /tmp/denops.vim branch |
| 90 | +
|
| 91 | + - uses: rhysd/action-setup-vim@v1 |
| 92 | + id: vim |
| 93 | + with: |
| 94 | + version: "${{ matrix.host_version.vim }}" |
| 95 | + |
| 96 | + - uses: rhysd/action-setup-vim@v1 |
| 97 | + id: nvim |
| 98 | + with: |
| 99 | + neovim: true |
| 100 | + version: "${{ matrix.host_version.nvim }}" |
| 101 | + |
| 102 | + - name: Export executables |
| 103 | + run: | |
| 104 | + echo "DENOPS_TEST_VIM_EXECUTABLE=${{ steps.vim.outputs.executable }}" >> "$GITHUB_ENV" |
| 105 | + echo "DENOPS_TEST_NVIM_EXECUTABLE=${{ steps.nvim.outputs.executable }}" >> "$GITHUB_ENV" |
| 106 | +
|
| 107 | + - name: Check versions |
| 108 | + run: | |
| 109 | + deno --version |
| 110 | + ${DENOPS_TEST_VIM_EXECUTABLE} --version |
| 111 | + ${DENOPS_TEST_NVIM_EXECUTABLE} --version |
| 112 | +
|
| 113 | + - name: Perform pre-cache |
| 114 | + run: | |
| 115 | + deno cache \ |
| 116 | + ${DENOPS_TEST_DENOPS_PATH}/denops/@denops-private/mod.ts ./denops/fall/main.ts |
| 117 | +
|
| 118 | + - name: Test |
| 119 | + run: deno task test:coverage |
| 120 | + timeout-minutes: 15 |
| 121 | + |
| 122 | + - run: | |
| 123 | + deno task coverage --lcov > coverage.lcov |
| 124 | +
|
| 125 | + - uses: codecov/codecov-action@v4 |
| 126 | + with: |
| 127 | + os: ${{ runner.os }} |
| 128 | + files: ./coverage.lcov |
| 129 | + token: ${{ secrets.CODECOV_TOKEN }} |
| 130 | + |
| 131 | + jsr-publish: |
| 132 | + runs-on: ubuntu-latest |
| 133 | + steps: |
| 134 | + - uses: actions/checkout@v4 |
| 135 | + - uses: denoland/setup-deno@v1 |
| 136 | + with: |
| 137 | + deno-version: ${{ env.DENO_VERSION }} |
| 138 | + - name: Publish (dry-run) |
| 139 | + run: | |
| 140 | + deno publish --dry-run |
0 commit comments