ci: only test packages with changed files on PRs (#41)
* ci: only test packages with changed files on PRs * ci: add pull-requests read permission for paths-filter
This commit is contained in:
parent
919a673be2
commit
2ff9431656
1 changed files with 41 additions and 2 deletions
43
.github/workflows/ci.yml
vendored
43
.github/workflows/ci.yml
vendored
|
|
@ -23,7 +23,36 @@ jobs:
|
|||
- run: uv sync --all-packages
|
||||
- uses: j178/prek-action@v2
|
||||
|
||||
changes:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: read
|
||||
outputs:
|
||||
packages: ${{ steps.filter.outputs.changes }}
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: dorny/paths-filter@v3
|
||||
id: filter
|
||||
with:
|
||||
filters: |
|
||||
codeflash-core:
|
||||
- 'packages/codeflash-core/**'
|
||||
codeflash-python:
|
||||
- 'packages/codeflash-core/**'
|
||||
- 'packages/codeflash-python/**'
|
||||
codeflash-api:
|
||||
- 'packages/codeflash-api/**'
|
||||
blackbox:
|
||||
- 'packages/blackbox/**'
|
||||
github-app:
|
||||
- 'packages/github-app/**'
|
||||
|
||||
test:
|
||||
needs: changes
|
||||
if: >-
|
||||
github.event_name == 'push'
|
||||
|| needs.changes.outputs.packages != '[]'
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
|
|
@ -34,8 +63,18 @@ jobs:
|
|||
python-version: "3.12"
|
||||
enable-cache: true
|
||||
- run: uv sync --all-packages
|
||||
- name: Test
|
||||
run: uv run pytest packages/ -v
|
||||
- name: Test changed packages
|
||||
run: |
|
||||
if [ "${{ github.event_name }}" = "push" ]; then
|
||||
uv run pytest packages/ -v
|
||||
else
|
||||
CHANGED='${{ needs.changes.outputs.packages }}'
|
||||
for pkg in $(echo "$CHANGED" | jq -r '.[]'); do
|
||||
echo "::group::Testing $pkg"
|
||||
uv run pytest "packages/$pkg" -v
|
||||
echo "::endgroup::"
|
||||
done
|
||||
fi
|
||||
env:
|
||||
CI: "true"
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue