feat(git): add optional stock Vim git workflow #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: Vimrc Smoke Test | |
| on: | |
| push: | |
| pull_request: | |
| jobs: | |
| source-vimrc: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| - name: Show Vim version | |
| run: vim --version | head -20 | |
| - name: Source vimrc | |
| run: | | |
| mkdir -p build-temp | |
| HOME="$PWD/build-temp/vim-source-test" \ | |
| vim -Nu NONE -n -es \ | |
| -c "source .vimrc" \ | |
| -c "autocmd! Session" \ | |
| -c "qa!" | |
| - name: Prepare smoke scripts | |
| run: | | |
| mkdir -p build-temp | |
| cat > build-temp/check-relative-number.vim <<'VIM' | |
| set nomore | |
| if &relativenumber | |
| cquit | |
| endif | |
| call feedkeys("\<Space>rn", 'xt') | |
| if !&relativenumber | |
| cquit | |
| endif | |
| autocmd! Session | |
| qa! | |
| VIM | |
| cat > build-temp/check-netrw-toggle.vim <<'VIM' | |
| set nomore | |
| edit README.md | |
| call feedkeys("\<Space>e", 'xt') | |
| if winnr('$') < 2 | |
| cquit | |
| endif | |
| let s:filetypes = map(range(1, winnr('$')), 'getbufvar(winbufnr(v:val), "&filetype")') | |
| if index(s:filetypes, 'netrw') < 0 | |
| cquit | |
| endif | |
| edit CHANGELOG.md | |
| call feedkeys("\<Space>e", 'xt') | |
| if winnr('$') != 1 | |
| cquit | |
| endif | |
| autocmd! Session | |
| qa! | |
| VIM | |
| cat > build-temp/check-session.vim <<'VIM' | |
| set nomore | |
| edit README.md | |
| call feedkeys("\<Space>ss", 'xt') | |
| let s:session_files = glob(expand('~/.vim/sessions/*.vim')) . glob(expand('~/vimfiles/sessions/*.vim')) | |
| if empty(s:session_files) | |
| cquit | |
| endif | |
| bwipeout! | |
| call feedkeys("\<Space>sr", 'xt') | |
| if bufnr('README.md') < 0 | |
| cquit | |
| endif | |
| autocmd! Session | |
| qa! | |
| VIM | |
| cat > build-temp/check-health.vim <<'VIM' | |
| set nomore | |
| CorporateSafeHealth | |
| if bufname('%') !=# 'Corporate-Safe-Vim-Health' | |
| cquit | |
| endif | |
| if search('External tools required: no', 'n') == 0 | |
| cquit | |
| endif | |
| if search('Auto sessions requested: yes', 'n') == 0 | |
| cquit | |
| endif | |
| if search('Auto sessions effective: yes', 'n') == 0 | |
| cquit | |
| endif | |
| if search('Deep :find path: yes', 'n') == 0 | |
| cquit | |
| endif | |
| if search('Default search glob: \*\*/\*', 'n') == 0 | |
| cquit | |
| endif | |
| if search('<Space>cd', 'n') == 0 | |
| cquit | |
| endif | |
| bwipeout! | |
| let g:corporate_safe_auto_sessions = 0 | |
| CorporateSafeHealth | |
| if search('Auto sessions requested: no', 'n') == 0 | |
| cquit | |
| endif | |
| if search('Auto sessions effective: no', 'n') == 0 | |
| cquit | |
| endif | |
| autocmd! Session | |
| qa! | |
| VIM | |
| cat > build-temp/check-git-workflow.vim <<'VIM' | |
| set nomore | |
| CorporateSafeGitStatus | |
| if bufname('%') !=# 'Corporate-Safe-Git-Status' | |
| cquit | |
| endif | |
| if search('Repository:', 'n') == 0 | |
| cquit | |
| endif | |
| if search('Exit: 0', 'n') == 0 | |
| cquit | |
| endif | |
| if search('^##', 'n') == 0 | |
| cquit | |
| endif | |
| bwipeout! | |
| CorporateSafeGitLog | |
| if bufname('%') !=# 'Corporate-Safe-Git-Log' | |
| cquit | |
| endif | |
| if search('Exit: 0', 'n') == 0 | |
| cquit | |
| endif | |
| autocmd! Session | |
| qa! | |
| VIM | |
| cat > build-temp/check-optouts.vim <<'VIM' | |
| set nomore | |
| CorporateSafeHealth | |
| if search('Auto sessions requested: no', 'n') == 0 | |
| cquit | |
| endif | |
| if search('Auto sessions effective: no', 'n') == 0 | |
| cquit | |
| endif | |
| if search('Deep :find path: no', 'n') == 0 | |
| cquit | |
| endif | |
| if search('Default search glob: src/\*\*/\*', 'n') == 0 | |
| cquit | |
| endif | |
| if search('Local state writes: disabled', 'n') == 0 | |
| cquit | |
| endif | |
| if search('Vim info file: disabled', 'n') == 0 | |
| cquit | |
| endif | |
| if &backup || &writebackup || &swapfile || &undofile | |
| cquit | |
| endif | |
| if exists('&viminfo') && !empty(&viminfo) | |
| cquit | |
| endif | |
| if exists('&shada') && !empty(&shada) | |
| cquit | |
| endif | |
| if isdirectory(expand('~/.vim')) || isdirectory(expand('~/vimfiles')) | |
| cquit | |
| endif | |
| autocmd! Session | |
| qa! | |
| VIM | |
| - name: Check relative-number toggle | |
| run: | | |
| HOME="$PWD/build-temp/vim-relative-number-test" \ | |
| vim -Nu "$PWD/.vimrc" -n -es -i NONE \ | |
| -S build-temp/check-relative-number.vim | |
| - name: Check netrw sidebar toggle | |
| run: | | |
| HOME="$PWD/build-temp/vim-netrw-test" \ | |
| vim -Nu "$PWD/.vimrc" -n -es -i NONE \ | |
| -S build-temp/check-netrw-toggle.vim | |
| - name: Check session save and restore | |
| run: | | |
| HOME="$PWD/build-temp/vim-session-test" \ | |
| vim -Nu "$PWD/.vimrc" -n -es -i NONE \ | |
| -S build-temp/check-session.vim | |
| - name: Check health command and auto-session toggle | |
| run: | | |
| HOME="$PWD/build-temp/vim-health-test" \ | |
| vim -Nu "$PWD/.vimrc" -n -es -i NONE \ | |
| -S build-temp/check-health.vim | |
| - name: Check optional git workflow | |
| run: | | |
| HOME="$PWD/build-temp/vim-git-test" \ | |
| vim -Nu "$PWD/.vimrc" -n -es -i NONE \ | |
| -S build-temp/check-git-workflow.vim | |
| - name: Check policy opt-outs | |
| run: | | |
| HOME="$PWD/build-temp/vim-optout-test" \ | |
| vim \ | |
| --cmd "let g:corporate_safe_auto_sessions = 0" \ | |
| --cmd "let g:corporate_safe_deep_find = 0" \ | |
| --cmd "let g:corporate_safe_search_glob = 'src/**/*'" \ | |
| --cmd "let g:corporate_safe_no_local_state = 1" \ | |
| -Nu "$PWD/.vimrc" -n -es -i NONE \ | |
| -S build-temp/check-optouts.vim |