File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -14,13 +14,16 @@ This workflow runs ``ruff check`` on the project with ``UV``.
1414
1515** Inputs:**
1616
17- - `` runner-label `` (optional): runner to use - default: to "eng-tools"
17+ - `` runner-label `` (optional): runner to use
18+ - default: to "eng-tools"
19+ - `` ruff-commands `` (optional): commands to run with ruff
20+ - default: `` ruff check ``
1821
1922** Outputs:** N/A
2023
2124## Examples
2225
23- ### Example 1: Ruff Check
26+ ### Example 1: Ruff Check Default
2427
2528** workflow.yml**
2629``` yml
4144
4245- runs ` ` ruff check` ` on the project whenever a PR is created to merge into dev or main
4346
47+ ### Example 2: Ruff Check Commands
48+
49+ **workflow.yml**
50+ ` ` ` yml
51+ name : Lint
52+
53+ on :
54+ pull_request :
55+ branches :
56+ - main
57+ - dev
58+
59+ jobs :
60+ lint :
61+ uses : AllenNeuralDynamics/.github/.github/workflows/test-lint-ruff-python.yml@main
62+ with :
63+ ruff-commands : check --fix
64+ ` ` `
65+
66+ **Results:**
67+
68+ - runs ` ` ruff check --fix` ` on the project whenever a PR is created to merge into dev or main
69+
70+
Original file line number Diff line number Diff line change @@ -14,7 +14,10 @@ This workflow runs ``pytest tests/`` on the project with ``UV``.
1414
1515** Inputs:**
1616
17- - `` runner-label `` (optional): runner to use - default: to "eng-tools"
17+ - `` runner-label `` (optional): runner to use
18+ - default: to "eng-tools"
19+ - `` pytest-commands `` (optional): pytest commands to run
20+ - default: `` pytest tests/ ``
1821
1922** Outputs:** N/A
2023
4144
4245- runs ` ` pytest tests/` ` on the project whenever a PR is created to merge into dev or main
4346
47+ ### Example 1: Test Custom
48+
49+ **workflow.yml**
50+ ` ` ` yml
51+ name : Test
52+
53+ on :
54+ pull_request :
55+ branches :
56+ - main
57+ - dev
58+
59+ jobs :
60+ test :
61+ uses : AllenNeuralDynamics/.github/.github/workflows/test-pytest-python.yml@main
62+ with :
63+ pytest-commands : tests/test_unit_1.py
64+ ` ` `
65+
66+ **Results:**
67+
68+ - runs ` ` pytest tests/test_unit_1.py` ` on the project whenever a PR is created to merge into dev or main
69+
70+
Original file line number Diff line number Diff line change @@ -14,7 +14,9 @@ This workflow runs ``mypy`` on the project with ``UV``.
1414
1515** Inputs:**
1616
17- - `` runner-label `` (optional): runner to use - default: to "eng-tools"
17+ - `` mypy-commands `` (required): mypy command to run
18+ - `` runner-label `` (optional): runner to use
19+ - default: to "eng-tools"
1820
1921** Outputs:** N/A
2022
3537jobs :
3638 type :
3739 uses : AllenNeuralDynamics/.github/.github/workflows/test-type-mypy-python.yml@main
40+ with :
41+ mypy-commands : src/mypackage --strict
3842` ` `
3943
4044**Results:**
4145
42- - runs ` ` mypy` ` on the project whenever a PR is created to merge into dev or main
46+ - runs ` ` mypy src/mypackage --strict ` ` on the project whenever a PR is created to merge into dev or main
4347
Original file line number Diff line number Diff line change 77 description : ' Runner to use'
88 type : string
99 default : ' ubuntu-latest'
10+ ruff-commands :
11+ description : ' ruff commands to run'
12+ type : string
1013
1114jobs :
1215 lint_check :
1720 - name : Install UV
1821 uses : astral-sh/setup-uv@v5
1922 - name : Lint with Ruff
20- run : uv run ruff check
23+ if : ${{ inputs.ruff-commands == '' }}
24+ run : uv run ruff check
25+ - name : Lint with Ruff (custom)
26+ if : ${{ inputs.ruff-commands != '' }}
27+ run : uv run ruff ${{ inputs.ruff-commands }}
Original file line number Diff line number Diff line change 77 description : ' Runner to use'
88 type : string
99 default : ' ubuntu-latest'
10+ pytest-commands :
11+ description : ' pytest commands to run'
12+ type : string
1013
1114jobs :
1215 run-tests :
1619 uses : actions/checkout@v4
1720 - name : Install UV
1821 uses : astral-sh/setup-uv@v5
19- - name : Unit test with PyTest
20- run : uv run pytest tests/
22+ - name : Test with pytest
23+ if : ${{ inputs.pytest-commands == '' }}
24+ run : uv run pytest tests/
25+ - name : Test with pytest (custom)
26+ if : ${{ inputs.pytest-commands != '' }}
27+ run : uv run pytest ${{ inputs.pytest-commands }}
Original file line number Diff line number Diff line change 77 description : ' Runner to use'
88 type : string
99 default : ' ubuntu-latest'
10+ mypy-commands :
11+ description : ' mypy commands to run'
12+ required : true
13+ type : string
1014
1115jobs :
1216 type_check :
1822 uses : astral-sh/setup-uv@v5
1923 - name : Type check with mypy
2024 run : |
21- uv run mypy src/mypackage --strict
25+ uv run mypy ${{ inputs.mypy-commands }}
You can’t perform that action at this time.
0 commit comments