Skip to content

Commit

Permalink
try to use the proper python version
Browse files Browse the repository at this point in the history
  • Loading branch information
singergr-ctds committed Jun 26, 2020
1 parent 791e996 commit e6f126a
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 19 deletions.
19 changes: 15 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,26 +29,37 @@ jobs:
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}

# setup-python uses GitHub-provided Python builds that only run on
# macOS 10.14 and newer. To support older macOS versions, download
# and install the official build from python.org instead.
- name: Download and install macOS Python ${{ matrix.python }}
if: matrix.os == 'macos-latest'
run: |
wget https://www.python.org/ftp/python/${{ matrix.python }}/python-${{ matrix.python }}-macosx10.9.pkg
sudo installer -pkg python-${{ matrix.python }}-macosx10.9.pkg -target /
rm python-${{ matrix.python }}-macosx10.9.pkg
sudo ln -fs /usr/local/bin/python3 /usr/local/bin/python
python --version
hash python
python --version
- name: Run Tests
if: matrix.os != 'windows-latest'
run: |
python -m pip install --upgrade pip
pip install tox
tox -e py
python -m pip install --upgrade tox virtualenv
tox -e py3
- name: Package
env:
GDC_CLIENT_NO_ZIP: true
run: |
cd bin
pip install virtualenv
. ./package
echo ::set-env name=GDC_CLIENT_ZIP::$GDC_CLIENT_ZIP
shell: bash
- uses: actions/upload-artifact@v2
with:
name: ${{ env.GDC_CLIENT_ZIP }}-py${{ matrix.python }}-${{ matrix.os }}-TEST
path: bin/gdc-client_*.zip
path: bin/gdc-client
41 changes: 26 additions & 15 deletions bin/package
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

set -e

# TODO temp
python --version

function cleanup() {
# get rid of the virtualenv
echo "Cleaning up"
Expand Down Expand Up @@ -49,19 +52,18 @@ case $(uname -s) in
# why does windows have to be so different?
VENV_PATH="$VENV_NAME/Scripts/activate"

# Presumably Python3 is the only `python` in the Windows %PATH% variable
python -m virtualenv "$VENV_NAME"
source "$VENV_PATH"
pip install pywin32
python -m pip install pywin32
;;
*Linux*)
TARGET_ENVIRONMENT="Ubuntu"
python -m virtualenv "$VENV_NAME" --python=python3
python -m virtualenv "$VENV_NAME"
source "$VENV_PATH"
;;
*Darwin*)
TARGET_ENVIRONMENT="OSX"
python -m virtualenv "$VENV_NAME" --python=python3
python -m virtualenv "$VENV_NAME"
source "$VENV_PATH"
;;
esac
Expand All @@ -78,10 +80,10 @@ cd bin
echo "Building for ${TARGET_ENVIRONMENT}..."

# Make sure the correct version of pyinstaller and setuptools are installed
pip install -U "PyInstaller==3.5"
python -m pip install -U "PyInstaller==3.5"

# Ran into ModuleNotFoundError: No module named 'pkg_resources.py2_warn' with higher versions of setuptools
pip install --upgrade 'setuptools<45.0.0'
python -m pip install --upgrade 'setuptools<45.0.0'

# Get version
VERSION=$(python -c "
Expand All @@ -101,20 +103,29 @@ pyinstaller \
echo "Testing produced binary..."
./dist/$BINARY_NAME --help

# Zip dist
echo "Zipping binary..."
cd dist

PRE_ZIP_NAME="gdc-client_${VERSION}_${TARGET_ENVIRONMENT}_x64"
if [ -n "${DATE}" ]; then
PRE_ZIP_NAME="gdc-client_${VERSION}_${DATE}_${TARGET_ENVIRONMENT}_x64"
fi

ZIP_NAME="$PRE_ZIP_NAME.zip"
echo "The output zip file will be called ${ZIP_NAME}"
compress "$ZIP_NAME" "$BINARY_NAME"
mv "$ZIP_NAME" ..
cd ..
if [[ -z "$GDC_CLIENT_NO_ZIP" ]]; then
# Zip dist (default behavior)
echo "Zipping binary..."
cd dist

ZIP_NAME="$PRE_ZIP_NAME.zip"
echo "The output zip file will be called ${ZIP_NAME}"
compress "$ZIP_NAME" "$BINARY_NAME"
mv "$ZIP_NAME" ..
cd ..
else
# No-zip dist for CI workflows that zip artifacts themselves
echo "NOT Zipping binary"
echo "The output artifact will be called ${BINARY_NAME}"
mv "dist/${BINARY_NAME}" .
fi

cleanup

# Export the expected zip name for the final packaged artifact
export GDC_CLIENT_ZIP="$PRE_ZIP_NAME"

0 comments on commit e6f126a

Please sign in to comment.