From abfa9011f7128a08c023267ac8ccf25044abea49 Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Thu, 18 Sep 2025 23:04:40 -0400 Subject: [PATCH] feat(ci): only run certain tests on change --- .github/workflows/ci.yml | 40 ++++++++++++++++++++++++++++++++++++++ .github/workflows/test.yml | 23 ++++++++++++++++++++++ 2 files changed, 63 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2a69753..02fadef 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,9 +7,37 @@ on: branches: [main] jobs: + changes: + runs-on: ubuntu-latest + outputs: + lua: ${{ steps.changes.outputs.lua }} + python: ${{ steps.changes.outputs.python }} + steps: + - uses: actions/checkout@v4 + - uses: dorny/paths-filter@v3 + id: changes + with: + filters: | + lua: + - 'lua/**' + - 'spec/**' + - 'plugin/**' + - 'after/**' + - 'ftdetect/**' + - '*.lua' + - '.luarc.json' + - 'stylua.toml' + - 'selene.toml' + python: + - 'scrapers/**' + - 'tests/scrapers/**' + - 'pyproject.toml' + - 'uv.lock' lua-format: name: Lua Formatting runs-on: ubuntu-latest + needs: changes + if: ${{ needs.changes.outputs.lua == 'true' }} steps: - uses: actions/checkout@v4 - uses: JohnnyMorganz/stylua-action@v4 @@ -21,6 +49,8 @@ jobs: lua-lint: name: Lua Linting runs-on: ubuntu-latest + needs: changes + if: ${{ needs.changes.outputs.lua == 'true' }} steps: - uses: actions/checkout@v4 - name: Lint with Selene @@ -32,6 +62,8 @@ jobs: lua-typecheck: name: Lua Type Checking runs-on: ubuntu-latest + needs: changes + if: ${{ needs.changes.outputs.lua == 'true' }} steps: - uses: actions/checkout@v4 - name: Run Lua LS Type Check @@ -44,6 +76,8 @@ jobs: python-format: name: Python Formatting runs-on: ubuntu-latest + needs: changes + if: ${{ needs.changes.outputs.python == 'true' }} steps: - uses: actions/checkout@v4 - name: Install uv @@ -56,6 +90,8 @@ jobs: python-lint: name: Python Linting runs-on: ubuntu-latest + needs: changes + if: ${{ needs.changes.outputs.python == 'true' }} steps: - uses: actions/checkout@v4 - name: Install uv @@ -68,6 +104,8 @@ jobs: python-typecheck: name: Python Type Checking runs-on: ubuntu-latest + needs: changes + if: ${{ needs.changes.outputs.python == 'true' }} steps: - uses: actions/checkout@v4 - name: Install uv @@ -80,6 +118,8 @@ jobs: 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 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b5c29ca..7929abc 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -6,9 +6,32 @@ on: - main jobs: + changes: + runs-on: ubuntu-latest + outputs: + lua: ${{ steps.changes.outputs.lua }} + steps: + - uses: actions/checkout@v4 + - uses: dorny/paths-filter@v3 + id: changes + with: + filters: | + lua: + - 'lua/**' + - 'spec/**' + - 'plugin/**' + - 'after/**' + - 'ftdetect/**' + - '*.lua' + - '.luarc.json' + - 'stylua.toml' + - 'selene.toml' + build: name: Run tests runs-on: ubuntu-latest + needs: changes + if: ${{ needs.changes.outputs.lua == 'true' }} strategy: matrix: neovim_version: ['nightly', 'stable']