Skip to content

Commit d12fde5

Browse files
JaimeCalzadaNOAAjreniel
andauthored
Feature/adcircmeshupgrade (#67)
* Refactor of mesh package + bugfixes * Testing auto-badge capability * Updated test, added auto-coverage badging * correction to init file * Added directory for badges * Add/Update badge * Test auto-badging * test auto-badging * Test auto-bdge * autobadging debug * test auto-badging * Add/Update badge * Update README.md * auto-badge debug * Add/Update badge * readme fix * remove badge * Add/Update badge * Disabled auto-badging * Removed unnecessary files Co-authored-by: jreniel <jreniel@gmail.com>
1 parent baa2ce0 commit d12fde5

40 files changed

+3399
-2720
lines changed

.github/badges/.keep

Whitespace-only changes.

tests/coverage.svg renamed to .github/badges/badge.svg

Lines changed: 3 additions & 3 deletions
Loading
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: tests
2+
3+
on: [ push ]
4+
5+
jobs:
6+
tests:
7+
name: Python ${{ matrix.python-version }}
8+
runs-on: ubuntu-latest
9+
strategy:
10+
fail-fast: true
11+
matrix:
12+
python-version: [ 3.8 ]
13+
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v2
17+
- name: Setup Python
18+
uses: actions/setup-python@v2
19+
with:
20+
python-version: ${{ matrix.python-version }}
21+
- name: Restore cached dependencies
22+
uses: actions/cache@v2
23+
with:
24+
path: ~/.cache/pip
25+
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('setup.py') }}
26+
restore-keys: ${{ runner.os }}-pip-${{ matrix.python-version }}-
27+
- name: Install dependencies
28+
run: |
29+
apt-get update -y && apt-get install -y libnetcdf-dev libnetcdff-dev
30+
pip install wheel
31+
pip install -e .[development]
32+
- name: Test with coverage
33+
run: coverage run --source adcircpy -m nose --nologcapture --verbose
34+
- name: Generate coverage report
35+
run: coverage report -m
36+
- name: Generate coverage badge
37+
run: coverage-badge -f -o .github/badges/badge.svg
38+
- name: Extract branch name
39+
shell: bash
40+
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
41+
id: extract_branch
42+
- name: Commit badge
43+
run: |
44+
git config --local user.email "action@github.com"
45+
git config --local user.name "GitHub Action"
46+
git add .github/badges/badge.svg
47+
git commit -m "Add/Update badge"
48+
- name: Push badge commit
49+
uses: ad-m/github-push-action@master
50+
with:
51+
github_token: ${{ secrets.GITHUB_TOKEN }}
52+
branch: ${{ steps.extract_branch.outputs.branch }}
53+
54+
# https://stackoverflow.com/questions/59203704/how-create-a-badge-with-test-coverage-jacoco-on-github-actions
55+
#

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,4 @@ jobs:
3838
- name: Test with coverage
3939
run: coverage run --source adcircpy -m nose --nologcapture --verbose
4040
- name: Generate coverage report
41-
run: coverage report -m
41+
run: coverage report -m

MANIFEST.in

Lines changed: 0 additions & 2 deletions
This file was deleted.

Makefile

Lines changed: 0 additions & 23 deletions
This file was deleted.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
## Python library for automating ADCIRC model runs.
33
[![tests](https://github.com/JaimeCalzadaNOAA/adcircpy/workflows/tests/badge.svg)](https://github.com/JaimeCalzadaNOAA/adcircpy/actions?query=workflow%3Atests)
44
[![build](https://github.com/JaimeCalzadaNOAA/adcircpy/workflows/build/badge.svg)](https://github.com/JaimeCalzadaNOAA/adcircpy/actions?query=workflow%3Abuild)
5-
[![coverage](tests/coverage.svg)](https://github.com/JaimeCalzadaNOAA/adcircpy/actions)
5+
![coverage](.github/badges/badge.svg)
66
[![version](https://img.shields.io/pypi/v/adcircpy)](https://pypi.org/project/adcircpy)
77
[![license](https://img.shields.io/github/license/JaimeCalzadaNOAA/adcircpy)](https://opensource.org/licenses/gpl-license)
88

adcircpy/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import matplotlib as mpl
44
from pandas.plotting import register_matplotlib_converters
55

6-
from adcircpy.driver import AdcircRun
6+
from adcircpy.driver.driver import AdcircRun
77
from adcircpy.forcing import Tides
88
from adcircpy.mesh import AdcircMesh
99
from adcircpy.fort15 import Fort15
@@ -20,5 +20,4 @@
2020

2121
if util.find_spec("colored_traceback") is not None:
2222
import colored_traceback
23-
2423
colored_traceback.add_hook(always=True)

adcircpy/cmd/argument_parser.py

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import argparse
2-
import logging
32
import sys
43

54

@@ -36,22 +35,11 @@ def generate_only(parser):
3635

3736

3837
def log_level(parser):
39-
log_level = parser.add_mutually_exclusive_group()
40-
log_level.add_argument(
41-
'--log-level-info',
42-
nargs='?',
43-
const=logging.INFO,
44-
dest="log_level")
45-
log_level.add_argument(
46-
'--log-level-debug',
47-
nargs='?',
48-
const=logging.DEBUG,
49-
dest="log_level")
50-
log_level.add_argument(
51-
'--log-level-warning',
52-
nargs='?',
53-
const=logging.WARNING,
54-
dest="log_level")
38+
parser.add_argument(
39+
"--log-level",
40+
choices=['info', 'warning', 'debug'],
41+
default='warning'
42+
)
5543

5644

5745
def server(parser):
@@ -68,8 +56,8 @@ def server(parser):
6856
parser.add_argument("--additional-mpi-options")
6957

7058
# make nproc required when using ssh
71-
args = parser.parse_known_args()[0]
72-
if args.hostname is not None:
59+
# args = parser.parse_known_args()[0]
60+
if '--hostname' in sys.argv:
7361
parser.add_argument("--nproc", "--ncpu", type=int, required=True)
7462
else:
7563
parser.add_argument("--nproc", "--ncpu", type=int, default=-1)
@@ -169,7 +157,7 @@ def best_track(parser):
169157
msg += " Examples: AL132012 for Sandy2012 or AL152017 for Maria2017."
170158
parser.add_argument('storm_id', help=msg)
171159
parser.add_argument('--start-date')
172-
parser.add_argument('--end-date')
160+
parser.add_argument('--run-days', type=float)
173161
parser.add_argument('--spinup-days', type=float, required=True)
174162

175163

0 commit comments

Comments
 (0)