Skip to content

Commit 99d7794

Browse files
committed
fix: add test sql file for ci
1 parent 87331b7 commit 99d7794

File tree

3 files changed

+52
-77
lines changed

3 files changed

+52
-77
lines changed

.github/FUNDING.yml

Lines changed: 0 additions & 11 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 51 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,82 +1,68 @@
11
name: CI
2-
32
on:
43
push:
5-
branches: [ main ]
4+
branches: [main]
65
pull_request:
7-
branches: [ main ]
6+
branches: [main]
87

98
jobs:
109
test:
1110
runs-on: ubuntu-latest
12-
strategy:
13-
matrix:
14-
python-version: [3.8, 3.9, '3.10', '3.11']
15-
neovim-version: ['stable', 'nightly']
16-
1711
steps:
18-
- uses: actions/checkout@v3
19-
20-
- name: Set up Python ${{ matrix.python-version }}
21-
uses: actions/setup-python@v4
22-
with:
23-
python-version: ${{ matrix.python-version }}
24-
25-
- name: Install Python dependencies
26-
run: |
27-
python -m pip install --upgrade pip
28-
pip install sqlparse
29-
pip install vim-vint
30-
pip install pynvim
12+
# Check out the repository code
13+
- name: Checkout code
14+
uses: actions/checkout@v4
3115

32-
- name: Install Neovim
33-
run: |
34-
if [ "${{ matrix.neovim-version }}" = "stable" ]; then
35-
sudo add-apt-repository -y ppa:neovim-ppa/stable
36-
else
37-
sudo add-apt-repository -y ppa:neovim-ppa/unstable
38-
fi
39-
sudo apt-get update
40-
sudo apt-get install -y neovim
16+
# Set up Python environment
17+
- name: Set up Python
18+
uses: actions/setup-python@v5
19+
with:
20+
python-version: '3.x'
4121

42-
- name: Check VimScript syntax
43-
run: |
44-
vint plugin/
45-
vint autoload/
22+
# Install sqlparse
23+
- name: Install sqlparse
24+
run: pip install sqlparse
4625

47-
- name: Run Python tests
48-
run: |
49-
python -m unittest discover -s tests
26+
# Install Neovim with Python3 support
27+
- name: Install Neovim
28+
run: |
29+
sudo apt-get update
30+
sudo apt-get install -y software-properties-common
31+
sudo add-apt-repository ppa:neovim-ppa/stable
32+
sudo apt-get update
33+
sudo apt-get install -y neovim
5034
51-
- name: Check for Python syntax errors
52-
run: |
53-
python -m py_compile python/*.py
54-
55-
- name: Check for Python type hints
56-
run: |
57-
pip install mypy
58-
mypy python/*.py
59-
60-
lint:
61-
runs-on: ubuntu-latest
62-
steps:
63-
- uses: actions/checkout@v3
35+
# Verify Python3 support in Neovim
36+
- name: Check Neovim Python3 support
37+
run: nvim --headless -c "echo has('python3')" -c "q"
38+
continue-on-error: false
6439

65-
- name: Set up Python
66-
uses: actions/setup-python@v4
67-
with:
68-
python-version: '3.11'
40+
# Create a test SQL file
41+
- name: Create test SQL file
42+
run: |
43+
mkdir -p test
44+
echo "select id,name from users where age>18 order by name" > test/test.sql
6945
70-
- name: Install dependencies
71-
run: |
72-
python -m pip install --upgrade pip
73-
pip install flake8
74-
pip install black
46+
# Test plugin loading
47+
- name: Test plugin loading
48+
run: nvim --headless -c "source plugin/sqlformat.vim" -c "q"
49+
env:
50+
PYTHONPATH: ${{ github.workspace }}/python
7551

76-
- name: Run flake8
77-
run: |
78-
flake8 python/ --count --select=E9,F63,F7,F82 --show-source --statistics
52+
# Test SQL formatting
53+
- name: Test SQL formatting
54+
run: |
55+
export PYTHONPATH=${{ github.workspace }}/python
56+
nvim --headless -c "edit test/test.sql" -c "SQLFormat" -c "w! test/output.sql" -c "q"
57+
cat test/output.sql
58+
env:
59+
PYTHONPATH: ${{ github.workspace }}/python
7960

80-
- name: Run black
81-
run: |
82-
black --check python/
61+
# Verify formatted output
62+
- name: Verify formatted output
63+
run: |
64+
cat test/output.sql
65+
grep -q "SELECT id, name" test/output.sql
66+
grep -q "FROM users" test/output.sql
67+
grep -q "WHERE age > 18" test/output.sql
68+
grep -q "ORDER BY name" test/output.sql

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ let g:sqlformat_keyword_case = 'lower'
6666

6767
## License
6868

69-
This project is licensed under the MIT License - see the LICENSE file for details.
69+
This project is licensed under the MIT License - see the [LICENSE](https://github.com/andevgo/nvim-sqlformat/blob/main/LICENSE) file for details.
7070

7171
## Contributing
7272

0 commit comments

Comments
 (0)