Skip to content

fix: add test sql file for ci #3

fix: add test sql file for ci

fix: add test sql file for ci #3

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
steps:
# Check out the repository code
- name: Checkout code
uses: actions/checkout@v4
# Set up Python environment
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
# Install sqlparse
- name: Install sqlparse
run: pip install sqlparse
# Install Neovim with Python3 support
- name: Install Neovim
run: |
sudo apt-get update
sudo apt-get install -y software-properties-common
sudo add-apt-repository ppa:neovim-ppa/stable
sudo apt-get update
sudo apt-get install -y neovim
# Verify Python3 support in Neovim
- name: Check Neovim Python3 support
run: nvim --headless -c "echo has('python3')" -c "q"
continue-on-error: false
# Create a test SQL file
- name: Create test SQL file
run: |
mkdir -p test
echo "select id,name from users where age>18 order by name" > test/test.sql
# Test plugin loading
- name: Test plugin loading
run: nvim --headless -c "source plugin/sqlformat.vim" -c "q"
env:
PYTHONPATH: ${{ github.workspace }}/python
# Test SQL formatting
- name: Test SQL formatting
run: |
export PYTHONPATH=${{ github.workspace }}/python
nvim --headless -c "edit test/test.sql" -c "SQLFormat" -c "w! test/output.sql" -c "q"
cat test/output.sql
env:
PYTHONPATH: ${{ github.workspace }}/python
# Verify formatted output
- name: Verify formatted output
run: |
cat test/output.sql
grep -q "SELECT id, name" test/output.sql
grep -q "FROM users" test/output.sql
grep -q "WHERE age > 18" test/output.sql
grep -q "ORDER BY name" test/output.sql