Repository navigation
146 lines (138 loc) · 5.64 KB
/
Copy pathtests.yml
File metadata and controls
146 lines (138 loc) · 5.64 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
name: Offline tests
on:
push:
branches: [main]
pull_request:
permissions:
contents: read
jobs:
changes:
runs-on: ubuntu-latest
outputs:
docs_only: ${{ steps.scope.outputs.docs_only }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false
- name: Check changed files
id: scope
env:
BASE_SHA: ${{ github.event.pull_request.base.sha || github.event.before }}
HEAD_SHA: ${{ github.sha }}
run: python3 scripts/ci_docs_only.py
package:
needs: changes
if: ${{ needs.changes.outputs.docs_only != 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
with:
python-version: "3.11.16"
version: latest-known
- run: uv build --no-sources
- run: uv venv --python 3.11.16 /tmp/aiython-wheel-smoke
- run: uv pip install --python /tmp/aiython-wheel-smoke/bin/python dist/*.whl
- run: /tmp/aiython-wheel-smoke/bin/aiython --version
- run: |
printf 'value = 1\nprint(value + 1)\n' > /tmp/aiython-wheel-smoke/plain.py
test "$(cd /tmp && /tmp/aiython-wheel-smoke/bin/aiython /tmp/aiython-wheel-smoke/plain.py)" = 2
test:
needs: changes
if: ${{ needs.changes.outputs.docs_only != 'true' }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.11.16", "3.12.14", "3.13.15", "3.14.4"]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
with:
python-version: ${{ matrix.python-version }}
version: latest-known
- run: uv python install ${{ matrix.python-version }}
- name: Prepare offline project credentials
run: |
mkdir -p .aiython
printf 'OPENROUTER_API_KEY=offline-test\n' > .aiython/credentials.env
- name: Check CPython frontend code objects
run: uv run --locked --python ${{ matrix.python-version }} python benchmarks/stdlib_syntax.py
- name: Test with line and branch coverage
env:
COVERAGE_PROCESS_START: ${{ github.workspace }}/.coveragerc
run: uv run --locked --python ${{ matrix.python-version }} --extra a2a python -m coverage run -m unittest discover -s tests -q
- name: Report coverage including subprocesses
run: |
uv run --locked --python ${{ matrix.python-version }} --extra a2a python -m coverage combine
uv run --locked --python ${{ matrix.python-version }} --extra a2a python -m coverage report
uv run --locked --python ${{ matrix.python-version }} --extra a2a python -m coverage json -o coverage.json
uv run --locked --python ${{ matrix.python-version }} python scripts/coverage_summary.py
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
if: always()
with:
name: coverage-${{ matrix.python-version }}
path: coverage.json
if-no-files-found: warn
native-hooks:
needs: changes
if: ${{ needs.changes.outputs.docs_only != 'true' }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.11.16", "3.12.14", "3.13.15", "3.14.4"]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
with:
python-version: ${{ matrix.python-version }}
version: latest-known
- name: Install CPython build headers
run: |
sudo apt-get update -qq
sudo apt-get install -y -qq build-essential pkg-config libbz2-dev libffi-dev \
libgdbm-dev libgdbm-compat-dev liblzma-dev libncurses-dev \
libreadline-dev libsqlite3-dev libssl-dev libzstd-dev tk-dev \
uuid-dev zlib1g-dev libnsl-dev libtirpc-dev
- name: Build and test patched CPython
run: uv run --locked --python ${{ matrix.python-version }} python scripts/build_cpython_hooks.py ${{ matrix.python-version }}
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
with:
python-version: "3.11.16"
version: latest-known
enable-cache: false
- run: uv run --locked --python 3.11.16 zensical build --clean --strict
- run: uv run --locked --python 3.11.16 python scripts/check_docs_site.py
required:
name: CI
if: ${{ always() }}
needs: [changes, package, test, native-hooks, docs]
runs-on: ubuntu-latest
steps:
- name: Require the right jobs to pass
env:
CHANGES: ${{ needs.changes.result }}
DOCS_ONLY: ${{ needs.changes.outputs.docs_only }}
PACKAGE: ${{ needs.package.result }}
TEST: ${{ needs.test.result }}
NATIVE_HOOKS: ${{ needs.native-hooks.result }}
DOCS: ${{ needs.docs.result }}
run: |
test "$CHANGES" = success
test "$DOCS" = success
if [ "$DOCS_ONLY" = true ]; then
expected=skipped
else
expected=success
fi
for result in "$PACKAGE" "$TEST" "$NATIVE_HOOKS"; do
test "$result" = "$expected" || exit 1
done