-
Notifications
You must be signed in to change notification settings - Fork 0
168 lines (137 loc) · 4.51 KB
/
Copy pathci.yml
File metadata and controls
168 lines (137 loc) · 4.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
# .github/workflows/ci.yml
#
# Continuous Integration: runs on every push and pull request.
# Tests the package across Python versions and operating systems,
# enforces code quality (linting, formatting, type checking),
# and verifies the package builds correctly.
name: CI
on:
push:
branches: [master]
pull_request:
branches: [master]
workflow_dispatch:
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
env:
FORCE_COLOR: "1"
PIP_DISABLE_PIP_VERSION_CHECK: "1"
jobs:
# ── Job 1: Lint ─────────────────────────────────────────────
lint:
name: Lint & Type Check
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: "pip"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ".[dev]"
- name: Ruff (linting)
run: ruff check src tests
- name: Black (formatting)
run: black --check src tests
# mypy disabled until type annotations are cleaned up (105 errors in 23 files)
# - name: mypy (type checking)
# run: mypy src
# ── Job 2: Test ─────────────────────────────────────────────
test:
name: Test / Python ${{ matrix.python-version }} / ${{ matrix.os }}
runs-on: ${{ matrix.os }}
needs: lint
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.10", "3.11", "3.12"]
exclude:
- os: macos-latest
python-version: "3.10"
- os: windows-latest
python-version: "3.10"
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ".[dev,qiskit]"
- name: Run tests with coverage
run: |
pytest --cov=encoding_atlas --cov-report=xml --cov-report=term-missing --cov-fail-under=0 -v -m "not slow"
- name: Upload coverage to Codecov
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
flags: unittests
fail_ci_if_error: false
# Backend-specific tests (qiskit, cirq) disabled — no tests use
# requires_qiskit/requires_cirq markers yet. Re-enable when added.
# ── Job 4: Build Package ───────────────────────────────────
build:
name: Build Package
runs-on: ubuntu-latest
needs: test
timeout-minutes: 10
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: "pip"
- name: Install build tools
run: |
python -m pip install --upgrade pip
pip install build twine
- name: Build sdist and wheel
run: python -m build
- name: Validate package metadata
run: twine check dist/*
- name: Upload build artifacts
uses: actions/upload-artifact@v7
with:
name: dist
path: dist/
retention-days: 7
# ── Job 5: Build Documentation ─────────────────────────────
docs:
name: Build Documentation
runs-on: ubuntu-latest
needs: lint
timeout-minutes: 15
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: "pip"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ".[docs]"
- name: Build MkDocs (strict mode)
run: mkdocs build --strict