From 141f4edcdbb2e7f5ee253deb0f0bfc94a61be9e2 Mon Sep 17 00:00:00 2001 From: Roman Cattaneo <1116746+romanc@users.noreply.github.com> Date: Wed, 12 Feb 2025 09:45:53 +0100 Subject: [PATCH] Streamline linting workflow Linting should give fast feedback. The current workflow takes ~3mins where most of the time is spent installing (unnecessary) python packages. To run `pre-commit`, we only need the source files and `pre-commit`itself, which can be installed standalone. This brings runtime of the linting stage down to ~30 seconds. Other changes - update checkout action to v4 - update python setup action to v5 - change python version from 3.11.7 to 3.11 (any patch number will do) This is a follow-up of PR https://github.com/NOAA-GFDL/PyFV3/pull/40 in PyFV3. --- .github/workflows/lint.yaml | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index a450ac1b..ba5863f3 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -12,20 +12,17 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@v3.5.2 + uses: actions/checkout@v4 with: submodules: 'recursive' - - name: Step Python - uses: actions/setup-python@v4.6.0 + + - name: Setup Python 3.11 + uses: actions/setup-python@v5 with: - python-version: '3.11.7' - - name: Install OpenMPI for gt4py - run: | - sudo apt-get install libopenmpi-dev - - name: Install Python packages - run: | - python -m pip install --upgrade pip setuptools wheel - pip install .[develop] + python-version: '3.11' + + - name: Install pre-commit + run: pip install pre-commit + - name: Run lint via pre-commit - run: | - pre-commit run --all-files + run: pre-commit run --all-files