Restrict workflow to sympy-1.12.* tags #230
Workflow file for this run
This file contains 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
# ------------------------------------------------------------------ # | |
# # | |
# SymPy CI script for Github Actions # | |
# # | |
# Run on the release branch and builds the release artifacts. # | |
# # | |
# ------------------------------------------------------------------ # | |
name: release | |
on: | |
push: | |
branches: | |
- '1.12' | |
tags: | |
- 'sympy-1.12.*' | |
pull_request: | |
branches: | |
- '1.12' | |
env: | |
release_branch: '1.12' | |
release_version: '1.12.1a2' | |
previous_version: '1.12' | |
jobs: | |
# -------------------- Build artifacts --------------------------- # | |
build: | |
runs-on: ubuntu-20.04 | |
steps: | |
# Check out with full git history for authors check: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Build release files | |
run: release/ci_release_script.sh ${{ env.release_version }} ${{ env.previous_version }} | |
- name: Store release files | |
uses: actions/upload-artifact@v4 | |
with: | |
name: release_files | |
path: release-${{ env.release_version }} | |
# -------------------- Test installation ------------------------- # | |
test-install: | |
needs: [build] | |
runs-on: ubuntu-20.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13-dev', 'pypy-3.8', 'pypy-3.9', 'pypy-3.10'] | |
name: Python ${{ matrix.python-version }} test install | |
steps: | |
- name: Setup python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
allow-preleases: true | |
- name: Retrieve release files | |
uses: actions/download-artifact@v4 | |
with: | |
name: release_files | |
- name: List files | |
run: ls -R | |
- name: Install wheel | |
run: pip install sympy-${{ env.release_version }}-py3-none-any.whl | |
- name: Run tests after install | |
run: python -c 'import sympy; sympy.test()' | |
# -------------------- Upload to Test-PyPI ----------------------- # | |
test-pypi-publish: | |
name: Publish to Test-PyPI | |
needs: [build] | |
# 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 | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download release artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: release_files | |
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@release/v1 | |
with: | |
repository-url: https://test.pypi.org/legacy/ | |
# -------------------- Upload to Test-PyPI ----------------------- # | |
pypi-publish: | |
name: Publish to PyPI | |
needs: [build] | |
# Run when a tag is pushed (not sure if this works) | |
if: "github.event_name == 'push' && startsWith(github.ref, 'refs/tags')" | |
environment: | |
name: pypi | |
url: https://pypi.org/p/sympy | |
permissions: | |
id-token: write | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download release artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: release_files | |
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@release/v1 |