fix(ci): ci ft logic configuration #10
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: CI | |
on: | |
push: | |
branches: [main, develop] | |
pull_request: | |
branches: [main] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
nvim-version: ["0.8.0", "0.9.0", "nightly"] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Neovim | |
run: | | |
if [ "${{ matrix.nvim-version }}" = "nightly" ]; then | |
curl -LO https://github.com/neovim/neovim/releases/download/nightly/nvim-linux64.tar.gz | |
tar xzf nvim-linux64.tar.gz | |
sudo mv nvim-linux64/bin/nvim /usr/local/bin/ | |
sudo mv nvim-linux64/lib/nvim /usr/local/lib/ | |
sudo mv nvim-linux64/share/nvim /usr/local/share/ | |
else | |
curl -LO https://github.com/neovim/neovim/releases/download/v${{ matrix.nvim-version }}/nvim-linux64.tar.gz | |
tar xzf nvim-linux64.tar.gz | |
sudo mv nvim-linux64/bin/nvim /usr/local/bin/ | |
sudo mv nvim-linux64/lib/nvim /usr/local/lib/ | |
sudo mv nvim-linux64/share/nvim /usr/local/share/ | |
fi | |
nvim --version | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.x" | |
- name: Install sqlparse | |
run: pip install sqlparse | |
- name: Install Lua dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y luarocks | |
sudo luarocks install luacheck | |
- name: Run luacheck | |
run: luacheck lua/ --globals vim | |
- name: Check plugin loads | |
run: | | |
nvim --headless -c "lua require('sql-formatter')" -c "qa!" | |
- name: Test external formatter | |
run: | | |
echo "SELECT * FROM users WHERE active=1;" | sqlformat --reindent --keywords upper --identifiers lower - | |
release: | |
needs: test | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Generate changelog | |
id: changelog | |
run: | | |
# Simple changelog generation | |
echo "## Changes" > CHANGELOG.tmp | |
git log --oneline --since="$(git describe --tags --abbrev=0 2>/dev/null || echo '1970-01-01')" >> CHANGELOG.tmp | |
- name: Create Release | |
uses: actions/create-release@v1 | |
if: contains(github.event.head_commit.message, '[release]') | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: v${{ github.run_number }} | |
release_name: Release v${{ github.run_number }} | |
body_path: CHANGELOG.tmp | |
draft: false | |
prerelease: false |