@@ -2,81 +2,75 @@ name: CI
22
33on :
44 push :
5- branches : [ main ]
5+ branches : [main, develop ]
66 pull_request :
7- branches : [ main ]
7+ branches : [main]
88
99jobs :
1010 test :
1111 runs-on : ubuntu-latest
1212 strategy :
1313 matrix :
14- python-version : [3.8, 3.9, '3.10', '3.11']
15- neovim-version : ['stable', 'nightly']
14+ nvim-version : ["stable", "nightly"]
1615
1716 steps :
18- - uses : actions/checkout@v3
17+ - uses : actions/checkout@v3
1918
20- - name : Set up Python ${{ matrix.python-version }}
21- uses : actions /setup-python@v4
22- with :
23- python- version : ${{ matrix.python -version }}
19+ - name : Setup Neovim
20+ uses : rhymond /setup-neovim@v1
21+ with :
22+ version : ${{ matrix.nvim -version }}
2423
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
24+ - name : Setup Python
25+ uses : actions/setup-python@v4
26+ with :
27+ python-version : " 3.x"
3128
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
29+ - name : Install sqlparse
30+ run : pip install sqlparse
4131
42- - name : Check VimScript syntax
43- run : |
44- vint plugin/
45- vint autoload/
32+ - name : Install Lua dependencies
33+ run : |
34+ sudo apt-get update
35+ sudo apt-get install -y luarocks
36+ sudo luarocks install luacheck
4637
47- - name : Run Python tests
48- run : |
49- python -m unittest discover -s tests
38+ - name : Run luacheck
39+ run : luacheck lua/ --globals vim
5040
51- - name : Check for Python syntax errors
52- run : |
53- python -m py_compile python/*.py
41+ - name : Check plugin loads
42+ run : |
43+ nvim --headless -c "lua require('sql-formatter')" -c "qa!"
5444
55- - name : Check for Python type hints
56- run : |
57- pip install mypy
58- mypy python/*.py
45+ - name : Test external formatter
46+ run : |
47+ echo "SELECT * FROM users WHERE active=1;" | sqlformat --reindent --keywords upper --identifiers lower -
5948
60- lint :
49+ release :
50+ needs : test
6151 runs-on : ubuntu-latest
62- steps :
63- - uses : actions/checkout@v3
64-
65- - name : Set up Python
66- uses : actions/setup-python@v4
67- with :
68- python-version : ' 3.11'
52+ if : github.ref == 'refs/heads/main' && github.event_name == 'push'
6953
70- - name : Install dependencies
71- run : |
72- python -m pip install --upgrade pip
73- pip install flake8
74- pip install black
54+ steps :
55+ - uses : actions/checkout@v3
56+ with :
57+ fetch-depth : 0
7558
76- - name : Run flake8
77- run : |
78- flake8 python/ --count --select=E9,F63,F7,F82 --show-source --statistics
59+ - name : Generate changelog
60+ id : changelog
61+ run : |
62+ # Simple changelog generation
63+ echo "## Changes" > CHANGELOG.tmp
64+ git log --oneline --since="$(git describe --tags --abbrev=0 2>/dev/null || echo '1970-01-01')" >> CHANGELOG.tmp
7965
80- - name : Run black
81- run : |
82- black --check python/
66+ - name : Create Release
67+ uses : actions/create-release@v1
68+ if : contains(github.event.head_commit.message, '[release]')
69+ env :
70+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
71+ with :
72+ tag_name : v${{ github.run_number }}
73+ release_name : Release v${{ github.run_number }}
74+ body_path : CHANGELOG.tmp
75+ draft : false
76+ prerelease : false
0 commit comments