Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch macOS CI to GitHub Actions #1839

Merged
merged 1 commit into from
Apr 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: CI

on: [push, pull_request]

jobs:
macOS:
runs-on: macos-latest

strategy:
fail-fast: false
matrix:
python-version: [2.7, 3.5, 3.6, 3.7, 3.8]

steps:
- name: Checkout Repository
uses: actions/checkout@v1
- name: Set Up Python 3.7 to run nox
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Set Up Python - ${{ matrix.python-version }}
if: matrix.python_version != '3.7'
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install Dependencies
run: |
python3.7 -m pip install --upgrade nox
- name: Run Tests
run: |
nox -s test-${{ matrix.python-version }}
- name: Upload Coverage
uses: codecov/codecov-action@v1
with:
file: ./coverage.xml
flags: unittests
name: codecov-umbrella
yml: ./codecov.yml
fail_ci_if_error: true
17 changes: 0 additions & 17 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,23 +62,6 @@ jobs:
- python: 3.7
env: NOX_SESSION=google_brotli-3

# OS X unit tests.
- language: generic
os: osx
env: NOX_SESSION=test-2.7
- language: generic
os: osx
env: NOX_SESSION=test-3.5
- language: generic
os: osx
env: NOX_SESSION=test-3.6
- language: generic
os: osx
env: NOX_SESSION=test-3.7
- language: generic
os: osx
env: NOX_SESSION=test-3.8

# Downstream integration tests.
- python: 2.7
env: DOWNSTREAM=requests
Expand Down
57 changes: 10 additions & 47 deletions _travis/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,54 +3,17 @@
set -exo pipefail


install_mac_python() {
local FULL=$1
local MINOR=$(echo $FULL | cut -d. -f1,2)
local PYTHON_EXE=/Library/Frameworks/Python.framework/Versions/${MINOR}/bin/python${MINOR}
if [[ "$MINOR" == "3.5" ]]; then
# The 3.5 python.org macOS build is only compiled with macOS 10.6
local COMPILER=10.6
else
local COMPILER=10.9
fi

curl -Lo macpython.pkg https://www.python.org/ftp/python/${FULL}/python-${FULL}-macosx${COMPILER}.pkg
sudo installer -pkg macpython.pkg -target /

# The pip in older MacPython releases doesn't support a new enough TLS
curl https://bootstrap.pypa.io/get-pip.py | sudo $PYTHON_EXE
$PYTHON_EXE -m pip install virtualenv
}


if [[ "$(uname -s)" == 'Darwin' ]]; then
# Mac OS setup.
case "${NOX_SESSION}" in
test-2.7) MACPYTHON=2.7.17 ;;
test-3.5) MACPYTHON=3.5.4 ;; # last binary release
test-3.6) MACPYTHON=3.6.8 ;; # last binary release
test-3.7) MACPYTHON=3.7.6 ;;
test-3.8) MACPYTHON=3.8.1 ;;
esac

install_mac_python $MACPYTHON

# Install Nox
python3 -m pip install nox

# Linux Setup
# Even when testing on Python 2, we need Python 3 for Nox. This detects if
# we're in one of the Travis Python 2 sessions and sets up the Python 3 install
# for Nox.
if ! python3 -m pip --version; then
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
sudo python3 get-pip.py
sudo python3 -m pip install nox
else
# Linux Setup
# Even when testing on Python 2, we need Python 3 for Nox. This detects if
# we're in one of the Travis Python 2 sessions and sets up the Python 3 install
# for Nox.
if ! python3 -m pip --version; then
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
sudo python3 get-pip.py
sudo python3 -m pip install nox
else
# We're not in "dual Python" mode, so we can just install Nox normally.
python3 -m pip install nox
fi
# We're not in "dual Python" mode, so we can just install Nox normally.
python3 -m pip install nox
fi

if [[ "${NOX_SESSION}" == "app_engine" ]]; then
Expand Down
7 changes: 1 addition & 6 deletions _travis/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,7 @@
set -exo pipefail

if [ -n "${NOX_SESSION}" ]; then
if [[ "$(uname -s)" == 'Darwin' ]]; then
# Explicitly use python3 on macOS as `nox` is not in the PATH
python3 -m nox -s "${NOX_SESSION}"
else
nox -s "${NOX_SESSION}"
fi
nox -s "${NOX_SESSION}"
else
downstream_script="${TRAVIS_BUILD_DIR}/_travis/downstream/${DOWNSTREAM}.sh"
if [ ! -x "$downstream_script" ]; then
Expand Down