From 7f4aa49ccd3e24fc4d07fbb03b2ba1fa2e2600a4 Mon Sep 17 00:00:00 2001 From: Philip Chimento Date: Mon, 4 Nov 2024 17:51:07 -0800 Subject: [PATCH] Test tools only if they were modified 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. --- .github/workflows/checks-main.yml | 6 ---- .github/workflows/checks-pr.yml | 6 ---- .github/workflows/test-tools.yml | 52 +++++++++++++++++++++++++++++++ 3 files changed, 52 insertions(+), 12 deletions(-) create mode 100644 .github/workflows/test-tools.yml diff --git a/.github/workflows/checks-main.yml b/.github/workflows/checks-main.yml index 0ceb0f00057..b70395fd7a2 100644 --- a/.github/workflows/checks-main.yml +++ b/.github/workflows/checks-main.yml @@ -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: Lint all tests run: ./tools/lint/lint.py test/ @@ -45,9 +42,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 diff --git a/.github/workflows/checks-pr.yml b/.github/workflows/checks-pr.yml index 6aad09dc75c..cab110e8d7d 100644 --- a/.github/workflows/checks-pr.yml +++ b/.github/workflows/checks-pr.yml @@ -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 @@ -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 diff --git a/.github/workflows/test-tools.yml b/.github/workflows/test-tools.yml new file mode 100644 index 00000000000..750310b785c --- /dev/null +++ b/.github/workflows/test-tools.yml @@ -0,0 +1,52 @@ +name: Test tools + +on: + push: + files: + - 'tools/**' + 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