-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds Github Actions for release automation. (#199)
- Loading branch information
Showing
5 changed files
with
178 additions
and
4 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,173 @@ | ||
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.6', '3.7', '3.8', '3.9', '3.10', 'pypy-3.6', 'pypy-3.7', 'pypy-3.8' ] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up python | ||
uses: actions/setup-python@v3 | ||
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 | ||
- run: pip install -r requirements.txt | ||
- run: pip install -e . | ||
- run: py.test | ||
|
||
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@v3 | ||
|
||
- name: Build sdist | ||
run: python3 setup.py sdist | ||
|
||
- name: Upload source to Github | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: source | ||
path: ./dist/amazon.ion-*.tar.gz | ||
|
||
- uses: aws-actions/configure-aws-credentials@v1 | ||
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: | ||
python-version: [ '3.10'] | ||
os: [macos-latest, windows-latest, ubuntu-latest] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up pip and setuptools | ||
run: | | ||
pip3 install -U pip | ||
pip3 install -U setuptools | ||
- name: Set up QEMU | ||
if: runner.os == 'Linux' | ||
uses: docker/setup-qemu-action@v1 | ||
with: | ||
platforms: all | ||
|
||
- name: Install cibuildwheel | ||
run: python3 -m pip install cibuildwheel==2.4.0 | ||
|
||
- name: Build wheels | ||
run: python3 -m cibuildwheel --output-dir wheelhouse | ||
env: | ||
CIBW_SKIP: "pp* *-win32" | ||
CIBW_ARCHS_WINDOWS: "auto" | ||
CIBW_ARCHS_LINUX: "auto aarch64" | ||
CIBW_ARCHS_MACOS: "x86_64" | ||
|
||
- name: Upload wheels to Github | ||
uses: actions/upload-artifact@v2 | ||
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@v2 | ||
with: | ||
name: wheels | ||
|
||
- uses: aws-actions/configure-aws-credentials@v1 | ||
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 |
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
Submodule ion-c
updated
from 9310a9 to 2671a0
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,4 +14,4 @@ six==1.16.0 | |
toml==0.10.2 | ||
tox==3.23.1 | ||
virtualenv==20.4.7 | ||
setuptools==60.5.0 | ||
setuptools<=60.5.0 |