File tree Expand file tree Collapse file tree 4 files changed +52
-7
lines changed Expand file tree Collapse file tree 4 files changed +52
-7
lines changed Original file line number Diff line number Diff line change
1
+ name : pre-commit
2
+
3
+ on :
4
+ pull_request :
5
+ types : [opened, synchronize, reopened]
6
+ push :
7
+ # Run the tests one more time, after the PR changes
8
+ # have been pushed. The if-statement below prevents
9
+ # the push from running on other repos.
10
+ branches :
11
+ # Trigger workflow on push to any branch or branch heirarchy:
12
+ - ' **'
13
+
14
+ jobs :
15
+ # This job is designed to run the "pre-commit"
16
+ # set of static analysis, linters, and formatters
17
+ # for Python and YAML.
18
+ pre-commit :
19
+ if : github.event_name == 'pull_request' || github.repository == 'NCAR/ADF'
20
+ runs-on : ubuntu-latest
21
+ steps :
22
+ # acquire github action routines
23
+ - uses : actions/checkout@v3
24
+ # acquire specific version of python
25
+ - name : Set up Python 3.10
26
+ uses : actions/setup-python@v4
27
+ with :
28
+ python-version : ' 3.10' # Use python 3.10
29
+ # install pre-commit package
30
+ - name : Install pre-commit
31
+ run : |
32
+ python -m pip install --upgrade pip # Install latest version of PIP
33
+ pip install pre-commit
34
+ # run pre-commit on ADF code
35
+ - name : Run pre-commit
36
+ run : pre-commit run -a
37
+
Original file line number Diff line number Diff line change @@ -25,22 +25,19 @@ jobs:
25
25
fail-fast : false
26
26
steps :
27
27
# Acquire github action routines:
28
- - uses : actions/checkout@v2
28
+ - uses : actions/checkout@v3
29
29
# Acquire specific version of python:
30
30
- name : Set up Python ${{ matrix.python-version }}
31
- uses : actions/setup-python@v1
31
+ uses : actions/setup-python@v4
32
32
with :
33
33
python-version : ${{ matrix.python-version }}
34
34
# Install needed python packages:
35
35
- name : Install dependencies
36
36
run : |
37
37
python -m pip install --upgrade pip # Install latest version of PIP
38
38
pip install pyyaml # Install PyYAML python package
39
+ pip install pytest # Install pytest python package
39
40
# Run python unit tests related to ADF library:
40
41
- name : ADF lib unit tests
41
- run : |
42
- #AdfBase unit tests:
43
- python lib/test/unit_tests/test_adf_base.py
44
- #AdfConfig unit tests:
45
- python lib/test/unit_tests/test_adf_config.py
42
+ run : pytest lib/test/unit_tests
46
43
Original file line number Diff line number Diff line change
1
+ # Configuration file for the "pre-commit" linting/formatting tool.
2
+
3
+ repos :
4
+ - repo : https://github.com/pre-commit/pre-commit-hooks
5
+ rev : v4.3.0
6
+ hooks :
7
+ - id : check-yaml
8
+
9
+ # End of file.
Original file line number Diff line number Diff line change
1
+ [pytest]
2
+ addopts =-p no:logging
You can’t perform that action at this time.
0 commit comments