Skip to content

Commit

Permalink
Add python linting workflow (#2333)
Browse files Browse the repository at this point in the history
* add python linting workflow to orchestration

* revert orchestration

* test rl

* [pre-commit.ci] auto fixes from pre-commit hooks

* test rl part 2

* give the workflow one more shot

* add workflows to all python containers

* revert orchestration back

* remove print statement

* [pre-commit.ci] auto fixes from pre-commit hooks

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
m-goggins and pre-commit-ci[bot] authored Aug 9, 2024
1 parent 75a876e commit 87f98af
Show file tree
Hide file tree
Showing 10 changed files with 58 additions and 157 deletions.
26 changes: 3 additions & 23 deletions .github/workflows/container-dibbs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,29 +26,9 @@ env:

jobs:
python-linting:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup python ${{env.TEST_RUNNER_PYTHON_VERSION}}
uses: actions/setup-python@v5
with:
python-version: ${{env.TEST_RUNNER_PYTHON_VERSION}}
cache: pip

- name: Install dependencies
run: |
pip install -U pip
pip install ruff==0.4.3
- name: Run linter (ruff)
run: |
ruff check --output-format=github .
- name: Run formatter (ruff)
run: |
ruff format --check
uses: ./.github/workflows/linting-python.yaml
with:
python_runner_version: 3.11 # must be hardcoded; cannot pass in from env

unit-test-python-containers:
runs-on: ubuntu-latest
Expand Down
23 changes: 4 additions & 19 deletions .github/workflows/container-fhir-converter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,10 @@ env:

jobs:
python-linting:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup python ${{env.TEST_RUNNER_PYTHON_VERSION}}
uses: actions/setup-python@v5
with:
python-version: ${{env.TEST_RUNNER_PYTHON_VERSION}}
cache: pip
- name: Install dependencies
run: |
pip install -U pip
pip install ruff==0.4.3
- name: Run linter (ruff)
run: |
ruff check --output-format=github .
- name: Run formatter (ruff)
run: |
ruff format --check
uses: ./.github/workflows/linting-python.yaml
with:
python_runner_version: 3.11 # must be hardcoded; cannot pass in from env

unit-test-python-containers:
runs-on: ubuntu-latest
steps:
Expand Down
23 changes: 4 additions & 19 deletions .github/workflows/container-ingestion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,25 +27,10 @@ env:

jobs:
python-linting:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup python ${{env.TEST_RUNNER_PYTHON_VERSION}}
uses: actions/setup-python@v5
with:
python-version: ${{env.TEST_RUNNER_PYTHON_VERSION}}
cache: pip
- name: Install dependencies
run: |
pip install -U pip
pip install ruff==0.4.3
- name: Run linter (ruff)
run: |
ruff check --output-format=github .
- name: Run formatter (ruff)
run: |
ruff format --check
uses: ./.github/workflows/linting-python.yaml
with:
python_runner_version: 3.11 # must be hardcoded; cannot pass in from env

unit-test-python-containers:
runs-on: ubuntu-latest
steps:
Expand Down
22 changes: 3 additions & 19 deletions .github/workflows/container-message-parser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,25 +27,9 @@ env:

jobs:
python-linting:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup python ${{env.TEST_RUNNER_PYTHON_VERSION}}
uses: actions/setup-python@v5
with:
python-version: ${{env.TEST_RUNNER_PYTHON_VERSION}}
cache: pip
- name: Install dependencies
run: |
pip install -U pip
pip install ruff==0.4.3
- name: Run linter (ruff)
run: |
ruff check --output-format=github .
- name: Run formatter (ruff)
run: |
ruff format --check
uses: ./.github/workflows/linting-python.yaml
with:
python_runner_version: 3.11 # must be hardcoded; cannot pass in from env
unit-test-python-containers:
runs-on: ubuntu-latest
steps:
Expand Down
22 changes: 3 additions & 19 deletions .github/workflows/container-message-refiner.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,25 +27,9 @@ env:

jobs:
python-linting:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup python ${{env.TEST_RUNNER_PYTHON_VERSION}}
uses: actions/setup-python@v5
with:
python-version: ${{env.TEST_RUNNER_PYTHON_VERSION}}
cache: pip
- name: Install dependencies
run: |
pip install -U pip
pip install ruff==0.4.3
- name: Run linter (ruff)
run: |
ruff check --output-format=github .
- name: Run formatter (ruff)
run: |
ruff format --check
uses: ./.github/workflows/linting-python.yaml
with:
python_runner_version: 3.11 # must be hardcoded; cannot pass in from env
unit-test-python-containers:
runs-on: ubuntu-latest
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/container-orchestration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ env:
CONTAINER: orchestration

jobs:
orchestration-python-linting:
orchestration-python-linting: # This job is the same as the python-linting job in linting-python.yaml but does not run if using linting-python.yaml
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand Down
22 changes: 3 additions & 19 deletions .github/workflows/container-record-linkage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,25 +27,9 @@ env:

jobs:
python-linting:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup python ${{env.TEST_RUNNER_PYTHON_VERSION}}
uses: actions/setup-python@v5
with:
python-version: ${{env.TEST_RUNNER_PYTHON_VERSION}}
cache: pip
- name: Install dependencies
run: |
pip install -U pip
pip install ruff==0.4.3
- name: Run linter (ruff)
run: |
ruff check --output-format=github .
- name: Run formatter (ruff)
run: |
ruff format --check
uses: ./.github/workflows/linting-python.yaml
with:
python_runner_version: 3.11 # must be hardcoded; cannot pass in from env
unit-test-python-containers:
runs-on: ubuntu-latest
services:
Expand Down
22 changes: 3 additions & 19 deletions .github/workflows/container-trigger-code-reference.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,25 +27,9 @@ env:

jobs:
python-linting:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup python ${{env.TEST_RUNNER_PYTHON_VERSION}}
uses: actions/setup-python@v5
with:
python-version: ${{env.TEST_RUNNER_PYTHON_VERSION}}
cache: pip
- name: Install dependencies
run: |
pip install -U pip
pip install ruff==0.4.3
- name: Run linter (ruff)
run: |
ruff check --output-format=github .
- name: Run formatter (ruff)
run: |
ruff format --check
uses: ./.github/workflows/linting-python.yaml
with:
python_runner_version: 3.11 # must be hardcoded; cannot pass in from env
unit-test-python-containers:
runs-on: ubuntu-latest
steps:
Expand Down
22 changes: 3 additions & 19 deletions .github/workflows/container-validation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,25 +27,9 @@ env:

jobs:
python-linting:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup python ${{env.TEST_RUNNER_PYTHON_VERSION}}
uses: actions/setup-python@v5
with:
python-version: ${{env.TEST_RUNNER_PYTHON_VERSION}}
cache: pip
- name: Install dependencies
run: |
pip install -U pip
pip install ruff==0.4.3
- name: Run linter (ruff)
run: |
ruff check --output-format=github .
- name: Run formatter (ruff)
run: |
ruff format --check
uses: ./.github/workflows/linting-python.yaml
with:
python_runner_version: 3.11 # must be hardcoded; cannot pass in from env
unit-test-python-containers:
runs-on: ubuntu-latest
steps:
Expand Down
31 changes: 31 additions & 0 deletions .github/workflows/linting-python.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Python Linting

on:
workflow_call:
inputs:
python_runner_version:
default: 3.11
required: true
type: number

jobs:
python-linting:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup python ${{inputs.python_runner_version}}
uses: actions/setup-python@v5
with:
python-version: ${{inputs.python_runner_version}}
cache: pip
- name: Install dependencies
run: |
pip install -U pip
pip install ruff==0.4.3
- name: Run linter (ruff)
run: |
ruff check --output-format=github .
- name: Run formatter (ruff)
run: |
ruff format --check

0 comments on commit 87f98af

Please sign in to comment.