Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/Python/Sympy/.github/workflows/     Datei vom 6.10.2026 mit Größe 9 kB image not shown  

Quelle  release.yml  Sprache: unbekannt

 
Spracherkennung für: .yml vermutete Sprache: SQL {SQL[45] MT940[43] ADA[18]} [Methode: maximale Elemente, drei Dimensionen]

# ------------------------------------------------------------------ #
#                                                                    #
#           SymPy CI script for Github Actions                       #
#                                                                    #
#   Run on the release branch and builds the release artifacts.      #
#                                                                    #
# ------------------------------------------------------------------ #

name: release
on:
  push:
    branches:
      - '1.15'
    tags:
      - 'sympy-1.15.*'
  pull_request:
    branches:
      - '1.15'

concurrency:
  group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
  cancel-in-progress: true

permissions:
  contents: read
env:
  release_branch: '1.15'
  release_version: '1.15.0.dev'
  final_release_version: '1.15.0'
  previous_version: '1.14.0'
  dev_version: '1.15-dev'

jobs:

  # -------------------- Build artifacts --------------------------- #

  build-packages:
    name: Build Packages

    runs-on: ubuntu-20.04
    steps:
      # Check out with full git history for authors check:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
        with:
          persist-credentials: false
          fetch-depth: 0

      - name: Setup Python
        uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
        with:
          python-version: '3.13'

      - name: Build release files
        run: |
          pip install --upgrade setuptools pip wheel build
          pip install .
          bin/mailmap_check.py --update-authors
          mkdir -p "release-$release_version"
          python -m build --wheel
          mv "dist/sympy-$release_version-py3-none-any.whl" "release-$release_version/"
          python -m build --sdist
          mv "dist/sympy-$release_version.tar.gz" "release-$release_version/"
          release/compare_tar_against_git.py "release-$release_version/sympy-$release_version.tar.gz" .
          release/authors.py "$release_version" "$previous_version" "release-$release_version"

      - name: Store package release files
        uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
        with:
          name: release_files_packages
          path: release-${{ env.release_version }}

  build-docs:
    name: Build Docs

    runs-on: ubuntu-20.04
    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
        with:
          persist-credentials: false

      - name: Setup Python
        uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
        with:
          python-version: '3.13'

      - name: Install docs build dependencies
        run: |
          doc/aptinstall.sh
          pip install -r doc/requirements.txt
          pip install .

      - name: Build release docs
        run: |
          mkdir -p "release-$release_version"
          python release/build_docs.py "$release_version" "release-$release_version"

      - name: Store docs release files
        uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
        with:
          name: release_files_docs
          path: release-${{ env.release_version }}

  # -------------------- Test installation ------------------------- #

  test-install:
    needs: [build-packages]

    runs-on: ubuntu-20.04
    strategy:
      fail-fast: false
      matrix:
        python-version: ['3.9', '3.10', '3.11', '3.12', '3.13-dev', 'pypy-3.9', 'pypy-3.10']

    name: Python ${{ matrix.python-version }} test install
    steps:
      - name: Setup python
        uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
        with:
          python-version: ${{ matrix.python-version }}

      - name: Retrieve release files
        uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
        with:
          name: release_files_packages

      - name: List files
        run: ls -R

      - name: Install wheel
        run: pip install "sympy-$release_version-py3-none-any.whl"

      - name: Install test-only dependencies
        run: pip install pytest pytest-xdist hypothesis

      - name: Run tests after install
        run: python -c 'import sympy; sympy.test(parallel=True)'

  # -------------------- Upload to Test-PyPI ----------------------- #

  test-pypi-publish:
    name: Publish to Test-PyPI
    needs: [build-packages]
    # Run when a pull request is merged into a release branch.
    if: "github.event_name == 'push' && ! startsWith(github.ref, 'refs/tags')"
    environment:
      name: test-pypi
      url: https://test.pypi.org/p/sympy
    permissions:
      id-token: write # to authenticate with trusted publishing
    runs-on: ubuntu-latest

    steps:
      - name: Download release artifacts
        uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
        with:
          name: release_files_packages
          path: dist.all

      - name: Copy the PyPI files into dist
        run: mkdir dist && cp dist.all/*.whl dist.all/*.tar.gz dist

      - name: Publish package on TestPyPI
        uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086  # v1.14.3
        with:
          repository-url: https://test.pypi.org/legacy/

  # -------------------- Upload to PyPI proper --------------------- #

  pypi-publish:
    name: Publish to PyPI
    needs: [build-packages]
    # Run when a tag is pushed
    if: "github.event_name == 'push' && startsWith(github.ref, 'refs/tags')"
    environment:
      name: pypi
      url: https://pypi.org/p/sympy
    permissions:
      id-token: write # to authenticate with trusted publishing
    runs-on: ubuntu-latest

    steps:
      - name: Download release artifacts
        uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
        with:
          name: release_files_packages
          path: dist.all

      - name: Copy the PyPI files into dist
        run: mkdir dist && cp dist.all/*.whl dist.all/*.tar.gz dist

      - name: Publish package on PyPI
        uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086  # v1.14.3

  # -------------------- Check if this is a final release ---------- #

  check-final:
    name: Check whether the release is final
    needs: [build-packages, build-docs, pypi-publish]
    runs-on: ubuntu-latest
    outputs:
      # The env context is not available in jobs.<job id>.if so we set it here
      is-final: ${{ env.release_version == env.final_release_version }}
    steps:
      - run: echo "null"

  # -------------------- Make a GitHub release --------------------- #

  github-publish:
    name: Publish GitHub release
    needs: [check-final]
    runs-on: ubuntu-latest
    permissions:
      contents: write # to create and update GitHub releases

    steps:
      - name: Checkout sympy
        uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
        with:
          persist-credentials: false

      - name: Setup Python
        uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
        with:
          python-version: '3.13'

      - name: Download release artifacts
        uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
        with:
          name: release_files_packages
          path: dist

      - name: Download docs release artifacts
        uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
        with:
          name: release_files_docs
          path: dist

      - name: Generate checksums
        run: python release/sha256.py "$release_version" dist

      - name: Create GitHub prerelease
        if: ${{ needs.check-final.outputs.is-final != 'true' }}
        env:
          GH_TOKEN: ${{ github.token }}
        run: >
          gh release create "sympy-$release_version" dist/*
              --prerelease
              --title "SymPy $release_version"
              --notes "See https://github.com/sympy/sympy/wiki/release-notes-for-$final_release_version for release notes"

      - name: Create Final GitHub release
        if: ${{ needs.check-final.outputs.is-final == 'true' }}
        env:
          GH_TOKEN: ${{ github.token }}
        run: >
          gh release create "sympy-$release_version" dist/*
              --title "SymPy $release_version"
              --notes "See https://github.com/sympy/sympy/wiki/release-notes-for-$final_release_version for release notes"

  # -------------------- Update the docs repository ---------------- #

  update-docs:
    name: Update the docs repository
    needs: [check-final]
    # Only run for a final release
    if: ${{ needs.check-final.outputs.is-final == 'true' }}
    runs-on: ubuntu-latest

    steps:
      - name: Checkout sympy
        uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
        with:
          persist-credentials: false

      # XXX: Keep credentials configured here so update_docs.py can git
      # pull/push via the SSH key in the checked-out sympy_doc repository.
      - name: Checkout sympy_doc # zizmor: ignore[artipacked]
        uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
        with:
          persist-credentials: true
          repository: sympy/sympy_doc
          ref: gh-pages
          ssh-key: ${{ secrets.SYMPY_DOC_RELEASE_PUSH_TOKEN }} # zizmor: ignore[secrets-outside-env]
          path: sympy_doc

      - run: git config --global user.name "SymPy GitHub Actions release bot"
      - run: git config --global user.email "<>"

      - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
        with:
          name: release_files_docs
          path: dist

      - name: Update the docs
        run: >
          release/update_docs.py
          sympy_doc
          "dist/sympy-docs-html-$release_version.zip"
          "$release_version"
          "$dev_version"
          --push

[Dauer der Verarbeitung: 0.14 Sekunden, vorverarbeitet 2026-11-14]