From 0e96d047c2fa34e7cc5bc9f86d57a048215c2173 Mon Sep 17 00:00:00 2001 From: Lukas Reineke Date: Mon, 2 Oct 2023 12:30:27 +0900 Subject: [PATCH] chore: clean up github actions --- .github/workflows/lua_language_server.yml | 56 +++++++++++++++ .github/workflows/nightly-check.yml | 60 ---------------- .github/workflows/nightly_check.yml | 25 +++++++ .github/workflows/pr_check.yml | 86 +++-------------------- .github/workflows/tests.yml | 38 ++++++++++ 5 files changed, 128 insertions(+), 137 deletions(-) create mode 100644 .github/workflows/lua_language_server.yml delete mode 100644 .github/workflows/nightly-check.yml create mode 100644 .github/workflows/nightly_check.yml create mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/lua_language_server.yml b/.github/workflows/lua_language_server.yml new file mode 100644 index 00000000..7731cfcd --- /dev/null +++ b/.github/workflows/lua_language_server.yml @@ -0,0 +1,56 @@ +name: Run Lua Language Server check + +on: + workflow_call: + inputs: + lua_ls_version: + required: true + type: string + neovim_versions: + required: true + type: string + +jobs: + lua-language-server: + name: lua language server + runs-on: ubuntu-22.04 + strategy: + fail-fast: false + matrix: + rev: ${{ fromJson(inputs.neovim_versions) }} + steps: + - uses: actions/checkout@v3 + - run: date +%F > todays-date + - name: Restore cache for Neovim + uses: actions/cache@v3 + with: + path: _neovim + key: ${{ matrix.rev }}-${{ hashFiles('todays-date') }} + - name: Restore cache for vendor dependencies + uses: actions/cache@v3 + with: + path: vendor + key: ${{ hashFiles('todays-date') }} + - name: Restore cache for lua LS + uses: actions/cache@v3 + with: + path: _lua-ls + key: ${{ inputs.lua_ls_version }} + - name: Prepare + run: | + test -d _neovim || { + mkdir -p _neovim + curl -sL "https://github.com/neovim/neovim/releases/download/${{ matrix.rev }}/nvim-linux64.tar.gz" | tar xzf - --strip-components=1 -C "${PWD}/_neovim" + } + test -d _lua-ls || { + mkdir -p _lua-ls + curl -sL "https://github.com/LuaLS/lua-language-server/releases/download/${{ inputs.lua_ls_version }}/lua-language-server-${{ inputs.lua_ls_version }}-linux-x64.tar.gz" | tar xzf - -C "${PWD}/_lua-ls" + } + + - name: Run check + run: | + export PATH="${PWD}/_neovim/bin:${PATH}" + export PATH="${PWD}/_lua-ls/bin:${PATH}" + export VIM="${PWD}/_neovim/share/nvim/runtime" + nvim --version + make lua-language-server version=${{ matrix.rev == 'nightly' && 'nightly' || 'stable' }} diff --git a/.github/workflows/nightly-check.yml b/.github/workflows/nightly-check.yml deleted file mode 100644 index 14826ddb..00000000 --- a/.github/workflows/nightly-check.yml +++ /dev/null @@ -1,60 +0,0 @@ -name: Nightly Neovim check -# Checks LSP and unit tests against new Neovim nightly once a week - -on: - schedule: - - cron: '30 21 * * 0' # 6:30 AM JST, Monday - workflow_dispatch: - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - tests: - name: unit tests - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v3 - - name: Prepare - run: | - test -d _neovim || { - mkdir -p _neovim - curl -sL "https://github.com/neovim/neovim/releases/download/v0.9.1/nvim-linux64.tar.gz" | tar xzf - --strip-components=1 -C "${PWD}/_neovim" - } - - - name: Run tests - run: | - export PATH="${PWD}/_neovim/bin:${PATH}" - export VIM="${PWD}/_neovim/share/nvim/runtime" - nvim --version - make test - - lua-language-server: - name: lua language server - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v3 - - name: Restore cache for lua LS - uses: actions/cache@v3 - with: - path: _lua-ls - key: 3.7.0 - - name: Prepare - run: | - test -d _neovim || { - mkdir -p _neovim - curl -sL "https://github.com/neovim/neovim/releases/download/nightly/nvim-linux64.tar.gz" | tar xzf - --strip-components=1 -C "${PWD}/_neovim" - } - test -d _lua-ls || { - mkdir -p _lua-ls - curl -sL "https://github.com/LuaLS/lua-language-server/releases/download/3.7.0/lua-language-server-3.7.0-linux-x64.tar.gz" | tar xzf - -C "${PWD}/_lua-ls" - } - - - name: Run check - run: | - export PATH="${PWD}/_neovim/bin:${PATH}" - export PATH="${PWD}/_lua-ls/bin:${PATH}" - export VIM="${PWD}/_neovim/share/nvim/runtime" - nvim --version - make lua-language-server version=nightly diff --git a/.github/workflows/nightly_check.yml b/.github/workflows/nightly_check.yml new file mode 100644 index 00000000..ef0a508c --- /dev/null +++ b/.github/workflows/nightly_check.yml @@ -0,0 +1,25 @@ +name: Nightly Neovim check +# Checks LSP and unit tests against new Neovim nightly once a week + +on: + schedule: + - cron: '30 21 * * 0' # 6:30 AM JST, Monday + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + tests: + uses: ./.github/workflows/tests.yml + with: + neovim_versions: | + [ "nightly" ] + + lua-language-server: + uses: ./.github/workflows/lua_language_server.yml + with: + lua_ls_version: 3.7.0 + neovim_versions: | + [ "nightly" ] diff --git a/.github/workflows/pr_check.yml b/.github/workflows/pr_check.yml index 4e4fb235..fe81dff6 100644 --- a/.github/workflows/pr_check.yml +++ b/.github/workflows/pr_check.yml @@ -9,85 +9,17 @@ concurrency: jobs: tests: - name: unit tests - runs-on: ubuntu-22.04 - strategy: - fail-fast: false - matrix: - include: - - version: nightly - rev: nightly/nvim-linux64.tar.gz - - version: stable - rev: v0.9.2/nvim-linux64.tar.gz - steps: - - uses: actions/checkout@v3 - - run: date +%F > todays-date - - name: Restore cache for today's nightly. - uses: actions/cache@v3 - with: - path: _neovim - key: ${{ matrix.rev }}-${{ hashFiles('todays-date') }} - - name: Prepare - run: | - test -d _neovim || { - mkdir -p _neovim - curl -sL "https://github.com/neovim/neovim/releases/download/${{ matrix.rev }}" | tar xzf - --strip-components=1 -C "${PWD}/_neovim" - } - - - name: Run tests - run: | - export PATH="${PWD}/_neovim/bin:${PATH}" - export VIM="${PWD}/_neovim/share/nvim/runtime" - nvim --version - make test + uses: ./.github/workflows/tests.yml + with: + neovim_versions: | + [ "nightly", "v0.9.2" ] lua-language-server: - name: lua language server - runs-on: ubuntu-22.04 - strategy: - fail-fast: false - matrix: - include: - - version: nightly - rev: nightly/nvim-linux64.tar.gz - - version: stable - rev: v0.9.2/nvim-linux64.tar.gz - steps: - - uses: actions/checkout@v3 - - run: date +%F > todays-date - - name: Restore cache for today's nightly. - uses: actions/cache@v3 - with: - path: _neovim - key: ${{ matrix.rev }}-${{ hashFiles('todays-date') }} - - name: Restore vendor dependencies - uses: actions/cache@v3 - with: - path: vendor - key: ${{ hashFiles('todays-date') }} - - name: Restore cache for lua LS - uses: actions/cache@v3 - with: - path: _lua-ls - key: 3.7.0 - - name: Prepare - run: | - test -d _neovim || { - mkdir -p _neovim - curl -sL "https://github.com/neovim/neovim/releases/download/${{ matrix.rev }}" | tar xzf - --strip-components=1 -C "${PWD}/_neovim" - } - test -d _lua-ls || { - mkdir -p _lua-ls - curl -sL "https://github.com/LuaLS/lua-language-server/releases/download/3.7.0/lua-language-server-3.7.0-linux-x64.tar.gz" | tar xzf - -C "${PWD}/_lua-ls" - } - - - name: Run check - run: | - export PATH="${PWD}/_neovim/bin:${PATH}" - export PATH="${PWD}/_lua-ls/bin:${PATH}" - export VIM="${PWD}/_neovim/share/nvim/runtime" - nvim --version - make lua-language-server version=${{ matrix.version }} + uses: ./.github/workflows/lua_language_server.yml + with: + lua_ls_version: 3.7.0 + neovim_versions: | + [ "nightly", "v0.9.2" ] stylua: name: stylua diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 00000000..68ba5e5b --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,38 @@ +name: Run tests + +on: + workflow_call: + inputs: + neovim_versions: + required: true + type: string + +jobs: + tests: + name: unit tests + runs-on: ubuntu-22.04 + strategy: + fail-fast: false + matrix: + rev: ${{ fromJson(inputs.neovim_versions) }} + steps: + - uses: actions/checkout@v3 + - run: date +%F > todays-date + - name: Restore cache for Neovim + uses: actions/cache@v3 + with: + path: _neovim + key: ${{ matrix.rev }}-${{ hashFiles('todays-date') }} + - name: Prepare + run: | + test -d _neovim || { + mkdir -p _neovim + curl -sL "https://github.com/neovim/neovim/releases/download/${{ matrix.rev }}/nvim-linux64.tar.gz" | tar xzf - --strip-components=1 -C "${PWD}/_neovim" + } + + - name: Run tests + run: | + export PATH="${PWD}/_neovim/bin:${PATH}" + export VIM="${PWD}/_neovim/share/nvim/runtime" + nvim --version + make test