Skip to content

Commit fea5b42

Browse files
committed
Add TestIQ
0 parents  commit fea5b42

46 files changed

Lines changed: 10514 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
pull_request:
7+
branches: [ main, develop ]
8+
9+
jobs:
10+
test:
11+
name: Test Python ${{ matrix.python-version }}
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
python-version: ["3.9", "3.10", "3.11", "3.12"]
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Install uv
21+
uses: astral-sh/setup-uv@v4
22+
with:
23+
version: "latest"
24+
25+
- name: Set up Python ${{ matrix.python-version }}
26+
uses: actions/setup-python@v5
27+
with:
28+
python-version: ${{ matrix.python-version }}
29+
30+
- name: Install dependencies
31+
run: |
32+
uv pip install --system -e ".[dev]"
33+
34+
- name: Run ruff (lint)
35+
run: |
36+
uv run ruff check src/ tests/
37+
38+
- name: Run ruff (format check)
39+
run: |
40+
uv run ruff format --check src/ tests/
41+
42+
- name: Run black (format check)
43+
run: |
44+
uv run black --check src/ tests/
45+
46+
- name: Run mypy (type check)
47+
run: |
48+
uv run mypy src/
49+
continue-on-error: true
50+
51+
- name: Run tests
52+
run: |
53+
uv run pytest tests/ -v --cov=testiq --cov-report=xml --cov-report=term
54+
55+
- name: Upload coverage to Codecov
56+
uses: codecov/codecov-action@v4
57+
with:
58+
file: ./coverage.xml
59+
fail_ci_if_error: false
60+
61+
demo:
62+
name: Test Demo Command
63+
runs-on: ubuntu-latest
64+
65+
steps:
66+
- uses: actions/checkout@v4
67+
68+
- name: Install uv
69+
uses: astral-sh/setup-uv@v4
70+
71+
- name: Set up Python
72+
uses: actions/setup-python@v5
73+
with:
74+
python-version: "3.11"
75+
76+
- name: Install package
77+
run: |
78+
uv pip install --system -e .
79+
80+
- name: Run demo
81+
run: |
82+
testiq demo

.github/workflows/publish.yml

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
inputs:
8+
test_pypi:
9+
description: 'Publish to Test PyPI instead of PyPI'
10+
required: false
11+
type: boolean
12+
default: false
13+
14+
jobs:
15+
build:
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
- name: Set up Python
22+
uses: actions/setup-python@v5
23+
with:
24+
python-version: '3.11'
25+
26+
- name: Install build dependencies
27+
run: |
28+
python -m pip install --upgrade pip
29+
pip install build twine
30+
31+
- name: Build package
32+
run: python -m build
33+
34+
- name: Check package
35+
run: twine check dist/*
36+
37+
- name: Upload artifacts
38+
uses: actions/upload-artifact@v4
39+
with:
40+
name: dist
41+
path: dist/
42+
43+
publish-test:
44+
runs-on: ubuntu-latest
45+
needs: build
46+
if: github.event_name == 'workflow_dispatch' && github.event.inputs.test_pypi == 'true'
47+
environment:
48+
name: test-pypi
49+
url: https://test.pypi.org/project/testiq/
50+
51+
steps:
52+
- uses: actions/download-artifact@v4
53+
with:
54+
name: dist
55+
path: dist/
56+
57+
- name: Publish to Test PyPI
58+
uses: pypa/gh-action-pypi-publish@release/v1
59+
with:
60+
repository-url: https://test.pypi.org/legacy/
61+
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
62+
63+
publish-pypi:
64+
runs-on: ubuntu-latest
65+
needs: build
66+
if: github.event_name == 'release'
67+
environment:
68+
name: pypi
69+
url: https://pypi.org/project/testiq/
70+
71+
steps:
72+
- uses: actions/download-artifact@v4
73+
with:
74+
name: dist
75+
path: dist/
76+
77+
- name: Publish to PyPI
78+
uses: pypa/gh-action-pypi-publish@release/v1
79+
with:
80+
password: ${{ secrets.PYPI_API_TOKEN }}
81+
82+
create-github-release:
83+
runs-on: ubuntu-latest
84+
needs: publish-pypi
85+
if: github.event_name == 'release'
86+
87+
steps:
88+
- uses: actions/checkout@v4
89+
90+
- uses: actions/download-artifact@v4
91+
with:
92+
name: dist
93+
path: dist/
94+
95+
- name: Upload release assets
96+
uses: softprops/action-gh-release@v1
97+
with:
98+
files: dist/*
99+
env:
100+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
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.11"
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/testiq
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
53+
54+
publish-to-testpypi:
55+
name: Publish to TestPyPI
56+
needs: [build]
57+
runs-on: ubuntu-latest
58+
if: github.event_name == 'workflow_dispatch'
59+
environment:
60+
name: testpypi
61+
url: https://test.pypi.org/p/testiq
62+
permissions:
63+
id-token: write
64+
65+
steps:
66+
- name: Download distributions
67+
uses: actions/download-artifact@v4
68+
with:
69+
name: python-package-distributions
70+
path: dist/
71+
72+
- name: Publish to TestPyPI
73+
uses: pypa/gh-action-pypi-publish@release/v1
74+
with:
75+
repository-url: https://test.pypi.org/legacy/

.github/workflows/test.yml

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
pull_request:
7+
branches: [ main, develop ]
8+
9+
jobs:
10+
test:
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
os: [ubuntu-latest, macos-latest, windows-latest]
16+
python-version: ['3.9', '3.10', '3.11', '3.12']
17+
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
- name: Set up Python ${{ matrix.python-version }}
22+
uses: actions/setup-python@v5
23+
with:
24+
python-version: ${{ matrix.python-version }}
25+
26+
- name: Install dependencies
27+
run: |
28+
python -m pip install --upgrade pip
29+
pip install -e ".[dev]"
30+
31+
- name: Lint with ruff
32+
run: |
33+
pip install ruff
34+
ruff check src/ tests/
35+
continue-on-error: true
36+
37+
- name: Format check with black
38+
run: |
39+
pip install black
40+
black --check src/ tests/
41+
continue-on-error: true
42+
43+
- name: Type check with mypy
44+
run: |
45+
pip install mypy
46+
mypy src/testiq --ignore-missing-imports
47+
continue-on-error: true
48+
49+
- name: Run tests with pytest
50+
run: |
51+
pytest tests/ -v --cov=src/testiq --cov-report=xml --cov-report=term
52+
53+
- name: Upload coverage to Codecov
54+
uses: codecov/codecov-action@v4
55+
with:
56+
file: ./coverage.xml
57+
flags: unittests
58+
name: codecov-${{ matrix.os }}-py${{ matrix.python-version }}
59+
fail_ci_if_error: false
60+
61+
quality-gate:
62+
runs-on: ubuntu-latest
63+
needs: test
64+
65+
steps:
66+
- uses: actions/checkout@v4
67+
68+
- name: Set up Python
69+
uses: actions/setup-python@v5
70+
with:
71+
python-version: '3.11'
72+
73+
- name: Install TestIQ
74+
run: |
75+
python -m pip install --upgrade pip
76+
pip install -e .
77+
78+
- name: Run tests with coverage
79+
run: |
80+
pip install pytest pytest-cov
81+
pytest --cov --cov-report=json
82+
83+
- name: Analyze test quality
84+
run: |
85+
testiq analyze coverage.json \
86+
--quality-gate \
87+
--max-duplicates 10 \
88+
--max-duplicate-percentage 5.0 \
89+
--save-baseline ci-baseline
90+
91+
- name: Generate HTML report
92+
run: |
93+
testiq analyze coverage.json --format html --output report.html
94+
continue-on-error: true
95+
96+
- name: Upload TestIQ report
97+
uses: actions/upload-artifact@v4
98+
with:
99+
name: testiq-report
100+
path: report.html
101+
if: always()
102+
103+
- name: Quality score check
104+
run: |
105+
testiq quality-score coverage.json --output quality-report.json
106+
continue-on-error: true

0 commit comments

Comments
 (0)