Skip to content

Commit 5f5bef9

Browse files
committed
fix(ci): ci configuration
1 parent 6250603 commit 5f5bef9

File tree

1 file changed

+39
-25
lines changed

1 file changed

+39
-25
lines changed

.github/workflows/ci.yml

Lines changed: 39 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: CI
1+
name: SQL Formatter CI
22

33
on:
44
push:
@@ -11,52 +11,67 @@ jobs:
1111
runs-on: ubuntu-latest
1212
strategy:
1313
matrix:
14-
nvim-version: ["0.8.0", "0.9.0", "nightly"]
14+
nvim-version: ["0.8.0", "0.9.0"]
15+
sql-dialect: ["postgresql", "mysql", "sqlite"]
1516

1617
steps:
1718
- uses: actions/checkout@v3
1819

1920
- name: Setup Neovim
2021
run: |
21-
if [ "${{ matrix.nvim-version }}" = "nightly" ]; then
22-
curl -LO https://github.com/neovim/neovim/releases/download/nightly/nvim-linux64.tar.gz
23-
tar xzf nvim-linux64.tar.gz
24-
sudo mv nvim-linux64/bin/nvim /usr/local/bin/
25-
sudo mv nvim-linux64/lib/nvim /usr/local/lib/
26-
sudo mv nvim-linux64/share/nvim /usr/local/share/
27-
else
28-
curl -LO https://github.com/neovim/neovim/releases/download/v${{ matrix.nvim-version }}/nvim-linux64.tar.gz
29-
tar xzf nvim-linux64.tar.gz
30-
sudo mv nvim-linux64/bin/nvim /usr/local/bin/
31-
sudo mv nvim-linux64/lib/nvim /usr/local/lib/
32-
sudo mv nvim-linux64/share/nvim /usr/local/share/
33-
fi
22+
curl -LO https://github.com/neovim/neovim/releases/download/v${{ matrix.nvim-version }}/nvim-linux64.tar.gz
23+
tar xzf nvim-linux64.tar.gz
24+
sudo mv nvim-linux64/bin/nvim /usr/local/bin/
25+
sudo mv nvim-linux64/lib/nvim /usr/local/lib/
26+
sudo mv nvim-linux64/share/nvim /usr/local/share/
3427
nvim --version
3528
3629
- name: Setup Python
3730
uses: actions/setup-python@v4
3831
with:
3932
python-version: "3.x"
4033

41-
- name: Install sqlparse
42-
run: pip install sqlparse
43-
44-
- name: Install Lua dependencies
34+
- name: Install dependencies
4535
run: |
36+
# Install sqlparse
37+
pip install sqlparse
38+
39+
# Install Lua dependencies
4640
sudo apt-get update
4741
sudo apt-get install -y luarocks
4842
sudo luarocks install luacheck
43+
44+
# Install stylua for formatting
45+
cargo install stylua
4946
50-
- name: Run luacheck
51-
run: luacheck lua/ --globals vim
47+
- name: Lint Lua code
48+
run: |
49+
luacheck lua/ --globals vim
50+
stylua --check lua/
5251
53-
- name: Check plugin loads
52+
- name: Test plugin loading
5453
run: |
55-
nvim --headless -c "lua require('sql-formatter')" -c "qa!"
54+
nvim --headless -c "lua require('sql-formatter').setup({dialect = '${{ matrix.sql-dialect }}'})" -c "qa!"
5655
57-
- name: Test external formatter
56+
- name: Test SQL formatting
5857
run: |
58+
# Test basic SQL formatting
5959
echo "SELECT * FROM users WHERE active=1;" | sqlformat --reindent --keywords upper --identifiers lower -
60+
61+
# Test complex SQL formatting
62+
echo "WITH RECURSIVE cte AS (SELECT id, name, parent_id FROM categories WHERE parent_id IS NULL UNION ALL SELECT c.id, c.name, c.parent_id FROM categories c INNER JOIN cte ON c.parent_id = cte.id) SELECT * FROM cte;" | sqlformat --reindent --keywords upper --identifiers lower -
63+
64+
- name: Test file type detection
65+
run: |
66+
# Create test SQL files
67+
echo "SELECT * FROM test;" > test.sql
68+
echo "SELECT * FROM test;" > test.mysql
69+
echo "SELECT * FROM test;" > test.pgsql
70+
71+
# Test formatting for each file type
72+
for file in test.*; do
73+
nvim --headless -c "e $file" -c "lua require('sql-formatter').setup({dialect = '${{ matrix.sql-dialect }}'})" -c "wq"
74+
done
6075
6176
release:
6277
needs: test
@@ -71,7 +86,6 @@ jobs:
7186
- name: Generate changelog
7287
id: changelog
7388
run: |
74-
# Simple changelog generation
7589
echo "## Changes" > CHANGELOG.tmp
7690
git log --oneline --since="$(git describe --tags --abbrev=0 2>/dev/null || echo '1970-01-01')" >> CHANGELOG.tmp
7791

0 commit comments

Comments
 (0)