ci: fix all types, and typecheck in workflow #518
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Main | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: false | |
on: | |
pull_request: | |
branches: | |
- '*' | |
push: | |
branches: | |
- main | |
tags: | |
- 'v*.*.*' | |
jobs: | |
style: | |
name: Style | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Style | |
uses: JohnnyMorganz/stylua-action@v4 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
version: 2.1.0 | |
args: --check . | |
# test_windows: | |
# name: Test (Windows) | |
# runs-on: windows-latest | |
# timeout-minutes: 20 | |
# steps: | |
# - name: Checkout | |
# uses: actions/checkout@v4 | |
checks: | |
name: ${{ matrix.task.name }} (${{ matrix.os }}) | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 3 | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest] | |
task: | |
- name: Test | |
run: | | |
make test | |
- name: Lint | |
prepare: | | |
sudo luarocks install luacheck | |
run: | | |
make lint | |
- name: Types | |
prepare: | | |
sudo apt-get install -y lua-language-server | |
run: | | |
make types | |
include: | |
- os: ubuntu-latest | |
nvim_url: https://github.com/neovim/neovim/releases/download/nightly/nvim-linux-x86_64.tar.gz | |
packages: luarocks ripgrep | |
manager: sudo apt-get | |
- os: windows-latest | |
nvim_url: https://github.com/neovim/neovim/releases/download/nightly/nvim-win64.zip | |
packages: ripgrep | |
manager: choco | |
task: | |
name: Test | |
run: | | |
make test | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install packages | |
if: ${{ matrix.packages }} | |
run: ${{ matrix.manager }} install ${{ matrix.packages }} | |
- name: Install packages (windows) | |
if: matrix.os == 'windows-latest' && matrix.packages | |
shell: powershell | |
run: | | |
Set-ExecutionPolicy Bypass -Scope Process -Force | |
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) | |
choco install ${{ matrix.packages }} -y | |
- name: Install neovim (nix) | |
shell: bash | |
if: matrix.os != 'windows-latest' | |
run: | | |
# Download neovim nightly. | |
mkdir -p _neovim | |
curl -sL ${{ matrix.nvim_url }} | tar xzf - --strip-components=1 -C "${PWD}/_neovim" | |
- name: Install neovim (windows) | |
shell: powershell | |
if: matrix.os == 'windows-latest' | |
run: | | |
# Download neovim. | |
# winget install neovim | |
curl -o nvim-win64.zip ${{ matrix.nvim_url }} | |
Expand-Archive -F nvim-win64.zip . | |
Move-Item -Path nvim-win64 -Destination _neovim | |
- name: Prepare | |
if: ${{ matrix.task.prepare }} | |
run: ${{ matrix.task.prepare }} | |
- name: ${{ matrix.task.name }} | |
shell: bash | |
run: | | |
export PATH="${PWD}/_neovim/bin:${PATH}" | |
export VIMRUNTIME="${PWD}/_neovim/share/nvim/runtime" | |
nvim --version | |
${{ matrix.task.run }} | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
needs: [checks, style] | |
if: startsWith(github.ref, 'refs/tags/') | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: Install requirements | |
run: | | |
pip install packaging | |
- name: Prepare environment | |
run: | | |
echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV | |
echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | |
- name: Generate release notes | |
run: | | |
python scripts/release_notes.py > ${{ github.workspace }}-RELEASE_NOTES.md | |
- name: Publish GitHub release | |
uses: softprops/action-gh-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
body_path: ${{ github.workspace }}-RELEASE_NOTES.md | |
prerelease: ${{ contains(env.TAG, 'rc') }} |