Repository navigation
docs: make Aiython easier to try and share (#9) #71
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |