feat(ci): reorganize

This commit is contained in:
Barrett Ruth 2025-09-18 23:33:13 -04:00
parent b00f06377f
commit 6a6b048c6b
5 changed files with 47 additions and 39 deletions

View file

@ -1,4 +1,4 @@
name: Push to Luarocks name: Release
on: on:
push: push:
@ -7,11 +7,12 @@ on:
workflow_dispatch: workflow_dispatch:
jobs: jobs:
luarocks-upload: publish-luarocks:
runs-on: ubuntu-22.04 name: Publish to LuaRocks
runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: LuaRocks Upload - name: Publish to LuaRocks
uses: nvim-neorocks/luarocks-tag-release@v7 uses: nvim-neorocks/luarocks-tag-release@v7
env: env:
LUAROCKS_API_KEY: ${{ secrets.LUAROCKS_API_KEY }} LUAROCKS_API_KEY: ${{ secrets.LUAROCKS_API_KEY }}

View file

@ -1,4 +1,4 @@
name: ci name: Code Quality
on: on:
pull_request: pull_request:
@ -33,8 +33,9 @@ jobs:
- 'tests/scrapers/**' - 'tests/scrapers/**'
- 'pyproject.toml' - 'pyproject.toml'
- 'uv.lock' - 'uv.lock'
lua-format: lua-format:
name: Lua Formatting name: Lua Format Check
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: changes needs: changes
if: ${{ needs.changes.outputs.lua == 'true' }} if: ${{ needs.changes.outputs.lua == 'true' }}
@ -47,7 +48,7 @@ jobs:
args: --check . args: --check .
lua-lint: lua-lint:
name: Lua Linting name: Lua Lint Check
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: changes needs: changes
if: ${{ needs.changes.outputs.lua == 'true' }} if: ${{ needs.changes.outputs.lua == 'true' }}
@ -60,7 +61,7 @@ jobs:
args: --display-style quiet . args: --display-style quiet .
lua-typecheck: lua-typecheck:
name: Lua Type Checking name: Lua Type Check
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: changes needs: changes
if: ${{ needs.changes.outputs.lua == 'true' }} if: ${{ needs.changes.outputs.lua == 'true' }}
@ -74,7 +75,7 @@ jobs:
configpath: .luarc.json configpath: .luarc.json
python-format: python-format:
name: Python Formatting name: Python Format Check
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: changes needs: changes
if: ${{ needs.changes.outputs.python == 'true' }} if: ${{ needs.changes.outputs.python == 'true' }}
@ -88,7 +89,7 @@ jobs:
run: ruff format --check scrapers/ tests/scrapers/ run: ruff format --check scrapers/ tests/scrapers/
python-lint: python-lint:
name: Python Linting name: Python Lint Check
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: changes needs: changes
if: ${{ needs.changes.outputs.python == 'true' }} if: ${{ needs.changes.outputs.python == 'true' }}
@ -102,7 +103,7 @@ jobs:
run: ruff check scrapers/ tests/scrapers/ run: ruff check scrapers/ tests/scrapers/
python-typecheck: python-typecheck:
name: Python Type Checking name: Python Type Check
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: changes needs: changes
if: ${{ needs.changes.outputs.python == 'true' }} if: ${{ needs.changes.outputs.python == 'true' }}
@ -114,17 +115,3 @@ jobs:
run: uv sync --dev run: uv sync --dev
- name: Type check Python files with mypy - name: Type check Python files with mypy
run: uv run mypy scrapers/ tests/scrapers/ run: uv run mypy scrapers/ tests/scrapers/
python-test:
name: Python Testing
runs-on: ubuntu-latest
needs: changes
if: ${{ needs.changes.outputs.python == 'true' }}
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v4
- name: Install dependencies with pytest
run: uv sync --dev
- name: Run Python tests
run: uv run pytest tests/scrapers/ -v

View file

@ -1,15 +1,17 @@
name: Run tests name: Tests
on: on:
pull_request: ~ pull_request:
branches: [main]
push: push:
branches: branches: [main]
- main
jobs: jobs:
changes: changes:
runs-on: ubuntu-latest runs-on: ubuntu-latest
outputs: outputs:
lua: ${{ steps.changes.outputs.lua }} lua: ${{ steps.changes.outputs.lua }}
python: ${{ steps.changes.outputs.python }}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: dorny/paths-filter@v3 - uses: dorny/paths-filter@v3
@ -26,19 +28,37 @@ jobs:
- '.luarc.json' - '.luarc.json'
- 'stylua.toml' - 'stylua.toml'
- 'selene.toml' - 'selene.toml'
python:
- 'scrapers/**'
- 'tests/scrapers/**'
- 'pyproject.toml'
- 'uv.lock'
build: lua-test:
name: Run tests name: Lua Tests (${{ matrix.neovim_version }})
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: changes needs: changes
if: ${{ needs.changes.outputs.lua == 'true' }} if: ${{ needs.changes.outputs.lua == 'true' }}
strategy: strategy:
matrix: matrix:
neovim_version: ['nightly', 'stable'] neovim_version: ['stable', 'nightly']
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Run tests - name: Run Lua tests
uses: nvim-neorocks/nvim-busted-action@v1 uses: nvim-neorocks/nvim-busted-action@v1
with: with:
nvim_version: ${{ matrix.neovim_version }} nvim_version: ${{ matrix.neovim_version }}
python-test:
name: Python Tests
runs-on: ubuntu-latest
needs: changes
if: ${{ needs.changes.outputs.python == 'true' }}
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v4
- name: Install dependencies with pytest
run: uv sync --dev
- name: Run Python tests
run: uv run pytest tests/scrapers/ -v

View file

@ -196,7 +196,7 @@ describe('cp.execute', function()
end) end)
it('handles execution timeouts', function() it('handles execution timeouts', function()
vim.system = function(cmd, opts) vim.system = function(_, opts)
if opts then if opts then
assert.is_not_nil(opts.timeout) assert.is_not_nil(opts.timeout)
end end
@ -290,7 +290,7 @@ describe('cp.execute', function()
end) end)
it('falls back to default language', function() it('falls back to default language', function()
vim.fn.fnamemodify = function(path, modifier) vim.fn.fnamemodify = function(_, modifier)
if modifier == ':e' then if modifier == ':e' then
return 'unknown' return 'unknown'
end end

View file

@ -166,7 +166,7 @@ describe('cp integration', function()
} }
temp_files['test.run'] = {} temp_files['test.run'] = {}
vim.system = function(cmd) vim.system = function()
return { return {
wait = function() wait = function()
return { code = 0, stdout = '3\n', stderr = '' } return { code = 0, stdout = '3\n', stderr = '' }
@ -462,7 +462,7 @@ describe('cp integration', function()
it('maintains responsiveness during operations', function() it('maintains responsiveness during operations', function()
local call_count = 0 local call_count = 0
vim.system = function(cmd) vim.system = function()
call_count = call_count + 1 call_count = call_count + 1
vim.wait(10) vim.wait(10)
return { return {