-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #793 from PCMDI/787_ljw_pre-commit-hook-compliant
pre-commit check compliant for github action
- Loading branch information
Showing
262 changed files
with
14,024 additions
and
9,221 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -1,82 +1,76 @@ | ||
name: CI/CD Build Workflow | ||
|
||
on: | ||
push: | ||
branches: [master] | ||
push: | ||
branches: [master] | ||
|
||
pull_request: | ||
branches: [master] | ||
pull_request: | ||
branches: [master] | ||
|
||
workflow_dispatch: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
check-jobs-to-skip: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
should_skip: ${{ steps.skip_check.outputs.should_skip }} | ||
steps: | ||
- id: skip_check | ||
uses: fkirc/skip-duplicate-actions@master | ||
with: | ||
cancel_others: true | ||
paths_ignore: '["**/README.rst", "**/docs/**", "**/ISSUE_TEMPLATE/**", "**/pull_request_template.md", "**/.vscode/**"]' | ||
check-jobs-to-skip: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
should_skip: ${{ steps.skip_check.outputs.should_skip }} | ||
steps: | ||
- id: skip_check | ||
uses: fkirc/skip-duplicate-actions@master | ||
with: | ||
cancel_others: true | ||
paths_ignore: '["**/README.md", "**/docs/**", "**/ISSUE_TEMPLATE/**", "**/pull_request_template.md", "**/.vscode/**"]' | ||
|
||
pre-commit-hooks: | ||
needs: check-jobs-to-skip | ||
if: ${{ needs.check-jobs-to-skip.outputs.should_skip != 'true'}} || ${{ github.event_name == 'push' }} | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 2 | ||
steps: | ||
- name: Checkout Code Repository | ||
uses: actions/checkout@v2 | ||
pre-commit-hooks: | ||
needs: check-jobs-to-skip | ||
if: ${{ needs.check-jobs-to-skip.outputs.should_skip != 'true'}} || ${{ github.event_name == 'push' }} | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 2 | ||
steps: | ||
- name: Checkout Code Repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Python 3.9 | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.9 | ||
- name: Set up Python 3.9 | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.9 | ||
|
||
# Run all pre-commit hooks on all the files. | ||
# Getting only staged files can be tricky in case a new PR is opened | ||
# since the action is run on a branch in detached head state | ||
- name: Install and Run Pre-commit | ||
uses: pre-commit/action@v2.0.3 | ||
# Run all pre-commit hooks on all the files. | ||
# Getting only staged files can be tricky in case a new PR is opened | ||
# since the action is run on a branch in detached head state | ||
- name: Install and Run Pre-commit | ||
uses: pre-commit/action@v2.0.3 | ||
|
||
build: | ||
needs: check-jobs-to-skip | ||
if: ${{ needs.check-jobs-to-skip.outputs.should_skip != 'true'}} || ${{ github.event_name == 'push' }} | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
shell: bash -l {0} | ||
timeout-minutes: 5 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
build: | ||
needs: check-jobs-to-skip | ||
if: ${{ needs.check-jobs-to-skip.outputs.should_skip != 'true'}} || ${{ github.event_name == 'push' }} | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
shell: bash -l {0} | ||
timeout-minutes: 5 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Cache Conda | ||
uses: actions/cache@v2 | ||
env: | ||
# Increase this value to reset cache if conda/dev.yml has not changed in the workflow | ||
CACHE_NUMBER: 0 | ||
with: | ||
path: ~/conda_pkgs_dir | ||
key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-publish | ||
- name: Cache Conda | ||
uses: actions/cache@v2 | ||
env: | ||
# Increase this value to reset cache if conda/dev.yml has not changed in the workflow | ||
CACHE_NUMBER: 0 | ||
with: | ||
path: ~/conda_pkgs_dir | ||
key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-publish | ||
|
||
- name: Set up Conda Environment | ||
uses: conda-incubator/setup-miniconda@v2 | ||
with: | ||
activate-environment: "xcdat_dev" | ||
environment-file: conda-env/dev.yml | ||
channel-priority: strict | ||
auto-update-conda: true | ||
# IMPORTANT: This needs to be set for caching to work properly! | ||
use-only-tar-bz2: true | ||
- name: Set up Conda Environment | ||
uses: conda-incubator/setup-miniconda@v2 | ||
with: | ||
activate-environment: "pcmdi_metrics_dev" | ||
environment-file: conda-env/dev.yml | ||
channel-priority: strict | ||
auto-update-conda: true | ||
# IMPORTANT: This needs to be set for caching to work properly! | ||
use-only-tar-bz2: true | ||
|
||
- name: Run Tests | ||
run: | | ||
pytest | ||
- name: Upload Coverage Report | ||
uses: codecov/codecov-action@v1 | ||
with: | ||
file: "tests_coverage_reports/coverage.xml" | ||
fail_ci_if_error: true | ||
- name: Run Tests | ||
run: | | ||
pytest |
This file contains 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 |
---|---|---|
@@ -1,27 +1,30 @@ | ||
exclude: "docs|node_modules|migrations|.git|.tox" | ||
exclude: "docs|node_modules|migrations|.git|.tox|sample_setups/(external-setups|jsons)|tests/deprecated" | ||
default_stages: [commit] | ||
fail_fast: true | ||
|
||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v3.4.0 | ||
hooks: | ||
- id: trailing-whitespace | ||
- id: end-of-file-fixer | ||
- id: check-yaml | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v3.4.0 | ||
hooks: | ||
- id: trailing-whitespace | ||
- id: end-of-file-fixer | ||
- id: check-yaml | ||
|
||
# Need to use flake8 GitHub mirror due to CentOS git issue with GitLab | ||
# https://github.com/pre-commit/pre-commit/issues/1206 | ||
- repo: https://github.com/pycqa/flake8 | ||
rev: 3.9.2 | ||
hooks: | ||
- id: flake8 | ||
args: ["--config=setup.cfg"] | ||
additional_dependencies: [flake8-isort] | ||
exclude: ^sample_setups/jsons/ | ||
- repo: https://github.com/psf/black | ||
rev: 21.9b0 | ||
hooks: | ||
- id: black | ||
|
||
- repo: https://github.com/pre-commit/mirrors-mypy | ||
rev: v0.910 | ||
hooks: | ||
- id: mypy | ||
args: ["--config=setup.cfg"] | ||
- repo: https://github.com/timothycrosley/isort | ||
rev: 5.9.3 | ||
hooks: | ||
- id: isort | ||
|
||
# Need to use flake8 GitHub mirror due to CentOS git issue with GitLab | ||
# https://github.com/pre-commit/pre-commit/issues/1206 | ||
- repo: https://github.com/pycqa/flake8 | ||
rev: 3.9.2 | ||
hooks: | ||
- id: flake8 | ||
args: ["--config=setup.cfg"] | ||
additional_dependencies: [flake8-isort] |
This file contains 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 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
Oops, something went wrong.