Skip to content

Commit b2c4fc3

Browse files
committed
Update workflows and badges
1 parent e6b474d commit b2c4fc3

5 files changed

Lines changed: 170 additions & 102 deletions

File tree

.github/workflows/ci.yml

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ master, develop ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
test:
11+
name: Test Python 3.12
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Install uv
18+
uses: astral-sh/setup-uv@v4
19+
with:
20+
version: "latest"
21+
22+
- name: Set up Python 3.12
23+
uses: actions/setup-python@v5
24+
with:
25+
python-version: "3.12"
26+
27+
- name: Install dependencies
28+
run: |
29+
uv pip install --system -e ".[dev]"
30+
31+
- name: Run ruff (lint)
32+
run: |
33+
ruff check .
34+
continue-on-error: true
35+
36+
- name: Run black (format check)
37+
run: |
38+
black --check .
39+
continue-on-error: true
40+
41+
- name: Run tests with coverage
42+
run: |
43+
pytest -v --cov=pingping --cov-report=xml --cov-report=json --cov-report=term
44+
45+
- name: Generate coverage badge
46+
uses: tj-actions/coverage-badge-py@v2
47+
with:
48+
output: coverage.svg
49+
50+
- name: Upload coverage badge
51+
if: github.ref == 'refs/heads/master'
52+
uses: actions/upload-artifact@v4
53+
with:
54+
name: coverage-badge
55+
path: coverage.svg
56+
57+
- name: Commit coverage badge
58+
if: github.ref == 'refs/heads/master'
59+
run: |
60+
git config --local user.email "github-actions[bot]@users.noreply.github.com"
61+
git config --local user.name "github-actions[bot]"
62+
mkdir -p .github/badges
63+
mv coverage.svg .github/badges/
64+
git add .github/badges/coverage.svg || true
65+
git diff --quiet && git diff --staged --quiet || git commit -m "Update coverage badge [skip ci]"
66+
git push || true
67+
68+
quality-gate:
69+
name: TestIQ Quality Gate
70+
runs-on: ubuntu-latest
71+
needs: test
72+
73+
steps:
74+
- uses: actions/checkout@v4
75+
76+
- name: Install uv
77+
uses: astral-sh/setup-uv@v4
78+
with:
79+
version: "latest"
80+
81+
- name: Set up Python 3.12
82+
uses: actions/setup-python@v5
83+
with:
84+
python-version: "3.12"
85+
86+
- name: Install dependencies
87+
run: |
88+
uv pip install --system -e ".[dev]"
89+
90+
- name: Run tests with TestIQ coverage
91+
run: |
92+
pytest --testiq-output=testiq_coverage.json -q
93+
94+
- name: Analyze test quality with TestIQ
95+
run: |
96+
testiq analyze testiq_coverage.json --threshold 1.0
97+
continue-on-error: true
98+
99+
- name: Generate HTML report
100+
if: always()
101+
run: |
102+
mkdir -p reports
103+
testiq analyze testiq_coverage.json --format html --output reports/testiq-report.html
104+
105+
- name: Upload TestIQ report
106+
if: always()
107+
uses: actions/upload-artifact@v4
108+
with:
109+
name: testiq-quality-report
110+
path: reports/testiq-report.html
111+
retention-days: 30
112+

.github/workflows/publish.yml

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

.github/workflows/pytest.yml

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

.github/workflows/release.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Release
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
8+
jobs:
9+
build:
10+
name: Build distribution
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Install uv
17+
uses: astral-sh/setup-uv@v4
18+
19+
- name: Set up Python
20+
uses: actions/setup-python@v5
21+
with:
22+
python-version: "3.12"
23+
24+
- name: Build package
25+
run: |
26+
uv build
27+
28+
- name: Store distribution packages
29+
uses: actions/upload-artifact@v4
30+
with:
31+
name: python-package-distributions
32+
path: dist/
33+
34+
publish-to-pypi:
35+
name: Publish to PyPI
36+
needs: [build]
37+
runs-on: ubuntu-latest
38+
environment:
39+
name: pypi
40+
url: https://pypi.org/p/pingping
41+
permissions:
42+
id-token: write
43+
44+
steps:
45+
- name: Download distributions
46+
uses: actions/download-artifact@v4
47+
with:
48+
name: python-package-distributions
49+
path: dist/
50+
51+
- name: Publish to PyPI
52+
uses: pypa/gh-action-pypi-publish@release/v1

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
# Multi Linguistic Ping (pingping)
22

3-
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
4-
[![Build Status](https://github.com/network-tools/pingping/actions/workflows/pytest.yml/badge.svg)](https://github.com/network-tools/pingping)
5-
[![Coverage](https://raw.githubusercontent.com/network-tools/pingping/master/.github/badges/coverage.svg)](https://github.com/network-tools/pingping)
6-
[![Python Version](https://img.shields.io/badge/python-3.9+-blue.svg)](https://www.python.org/downloads/)
3+
[![Python Version](https://img.shields.io/badge/python-3.9%2B-blue.svg)](https://www.python.org/downloads/)
4+
[![Version](https://img.shields.io/badge/version-1.3.5-blue.svg)](https://github.com/network-tools/pingping)
5+
[![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
6+
[![Test Coverage](https://img.shields.io/badge/coverage-100%25-brightgreen.svg)](https://github.com/network-tools/pingping)
7+
[![Tests](https://img.shields.io/badge/tests-35%2F35%20passing-brightgreen.svg)](tests/)
8+
[![Build Status](https://github.com/network-tools/pingping/actions/workflows/ci.yml/badge.svg)](https://github.com/network-tools/pingping/actions)
79
[![Downloads](https://pepy.tech/badge/pingping)](https://pepy.tech/project/pingping)
8-
[![GitHub issues open](https://img.shields.io/github/issues/network-tools/pingping.svg?)](https://github.com/network-tools/pingping/issues)
910

1011
## Table of Contents
1112

0 commit comments

Comments
 (0)