Skip to content

Commit

Permalink
ci(test): now make use of coveralls
Browse files Browse the repository at this point in the history
  • Loading branch information
tduigou committed Feb 6, 2025
1 parent 7beb4ed commit 151850e
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 46 deletions.
59 changes: 13 additions & 46 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,17 @@
name: Test code

on:

push:
branches: [ '*' ]
# paths: [ '**.py' ]
on: [push, pull_request]

jobs:

Test:

runs-on: ${{ matrix.os }}-latest
strategy:
matrix:
os: ["ubuntu", "macos", "windows"]
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}

steps:

- name: Checkout code
uses: actions/checkout@v4

Expand All @@ -31,46 +23,21 @@ jobs:
activate-environment: test-env
conda-remove-defaults: "true"

- name: Install dev dependencies with conda
run: |
conda env update -n test-env --file environment-dev.yml
- name: Install as package
run: |
pip -v install --no-deps --editable .
pip -v install --no-deps --editable .
- name: Run tests with coverage
run: |
coverage run -m pytest -xs
- name: Generate coverage report
if: matrix.os == 'ubuntu'
- name: Install dependencies for testing
run: |
coverage report --format markdown > coverage.md
conda install --channel conda-forge pytest
pip install coveralls
- name: Extract coverage percentage
if: matrix.os == 'ubuntu'
- name: Run tests
run: |
export COV_PERCENT=$(coverage report --format total)
echo "COV_PERCENT=$COV_PERCENT" >> $GITHUB_ENV
coverage run -m pytest tests
- name: Create Coverage Badge
if: matrix.os == 'ubuntu'
uses: schneegans/dynamic-badges-action@v1.7.0
with:
auth: ${{ secrets.GIST_SECRET }}
gistID: 056fdf29a6c0ab5b61a62f21468be178
filename: molecule-signature-coverage.json
label: coverage
message: ${{ env.COV_PERCENT }}%
valColorRange: ${{ env.COV_PERCENT }}
minColorRange: 50
maxColorRange: 90

- name: Upload coverage report
if: matrix.os == 'ubuntu'
uses: actions/upload-artifact@v4
with:
name: coverage
path: coverage.md
compression-level: 0
- name: Report using coveralls
run: |
coveralls
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
74 changes: 74 additions & 0 deletions .github/workflows/test_deprecated.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Test code (deprecated)

on:
push:
branches-ignore: [ '*' ] # Prevents this workflow from running

jobs:

Test:

runs-on: ${{ matrix.os }}-latest
strategy:
matrix:
os: ["ubuntu", "macos", "windows"]
defaults:
run:
shell: bash -l {0}

steps:

- name: Checkout code
uses: actions/checkout@v4

- name: Install regular dependencies with conda
uses: conda-incubator/setup-miniconda@v3
with:
miniforge-version: "latest"
environment-file: environment.yml
activate-environment: test-env
conda-remove-defaults: "true"

- name: Install dev dependencies with conda
run: |
conda env update -n test-env --file environment-dev.yml
- name: Install as package
run: |
pip -v install --no-deps --editable .
- name: Run tests with coverage
run: |
coverage run -m pytest -xs
- name: Generate coverage report
if: matrix.os == 'ubuntu'
run: |
coverage report --format markdown > coverage.md
- name: Extract coverage percentage
if: matrix.os == 'ubuntu'
run: |
export COV_PERCENT=$(coverage report --format total)
echo "COV_PERCENT=$COV_PERCENT" >> $GITHUB_ENV
- name: Create Coverage Badge
if: matrix.os == 'ubuntu'
uses: schneegans/dynamic-badges-action@v1.7.0
with:
auth: ${{ secrets.GIST_SECRET }}
gistID: 056fdf29a6c0ab5b61a62f21468be178
filename: molecule-signature-coverage.json
label: coverage
message: ${{ env.COV_PERCENT }}%
valColorRange: ${{ env.COV_PERCENT }}
minColorRange: 50
maxColorRange: 90

- name: Upload coverage report
if: matrix.os == 'ubuntu'
uses: actions/upload-artifact@v4
with:
name: coverage
path: coverage.md
compression-level: 0

0 comments on commit 151850e

Please sign in to comment.