From 9dedf52be9422873b911da6169b9fb6b702d4969 Mon Sep 17 00:00:00 2001 From: John Agapiou Date: Thu, 12 Sep 2024 08:22:42 -0700 Subject: [PATCH] Combine pytest, pylint, and pytype checks into one action PiperOrigin-RevId: 673856815 Change-Id: I47c77cab1bd04ec324efca94d9f3627fdb09699b --- .github/workflows/pylint-examples.yml | 47 ------------------------- .github/workflows/pylint-meltingpot.yml | 43 ---------------------- .github/workflows/pytype-examples.yml | 47 ------------------------- .github/workflows/pytype-meltingpot.yml | 43 ---------------------- .github/workflows/test-examples.yml | 10 +++++- .github/workflows/test-meltingpot.yml | 12 ++++++- 6 files changed, 20 insertions(+), 182 deletions(-) delete mode 100644 .github/workflows/pylint-examples.yml delete mode 100644 .github/workflows/pylint-meltingpot.yml delete mode 100644 .github/workflows/pytype-examples.yml delete mode 100644 .github/workflows/pytype-meltingpot.yml diff --git a/.github/workflows/pylint-examples.yml b/.github/workflows/pylint-examples.yml deleted file mode 100644 index 51f4ec26..00000000 --- a/.github/workflows/pylint-examples.yml +++ /dev/null @@ -1,47 +0,0 @@ -name: pylint-examples - -on: - push: - branches: - - main - paths: - - '.github/actions/install-examples/action.yml' - - '.github/actions/install-meltingpot/action.yml' - - '.github/workflows/pylint-examples.yml' - - '.pylintrc' - - 'examples/**' - - 'meltingpot/**' - - 'setup.py' - pull_request: - branches: - - main - paths: - - '.github/actions/install-examples/action.yml' - - '.github/actions/install-meltingpot/action.yml' - - '.github/workflows/pylint-examples.yml' - - '.pylintrc' - - 'examples/**' - - 'meltingpot/**' - - 'setup.py' - workflow_dispatch: - -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} - cancel-in-progress: true - -permissions: read-all - -jobs: - pylint: - name: Lint examples - runs-on: ubuntu-latest - timeout-minutes: 5 - steps: - - name: Checkout Melting Pot - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 - - - name: Install examples - uses: ./.github/actions/install-examples - - - name: Run PyLint on examples - run: pylint --errors-only examples diff --git a/.github/workflows/pylint-meltingpot.yml b/.github/workflows/pylint-meltingpot.yml deleted file mode 100644 index b25ef0de..00000000 --- a/.github/workflows/pylint-meltingpot.yml +++ /dev/null @@ -1,43 +0,0 @@ -name: pylint-meltingpot - -on: - push: - branches: - - main - paths: - - '.github/actions/install-meltingpot/action.yml' - - '.github/workflows/pylint-meltingpot.yml' - - '.pylintrc' - - 'meltingpot/**' - - 'setup.py' - pull_request: - branches: - - main - paths: - - '.github/actions/install-meltingpot/action.yml' - - '.github/workflows/pylint-meltingpot.yml' - - '.pylintrc' - - 'meltingpot/**' - - 'setup.py' - workflow_dispatch: - -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} - cancel-in-progress: true - -permissions: read-all - -jobs: - pylint: - name: Lint Melting Pot - runs-on: ubuntu-latest - timeout-minutes: 30 - steps: - - name: Checkout Melting Pot - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 - - - name: Install Melting Pot - uses: ./.github/actions/install-meltingpot - - - name: Run PyLint on Melting Pot - run: pylint --errors-only meltingpot diff --git a/.github/workflows/pytype-examples.yml b/.github/workflows/pytype-examples.yml deleted file mode 100644 index 6603f3b7..00000000 --- a/.github/workflows/pytype-examples.yml +++ /dev/null @@ -1,47 +0,0 @@ -name: pytype-examples - -on: - push: - branches: - - main - paths: - - '.github/actions/install-examples/action.yml' - - '.github/actions/install-meltingpot/action.yml' - - '.github/workflows/pytype-examples.yml' - - 'examples/**' - - 'meltingpot/**' - - 'pyproject.toml' - - 'setup.py' - pull_request: - branches: - - main - paths: - - '.github/actions/install-examples/action.yml' - - '.github/actions/install-meltingpot/action.yml' - - '.github/workflows/pytype-examples.yml' - - 'examples/**' - - 'meltingpot/**' - - 'pyproject.toml' - - 'setup.py' - workflow_dispatch: - -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} - cancel-in-progress: true - -permissions: read-all - -jobs: - pytype: - name: Typecheck examples - runs-on: ubuntu-latest - timeout-minutes: 30 - steps: - - name: Checkout Melting Pot - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 - - - name: Install examples - uses: ./.github/actions/install-examples - - - name: Run PyType on examples - run: pytype examples diff --git a/.github/workflows/pytype-meltingpot.yml b/.github/workflows/pytype-meltingpot.yml deleted file mode 100644 index ccc45302..00000000 --- a/.github/workflows/pytype-meltingpot.yml +++ /dev/null @@ -1,43 +0,0 @@ -name: pytype-meltingpot - -on: - push: - branches: - - main - paths: - - '.github/actions/install-meltingpot/action.yml' - - '.github/workflows/pytype-meltingpot.yml' - - 'meltingpot/**' - - 'pyproject.toml' - - 'setup.py' - pull_request: - branches: - - main - paths: - - '.github/actions/install-meltingpot/action.yml' - - '.github/workflows/pytype-meltingpot.yml' - - 'meltingpot/**' - - 'pyproject.toml' - - 'setup.py' - workflow_dispatch: - -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} - cancel-in-progress: true - -permissions: read-all - -jobs: - pytype: - name: Typecheck Melting Pot - runs-on: ubuntu-latest - timeout-minutes: 30 - steps: - - name: Checkout Melting Pot - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 - - - name: Install Melting Pot - uses: ./.github/actions/install-meltingpot - - - name: Run PyType on Melting Pot - run: pytype meltingpot diff --git a/.github/workflows/test-examples.yml b/.github/workflows/test-examples.yml index c691a30e..c1d98430 100644 --- a/.github/workflows/test-examples.yml +++ b/.github/workflows/test-examples.yml @@ -8,6 +8,7 @@ on: - '.github/actions/install-examples/action.yml' - '.github/actions/install-meltingpot/action.yml' - '.github/workflows/test-examples.yml' + - '.pylintrc' - 'examples/**' - 'meltingpot/**' - 'pyproject.toml' @@ -19,6 +20,7 @@ on: - '.github/actions/install-examples.yml' - '.github/actions/install-meltingpot.yml' - '.github/workflows/test-examples.yml' + - '.pylintrc' - 'examples/**' - 'meltingpot/**' - 'pyproject.toml' @@ -32,7 +34,7 @@ concurrency: permissions: read-all jobs: - pytest: + test-examples: name: Test examples runs-on: ubuntu-latest timeout-minutes: 90 @@ -45,3 +47,9 @@ jobs: - name: Test examples run: pytest examples + + - name: Lint examples + run: pylint --errors-only examples + + - name: Typecheck examples + run: pytype examples diff --git a/.github/workflows/test-meltingpot.yml b/.github/workflows/test-meltingpot.yml index 2e74cacb..02f98d70 100644 --- a/.github/workflows/test-meltingpot.yml +++ b/.github/workflows/test-meltingpot.yml @@ -7,6 +7,7 @@ on: paths: - '.github/actions/install-meltingpot/action.yml' - '.github/workflows/test-meltingpot.yml' + - '.pylintrc' - 'meltingpot/**' - 'pyproject.toml' - 'setup.py' @@ -16,6 +17,7 @@ on: paths: - '.github/actions/install-meltingpot/action.yml' - '.github/workflows/test-meltingpot.yml' + - '.pylintrc' - 'meltingpot/**' - 'pyproject.toml' - 'setup.py' @@ -28,7 +30,7 @@ concurrency: permissions: read-all jobs: - pytest: + test-meltingpot: name: Test Melting Pot runs-on: ${{ matrix.os }} env: @@ -45,9 +47,17 @@ jobs: steps: - name: Checkout Melting Pot uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 + - name: Install Melting Pot uses: ./.github/actions/install-meltingpot with: python-version: ${{ matrix.python-version }} + - name: Test Melting Pot run: pytest meltingpot + + - name: Lint Melting Pot + run: pylint --errors-only meltingpot + + - name: Typecheck Melting Pot + run: pytype meltingpot