Skip to content

Commit

Permalink
Swap pip install
Browse files Browse the repository at this point in the history
  • Loading branch information
BryanFauble committed Dec 30, 2023
1 parent 4a7e728 commit 4fb3164
Showing 1 changed file with 56 additions and 110 deletions.
166 changes: 56 additions & 110 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -276,12 +276,13 @@ jobs:
python3 -m pip install --upgrade pip
python3 -m pip install setuptools
python3 -m pip install wheel
python3 -m pip install build
# install synapseclient
python3 setup.py install
python3 -m pip install .
# create distribution
python3 setup.py sdist bdist_wheel
python3 -m build
SDIST_PACKAGE_NAME="synapseclient-${{env.VERSION}}.tar.gz"
BDIST_PACKAGE_NAME="synapseclient-${{env.VERSION}}-py3-none-any.whl"
Expand Down Expand Up @@ -332,12 +333,11 @@ jobs:

# re-download the built package to the appropriate pypi server.
# we upload prereleases to test.pypi.org and releases to pypi.org.
deploy-test:
deploy:
needs: package
if: 'github.event.release.prerelease'
runs-on: ubuntu-latest
environment:
url: 'https://test.pypi.org/p/synapseclient'
url: ${{ github.event.release.prerelease == 'true' && 'https://test.pypi.org/p/synapseclient' || 'https://pypi.org/p/synapseclient' }}
name: pypi
permissions:
id-token: write
Expand All @@ -354,122 +354,68 @@ jobs:
name: ${{ needs.package.outputs.bdist-package-name }}
path: dist
- name: deploy-to-test-pypi
if: 'github.event.release.prerelease'
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/

deploy-prod:
needs: package
if: '!github.event.release.prerelease'
runs-on: ubuntu-latest
environment:
url: 'https://pypi.org/p/synapseclient'
name: pypi
permissions:
id-token: write
steps:
- name: download-sdist
uses: actions/download-artifact@v2
with:
name: ${{ needs.package.outputs.sdist-package-name }}
path: dist

- name: download-bdist
uses: actions/download-artifact@v2
with:
name: ${{ needs.package.outputs.bdist-package-name }}
path: dist
- name: deploy-to-prod-pypi
if: '!github.event.release.prerelease'
uses: pypa/gh-action-pypi-publish@release/v1
# - name: deploy-to-pypi
# shell: bash
# run: |
# python3 -m pip install twine

# if [[ "${{ github.event.release.prerelease}}" == "false" ]]; then
# # production deploy to prod pypi server
# on each of our matrix platforms, download the newly uploaded package from pypi and confirm its version
check-deploy:
needs: deploy

# PYPI_NAME="pypi"
# PYPI_URL="https://pypi.org"
# PYPI_REPO="https://upload.pypi.org/legacy/"
# PYPI_USERNAME="${{ secrets.PYPI_PROD_USERNAME }}"
# PYPI_PASSWORD="${{ secrets.PYPI_PROD_PASSWORD }}"
# else
# # staging deploy to test pypi server

# PYPI_NAME=testpypi
# PYPI_URL="https://test.pypi.org"
# PYPI_REPO=https://test.pypi.org/legacy/
# PYPI_USERNAME="${{ secrets.PYPI_TEST_USERNAME }}"
# PYPI_PASSWORD="${{ secrets.PYPI_TEST_PASSWORD }}"
# PYPI_INDEX_URL="https://test.pypi.org/simple/"
# fi
strategy:
matrix:
os: [ubuntu-20.04, macos-11, windows-2019]

# # create .pypirc file
# echo "[distutils]" > ~/.pypirc
# echo "index-servers=$PYPI_NAME" >> ~/.pypirc
# echo >> ~/.pypirc
# echo "[$PYPI_NAME]" >> ~/.pypirc
# echo "repository: $PYPI_REPO" >> ~/.pypirc
# echo "username:$PYPI_USERNAME" >> ~/.pypirc
# echo "password:$PYPI_PASSWORD" >> ~/.pypirc
# python versions should be consistent with the strategy matrix and the runs-integration-tests versions
python: [3.8, '3.9', '3.10', '3.11']

# twine upload --repository $PYPI_NAME dist/*
runs-on: ${{ matrix.os }}

# on each of our matrix platforms, download the newly uploaded package from pypi and confirm its version
# check-deploy:
# needs: deploy
steps:
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}

# strategy:
# matrix:
# os: [ubuntu-20.04, macos-11, windows-2019]
- name: check-pypi
shell: bash
run: |
if [[ "${{ github.event.release.prerelease}}" == "false" ]]; then
PYPI_INDEX_URL="https://pypi.org/simple/"
else
PYPI_INDEX_URL="https://test.pypi.org/simple/"
fi
# # python versions should be consistent with the strategy matrix and the runs-integration-tests versions
# python: [3.8, '3.9', '3.10', '3.11']
RELEASE_TAG="${{ github.event.release.tag_name }}"
if [[ $RELEASE_TAG =~ ^v?([[:digit:]\.]+)(-rc)? ]]; then
VERSION="${BASH_REMATCH[1]}"
if [[ "${{ github.event.release.prerelease}}" == "true" ]]; then
VERSION="$VERSION.$GITHUB_RUN_NUMBER"
fi
else
echo "Unrecognized release tag"
exit 1
fi
# runs-on: ${{ matrix.os }}
# it can take some time for the packages to become available in pypi after uploading
for i in 5 10 20 40; do
if pip3 install --index-url $PYPI_INDEX_URL --extra-index-url https://pypi.org/simple "synapseclient==$VERSION"; then
ACTUAL_VERSION=$(synapse --version)
# steps:
# - uses: actions/setup-python@v4
# with:
# python-version: ${{ matrix.python }}

# - name: check-pypi
# shell: bash
# run: |
# if [[ "${{ github.event.release.prerelease}}" == "false" ]]; then
# PYPI_INDEX_URL="https://pypi.org/simple/"
# else
# PYPI_INDEX_URL="https://test.pypi.org/simple/"
# fi

# RELEASE_TAG="${{ github.event.release.tag_name }}"
# if [[ $RELEASE_TAG =~ ^v?([[:digit:]\.]+)(-rc)? ]]; then
# VERSION="${BASH_REMATCH[1]}"
# if [[ "${{ github.event.release.prerelease}}" == "true" ]]; then
# VERSION="$VERSION.$GITHUB_RUN_NUMBER"
# fi
# else
# echo "Unrecognized release tag"
# exit 1
# fi

# # it can take some time for the packages to become available in pypi after uploading
# for i in 5 10 20 40; do
# if pip3 install --index-url $PYPI_INDEX_URL --extra-index-url https://pypi.org/simple "synapseclient==$VERSION"; then
# ACTUAL_VERSION=$(synapse --version)

# if [ -n "$(echo "$ACTUAL_VERSION" | grep -oF "$VERSION")" ]; then
# echo "Successfully installed version $VERSION"
# exit 0
# else
# echo "Expected version $VERSION, found $ACTUAL_VERSION instead"
# exit 1
# fi
# fi

# sleep $i
# done

# echo "Failed to install expected version $VERSION"
# exit 1
if [ -n "$(echo "$ACTUAL_VERSION" | grep -oF "$VERSION")" ]; then
echo "Successfully installed version $VERSION"
exit 0
else
echo "Expected version $VERSION, found $ACTUAL_VERSION instead"
exit 1
fi
fi
sleep $i
done
echo "Failed to install expected version $VERSION"
exit 1

0 comments on commit 4fb3164

Please sign in to comment.