v0.13.0 #16
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: Ion Python Release | |
on: | |
release: | |
types: [ created ] | |
jobs: | |
test: | |
if: startsWith(github.ref, 'refs/tags/') | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ['3.8', '3.9', '3.10', '3.11', 'pypy-3.8'] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Create a virtual environment | |
run: git submodule init && git submodule update && python3 -m venv ./venv && . venv/bin/activate | |
- name: Install dependencies.. | |
run: | | |
pip install --upgrade setuptools | |
pip install -r requirements.txt | |
pip install -e . | |
- name: Run Tests | |
run: py.test --ignore tests/test_benchmark_cli.py --ignore tests/test_benchmark_spec.py | |
source-distribution: | |
if: startsWith(github.ref, 'refs/tags/') | |
name: Source distribution | |
runs-on: ubuntu-latest | |
needs: [test] | |
strategy: | |
matrix: | |
python-version: [ '3.10' ] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build sdist | |
run: python3 setup.py sdist | |
- name: Upload source to Github | |
uses: actions/upload-artifact@v4 | |
with: | |
name: source | |
path: ./dist/amazon.ion-*.tar.gz | |
- uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
role-skip-session-tagging: true | |
aws-region: us-west-2 | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }} | |
role-external-id: ${{ secrets.AWS_ROLE_EXTERNAL_ID }} | |
role-duration-seconds: 900 | |
- name: Upload source to s3 | |
run: | | |
zip ion-python-source ./dist/amazon.ion-*.tar.gz | |
aws s3 mv ion-python-source.zip ${{ secrets.AWS_SOURCE_BUCKET_URL }} --acl bucket-owner-full-control | |
- name: Install the released source from PYPI | |
run: | | |
sleep 300s | |
for (( i=0; i<3; i++ )) | |
do | |
v="" | |
if ! (pip install --no-binary :all: amazon.ion==${GITHUB_REF##*/v}) then | |
echo "Unable to install the desired version" | |
sleep 120s | |
continue | |
fi | |
v=$( pip show amazon.ion | grep Version ) | |
break | |
done | |
if [[ $v != "Version: ${GITHUB_REF##*/v}" ]] | |
then | |
echo "Exiting because unable to install the new version from PYPI" | |
exit 1 | |
fi | |
build-wheels: | |
name: Build wheels on ${{ matrix.os }} | |
if: startsWith(github.ref, 'refs/tags/') | |
needs: [test] | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: true | |
matrix: | |
include: | |
# See https://cibuildwheel.readthedocs.io/en/stable/options/#build-skip for more details. | |
- os: macos-13 # macos-13 is the last non-large x86-based runner. Need to look into cross-compiling. | |
arch: x86_64 | |
cibw_arch: "x86_64" | |
- os: macos-14 # https://github.com/actions/runner-images?tab=readme-ov-file#available-images | |
arch: arm64 | |
cibw_arch: "arm64" | |
- os: windows-latest | |
cibw_arch: "AMD64" | |
- os: ubuntu-latest | |
cibw_arch: "i686 x86_64 aarch64" | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build Wheels | |
uses: pypa/[email protected] | |
env: | |
CIBW_BUILD: "cp39-* cp310-* cp311-*" | |
CIBW_ARCHS: ${{ matrix.cibw_arch }} | |
- name: Upload wheels to Github | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wheels | |
path: ./wheelhouse/*.whl | |
upload-wheels: | |
name: Upload wheels to S3 | |
runs-on: [ubuntu-latest] | |
needs: [build-wheels] | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: wheels | |
- uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
role-skip-session-tagging: true | |
aws-region: us-west-2 | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }} | |
role-external-id: ${{ secrets.AWS_ROLE_EXTERNAL_ID }} | |
role-duration-seconds: 900 | |
- name: Upload wheels to s3 | |
run: | | |
zip ion-python-wheels ./*.whl | |
aws s3 mv ion-python-wheels.zip ${{ secrets.AWS_WHEELS_BUCKET_URL }} --acl bucket-owner-full-control | |
- name: Install the released wheels from PYPI | |
run: | | |
sleep 300s | |
for (( i=0; i<3; i++ )) | |
do | |
v="" | |
if ! (pip install --only-binary :all: amazon.ion==${GITHUB_REF##*/v}) then | |
echo "Unable to install the desired version" | |
sleep 120s | |
continue | |
fi | |
v=$( pip show amazon.ion | grep Version ) | |
break | |
done | |
if [[ $v != "Version: ${GITHUB_REF##*/v}" ]] | |
then | |
echo "Exiting because unable to install the new version from PYPI" | |
exit 1 | |
fi |