-
Notifications
You must be signed in to change notification settings - Fork 358
Add GitHub workflows to check black, pylint, git-fleximod #2964
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
samsrabin
merged 44 commits into
ESCOMP:b4b-dev
from
samsrabin:add-github-workflows-20250214
Apr 21, 2025
Merged
Changes from all commits
Commits
Show all changes
44 commits
Select commit
Hold shift + click to select a range
4888cde
Add fleximod_test workflow.
samsrabin 25c3f97
Update FATES URL.
samsrabin d7131a8
Add pylint workflow
samsrabin efbf914
Name fix in fleximod_test workflow.
samsrabin 4062112
Add versions of python for pylint testing.
samsrabin b5b858f
Disable fail-fast for pylint workflow.
samsrabin 9d64aac
Remove --check from pylint testing.
samsrabin b1209ea
Add black_multi_python workflow.
samsrabin dbd1091
Fix --config path for multi-python black check.
samsrabin eb36db7
Add Python 3.7.9 to black_multi_python workflow.
samsrabin e18bc6c
Print diffs in black_multi_python workflow,
samsrabin ff25076
Add job to black_multi_python that works like black.yml.
samsrabin 21a6bf2
Replace non-working black-check-multi-python job.
samsrabin a963237
Move multi-python capability into old black.yml.
samsrabin bbe82e0
Add --diff to black check workflow.
samsrabin ed7711d
Add python 3.7 to pylint workflow.
samsrabin f652136
Change that to 3.7.9.
samsrabin 2fb9ca8
Try bumping pylint workflow setup-python version to fix 3.7.9.
samsrabin fc9cfc5
Move 3.7.9 pylint check to ubuntu-20.04
samsrabin 67f4ab4
Pylint workflow now fails on complaints.
samsrabin 5f86c93
pip install requirements in pylint workflow.
samsrabin 6c81aeb
pylint workflow > 3.7.9 now ignores warning about useless option for …
samsrabin c7b8270
Lock pylint to version in ctsm_pylib.
samsrabin 1ad6909
Restrict pylint workflow to Python versions that work.
samsrabin a9c847d
Restrict running of black and pylint workflows.
samsrabin dd49240
Merge tag 'ctsm5.3.040' into add-github-workflows-20250214
samsrabin 83eedd4
Add miniconda test Workflow.
samsrabin 86935ac
Convert black GH Workflow to use ctsm_pylib.
samsrabin 0073dc3
Delete miniconda Workflow.
samsrabin 781aade
Delete a comment in python/conda_env_ctsm_py.txt.
samsrabin 4cff8fb
Try an actual YML file instead.
samsrabin 6712fe6
Black workflow now checks conda-forge first.
samsrabin 83eb8a4
Fix call of "make black" in Workflow.
samsrabin 7d45c8c
Fix that call again.
samsrabin 3b5c8aa
Replace conda env txt files with yml files.
samsrabin ad50fc3
Update pylint Workflow to use ctsm_pylib.
samsrabin 576d469
Fix name in ctsm_pylib_3_7_9 yml file.
samsrabin e637692
Combine black and pylint Workflows.
samsrabin 2b5a781
Delete requirements.txt.
samsrabin 2c2c01d
lint_and_format.yml: Fix handling of failed pylint check.
samsrabin 834fdd8
Merge remote-tracking branch 'upstream/b4b-dev' into add-github-workf…
samsrabin 8d39cb4
Rename Python formatting workflow.
samsrabin 757b1e6
py_env_create: Return $option to environment creation.
samsrabin 441a095
formatting_python.yml: Delete outdated, unneeded paths.
samsrabin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| name: git-fleximod test | ||
| # | ||
| # Test git-fleximod update and cleanliness | ||
| # Based closely on workflow from CESM repo | ||
| # | ||
| on: [push, pull_request] | ||
|
|
||
| jobs: | ||
| fleximod-test: | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| # oldest supported and latest supported | ||
| python-version: ["3.7", "3.x"] | ||
| steps: | ||
| - id: checkout-CTSM | ||
| uses: actions/checkout@v4 | ||
| - id: run-fleximod | ||
| run: | | ||
| $GITHUB_WORKSPACE/bin/git-fleximod update | ||
| echo | ||
| echo "Update complete, checking status" | ||
| echo | ||
| $GITHUB_WORKSPACE/bin/git-fleximod test | ||
|
samsrabin marked this conversation as resolved.
|
||
| - id: check-cleanliness | ||
| run: | | ||
| echo | ||
| echo "Checking if git fleximod matches expected externals" | ||
|
samsrabin marked this conversation as resolved.
|
||
| echo | ||
| git diff --exit-code | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| name: Check Python formatting | ||
|
|
||
| on: | ||
| push: | ||
| paths: | ||
| - 'python/**' | ||
| - 'cime_config/SystemTests/**' | ||
| - 'cime_config/buildlib/**' | ||
| - 'cime_config/buildnml/**' | ||
| pull_request: | ||
| paths: | ||
| - 'python/**' | ||
| - 'cime_config/SystemTests/**' | ||
| - 'cime_config/buildlib/**' | ||
| - 'cime_config/buildnml/**' | ||
|
|
||
| jobs: | ||
| lint-and-format-check: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| # Checkout the code | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| # Set up the conda environment | ||
| - uses: conda-incubator/setup-miniconda@v3 | ||
| with: | ||
| activate-environment: ctsm_pylib | ||
| environment-file: python/conda_env_ctsm_py.yml | ||
| channels: conda-forge | ||
| auto-activate-base: false | ||
|
|
||
| # Run pylint check | ||
| - name: Run pylint | ||
| run: | | ||
| cd python | ||
| conda run -n ctsm_pylib make lint | ||
|
samsrabin marked this conversation as resolved.
|
||
|
|
||
| # Run black check | ||
| - name: Run black | ||
| # Run this step even if previous step(s) failed | ||
| if: success() || failure() | ||
| run: | | ||
| cd python | ||
| conda run -n ctsm_pylib make black | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| # This file is used by py_env_create to install the latest version of the ctsm_pylib conda environment. | ||
| name: ctsm_pylib | ||
| channels: | ||
| - conda-forge | ||
| - defaults | ||
| dependencies: | ||
| - python=3.13.2 | ||
| - xarray=2025.1.2 | ||
| - tqdm=4.67.1 | ||
| - scipy=1.15.2 | ||
| - netcdf4=1.7.2 | ||
| - requests=2.32.3 | ||
| - xesmf=0.8.8 | ||
| - numba=0.61.0 | ||
| - pylint=3.3.4 | ||
| - black=25.1.0 | ||
| - cartopy=0.24.0 | ||
| - matplotlib=3.10.1 | ||
|
|
||
| # Used in ctsm_postprocessing repo | ||
| - pytest=8.3.5 | ||
| - coverage=7.8.0 |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| # This file is used by py_env_create to install the previous version of the ctsm_pylib environment, | ||
| # which used Python 3.7.9. Doing so is only useful for running CTSM python tools in repos from | ||
| # before the new ctsm_pylib version (with Python 3.13.2) was introduced. | ||
| # | ||
| name: ctsm_pylib_3_7_9 | ||
| channels: | ||
| - conda-forge | ||
| - defaults | ||
| dependencies: | ||
| - python=3.7.9 | ||
| - pandas=1.3.5 | ||
| - tqdm=4.67.1 | ||
| - scipy=1.7.3 | ||
| - netcdf4=1.6.0 | ||
| - requests=2.32.2 | ||
| - packaging=21.3 | ||
| - numpy=1.19.5 | ||
| - xarray=0.17.0 | ||
| - xesmf=0.7.0 | ||
| - numba=0.55.2 | ||
| - pylint=2.8.3 | ||
| - black=22.3.0 | ||
| - cartopy=0.20.2 | ||
| - matplotlib=3.3.2 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.