Skip to content

Commit

Permalink
ci(workflow): use codecov to measure coverage (#45)
Browse files Browse the repository at this point in the history
* ci(workflow): use codecov to measure coverage

* ci(workflows): fail ci if error in coverage upload and use concurrency
  • Loading branch information
arunanshub authored Oct 31, 2024
1 parent 8cf982e commit f8929c2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 27 deletions.
42 changes: 16 additions & 26 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
name: CI

on:
workflow_dispatch:
push:
branches:
- master
tags:
- "v*.*.*"
branches: [master]
tags: ["v*.*.*"]
pull_request:
workflow_dispatch:
branches: [master]

permissions:
contents: read
Expand All @@ -21,15 +20,19 @@ env:
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}

jobs:
test:
name: Test on ${{ matrix.os }} with Python ${{ matrix.python-version }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.9", "3.10", "3.11", "3.12"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]

runs-on: ${{ matrix.os}}
runs-on: ${{ matrix.os }}

steps:
- name: Checkout repository 👁️
Expand Down Expand Up @@ -105,15 +108,14 @@ jobs:
run: pdm run mypy .

- name: Run Python Tests 🧪
run: pdm run pytest -n auto -d --cov=src/ --cov-report=lcov --cov-branch --benchmark-disable --benchmark-skip
run: pdm run pytest -n auto -d --cov=src/ --cov-report=xml --cov-branch --benchmark-disable --benchmark-skip

- name: Upload Coverage Report 📊
uses: coverallsapp/github-action@v2.3.4
- name: Upload Coverage Report to Codecov
uses: codecov/codecov-action@v4.6.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
file: "./coverage.lcov"
parallel: true
flag-name: run-${{ matrix.os }}-python-${{ matrix.python-version }}
files: coverage.xml
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true

build-wheels:
name: Build Wheels on ${{ matrix.os }}
Expand Down Expand Up @@ -173,18 +175,6 @@ jobs:
name: cibw-sdist
path: dist/*.tar.gz

finish-coverage:
name: Finish Coverage Report
needs: [test]
runs-on: ubuntu-latest

steps:
- name: Finish Coverage Report
uses: coverallsapp/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true

publish:
name: Publish to PyPI
if: success() && startsWith(github.ref, 'refs/tags/v')
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[![PDM](https://img.shields.io/endpoint?url=https%3A%2F%2Fcdn.jsdelivr.net%2Fgh%2Fpdm-project%2F.github%2Fbadge.json)](https://github.com/arunanshub/pynanoid)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pynanoid)](https://pypi.org/project/pynanoid)
[![PyPI - Version](https://img.shields.io/pypi/v/pynanoid?color=green)](https://pypi.org/project/pynanoid)
[![Coverage Status](https://img.shields.io/coverallsCoverage/github/arunanshub/pynanoid)](https://coveralls.io/github/arunanshub/pynanoid?branch=master)
[![Coverage Status](https://img.shields.io/codecov/c/github/arunanshub/pynanoid?logo=codecov)](https://app.codecov.io/gh/arunanshub/pynanoid)
[![CI](https://github.com/arunanshub/pynanoid/actions/workflows/ci.yml/badge.svg)](https://github.com/arunanshub/pynanoid/actions/workflows/ci.yml)

A tiny, secure, URL-friendly, unique string ID generator for Python, written in
Expand Down

0 comments on commit f8929c2

Please sign in to comment.