Skip to content

Commit

Permalink
Test tools only if they were modified
Browse files Browse the repository at this point in the history
Most of the time, we are not committing changes to the tools. Move the
unit tests for the lint and generation tools to a separate PR workflow,
that is only run if anything in the tools/ folder is modified in the PR.

This saves time in the normal case.
  • Loading branch information
ptomato committed Nov 5, 2024
1 parent 41a97f5 commit dd4e719
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 6 deletions.
6 changes: 0 additions & 6 deletions .github/workflows/checks-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ jobs:
python -m pip install --upgrade pip
pip install -r tools/lint/requirements.txt
- name: Test the lint tool
run: ./tools/lint/test/run.py

- name: Identify new or changed tests
id: changed_tests
uses: tj-actions/changed-files@v45
Expand Down Expand Up @@ -66,9 +63,6 @@ jobs:
python -m pip install --upgrade pip
pip install -r tools/generation/requirements.txt
- name: Test the generation tool
run: ./tools/generation/test/run.py

- name: Build tests
run: |
./make.py clean >/dev/null
Expand Down
49 changes: 49 additions & 0 deletions .github/workflows/test-tools.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Test tools

on:
pull_request:
files:
- 'tools/**'

jobs:
lint:
name: Test the lint tool
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
cache: pip

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r tools/lint/requirements.txt
- name: Test the lint tool
run: ./tools/lint/test/run.py

generation:
name: Test the generation tool
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
cache: pip

- name: Install dependencies for generation tool
run: |
python -m pip install --upgrade pip
pip install -r tools/generation/requirements.txt
- name: Test the generation tool
run: ./tools/generation/test/run.py

0 comments on commit dd4e719

Please sign in to comment.