From dab2f43fc2df7f78b7bb6ded3dd82b566651365b Mon Sep 17 00:00:00 2001 From: Zachary Burnett Date: Mon, 5 Apr 2021 11:04:50 -0400 Subject: [PATCH] squash codecov workflow updates into main (#69) * update badge workflow * remove extraneous lines * update name * merge into tests workflow * use Codecov badge * separate into two workflows * update name * make separate jobs instead of separate workflows --- .editorconfig | 2 +- .github/badges/.keep | 0 .github/badges/badge.svg | 21 ------------- .github/workflows/badge.yml | 59 ------------------------------------- .github/workflows/tests.yml | 38 ++++++++++++++++++++++-- README.md | 2 +- 6 files changed, 37 insertions(+), 85 deletions(-) delete mode 100644 .github/badges/.keep delete mode 100644 .github/badges/badge.svg delete mode 100644 .github/workflows/badge.yml diff --git a/.editorconfig b/.editorconfig index b4aaa47f..81139fdc 100644 --- a/.editorconfig +++ b/.editorconfig @@ -101,6 +101,6 @@ ij_python_wrap_long_lines = false indent_size = 2 ij_yaml_keep_indents_on_empty_lines = false ij_yaml_keep_line_breaks = true -ij_yaml_space_before_colon = true +ij_yaml_space_before_colon = false ij_yaml_spaces_within_braces = true ij_yaml_spaces_within_brackets = true diff --git a/.github/badges/.keep b/.github/badges/.keep deleted file mode 100644 index e69de29b..00000000 diff --git a/.github/badges/badge.svg b/.github/badges/badge.svg deleted file mode 100644 index 9f708fe5..00000000 --- a/.github/badges/badge.svg +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - coverage - coverage - 60% - 60% - - diff --git a/.github/workflows/badge.yml b/.github/workflows/badge.yml deleted file mode 100644 index 5bdd48d0..00000000 --- a/.github/workflows/badge.yml +++ /dev/null @@ -1,59 +0,0 @@ -name: tests - -on: [ push ] - -jobs: - tests: - name: Python ${{ matrix.python-version }} - runs-on: ubuntu-latest - strategy: - fail-fast: true - matrix: - python-version: [ 3.8 ] - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - name: Setup Python - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - name: Restore cached dependencies - uses: actions/cache@v2 - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('setup.py') }} - restore-keys: ${{ runner.os }}-pip-${{ matrix.python-version }}- - - name: Install dependencies - run: | - apt-get update -y && apt-get install -y libnetcdf-dev libnetcdff-dev - pip install wheel - pip install -e .[development] - - name: Test with coverage - run: coverage run --source adcircpy -m nose --nologcapture --verbose - - name: Generate coverage report - run: coverage report -m - - name: Generate coverage badge - run: coverage-badge -f -o .github/badges/badge.svg - - name: Extract branch name - shell: bash - run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" - id: extract_branch - - name: Commit badge - run: | - git diff --exit-code .github/badges/badge.svg - if ! [ $? -eq 0 ] - then - git config --local user.email "action@github.com" - git config --local user.name "GitHub Action" - git add .github/badges/badge.svg - git commit -m "Add/Update badge" - fi - - name: Push badge commit - uses: ad-m/github-push-action@master - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - branch: ${{ steps.extract_branch.outputs.branch }} - -# https://stackoverflow.com/questions/59203704/how-create-a-badge-with-test-coverage-jacoco-on-github-actions -# diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index dc974c5c..0f475dc8 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -10,7 +10,6 @@ jobs: fail-fast: true matrix: python-version: [ 3.6, 3.7, 3.8 ] - steps: - name: Checkout repository uses: actions/checkout@v2 @@ -26,7 +25,7 @@ jobs: restore-keys: ${{ runner.os }}-pip-${{ matrix.python-version }}- - name: Install dependencies run: | - apt-get update -y && apt-get install -y libnetcdf-dev libnetcdff-dev + apt update -y && apt install -y libnetcdf-dev libnetcdff-dev pip install wheel pip install -e .[development] - name: Lint with flake8 @@ -35,7 +34,40 @@ jobs: flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - - name: Test with coverage + - name: Run tests + run: python -m nose --nologcapture --verbose + coverage: + name: Upload coverage to Codecov + needs: [ tests ] + runs-on: ubuntu-latest + strategy: + fail-fast: true + matrix: + python-version: [ 3.8 ] + steps: + - name: Checkout repository + uses: actions/checkout@v2 + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Restore cached dependencies + uses: actions/cache@v2 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('setup.py') }} + restore-keys: ${{ runner.os }}-pip-${{ matrix.python-version }}- + - name: Install dependencies + run: | + apt update -y && apt install -y libnetcdf-dev libnetcdff-dev + pip install wheel + pip install -e .[development] + - name: Run tests with coverage run: coverage run --source adcircpy -m nose --nologcapture --verbose - name: Generate coverage report run: coverage report -m + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v1 + with: + flags: python${{ matrix.python-version }}-${{ runner.os }} + fail_ci_if_error: true diff --git a/README.md b/README.md index 303d4eca..0dee3fdf 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ ## Python library for automating ADCIRC model runs. [![tests](https://github.com/JaimeCalzadaNOAA/adcircpy/workflows/tests/badge.svg)](https://github.com/JaimeCalzadaNOAA/adcircpy/actions?query=workflow%3Atests) [![build](https://github.com/JaimeCalzadaNOAA/adcircpy/workflows/build/badge.svg)](https://github.com/JaimeCalzadaNOAA/adcircpy/actions?query=workflow%3Abuild) -![coverage](.github/badges/badge.svg) +[![codecov](https://codecov.io/gh/JaimeCalzadaNOAA/adcircpy/branch/main/graph/badge.svg?token=BQWB1QKJ3Q)](https://codecov.io/gh/JaimeCalzadaNOAA/adcircpy) [![version](https://img.shields.io/pypi/v/adcircpy)](https://pypi.org/project/adcircpy) [![license](https://img.shields.io/github/license/JaimeCalzadaNOAA/adcircpy)](https://opensource.org/licenses/gpl-license)