v1.1.1 #50
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
name: Release to PyPI | |
on: | |
release: | |
types: [released] | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
environment: release | |
permissions: | |
# IMPORTANT: this permission is mandatory for trusted publishing | |
id-token: write | |
steps: | |
- name: Check out Pulser | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.ref }} | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.9 | |
- name: Install Python dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install setuptools wheel | |
- name: Build packages | |
shell: bash | |
run: ./.github/scripts/package.sh | |
- name: Publish to TestPyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
repository-url: https://test.pypi.org/legacy/ | |
- name: Install from TestPyPI | |
timeout-minutes: 5 | |
shell: bash | |
run: | | |
version="$(head -1 VERSION.txt)" | |
until pip install -i https://test.pypi.org/simple/ pulser==$version --extra-index-url https://pypi.org/simple | |
do | |
echo "Failed to install from TestPyPI, will wait for upload and retry." | |
sleep 30 | |
done | |
- name: Test the installation | |
# Installs pytest from dev_requirements.txt (in case it has a version specifier) | |
run: | | |
grep -e pytest dev_requirements.txt | sed 's/ //g' | xargs pip install | |
pytest | |
- name: Publish to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
- name: Confirm deployment | |
timeout-minutes: 5 | |
shell: bash | |
run: | | |
version="$(head -1 VERSION.txt)" | |
until pip download pulser==$version | |
do | |
echo "Failed to download from PyPI, will wait for upload and retry." | |
sleep 30 | |
done | |
check-release: | |
needs: deploy | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
python-version: ["3.9", "3.10", "3.11", "3.12"] | |
steps: | |
- name: Check out Pulser | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.ref }} | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install Pulser from PyPI | |
timeout-minutes: 5 | |
shell: bash | |
run: | | |
python -m pip install --upgrade pip | |
version="$(head -1 VERSION.txt)" | |
until pip install pulser==$version | |
do | |
echo "Failed to install from PyPI, will wait for upload and retry." | |
sleep 30 | |
done | |
- name: Test the installation | |
shell: bash | |
run: | | |
version="$(head -1 VERSION.txt)" | |
python -c "import pulser; assert pulser.__version__ == '$version'" | |
grep -e pytest dev_requirements.txt | sed 's/ //g' | xargs pip install | |
pytest |