Try a macOS test on github

This commit is contained in:
James Morris
2020-12-10 16:45:21 -05:00
parent 35b2654154
commit 73aeae7c11
3 changed files with 9 additions and 26 deletions

View File

@@ -2,9 +2,10 @@ name: run-tox
on: [push, pull_request]
jobs:
unit-tests:
runs-on: ubuntu-16.04
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-16.04, macos-10.15]
python-version: [3.5, 3.6, 3.7, 3.8, 3.9]
steps:
@@ -16,10 +17,10 @@ jobs:
- name: Install requirements
run: |
sed -i -e 's/^/#/' tests/gnupghome/gpg-agent.conf
./install_dependencies.linux.sh
[ $(uname) = "Darwin"] && ./install_dependencies.osx.sh || ./install_dependencies.linux.sh
pip install tox
- name: Run Tox
run: tox -e py
run: ./tox.sh -e py
test-setup:
runs-on: ubuntu-16.04

View File

@@ -1,22 +1,4 @@
#!/bin/bash
# mapping to get from the TRAVIS_PYTHON_VERSION environment variable to something pyenv understands
# this will need to be manually kept up to date until travis support for python on osx improves
declare -A pyver
pyver["2.7"]="2.7.13"
pyver["3.4"]="3.4.6"
pyver["3.5"]="3.5.3"
pyver["3.6"]="3.6.0"
pyver["3.7"]="3.7.0"
pyver["pypy"]="pypy2-5.6.0"
pyver["pypy3"]="pypy3.3-5.5-alpha"
sudo brew update
# travis doesn't natively support python on osx yet, so start by installing pyenv
# also install newer openssl here
sudo brew install -y pyenv openssl
# now install the requested version of python, and set it to local
pyenv install ${pyver[${TRAVIS_PYTHON_VERSION}]}
pyenv local ${pyver[${TRAVIS_PYTHON_VERSION}]}
# make sure libffi-dev, gnupg2, pgpdump, and newer openssl are installed as well
sudo brew install -y libffi-dev gnupg2 pgpdump
brew update
brew install -y libffi-dev gnupg2 pgpdump openssl@1.1

6
tox.sh
View File

@@ -1,10 +1,10 @@
#!/bin/bash
# homebrew is installed and so is a brewed openssl
if [[ $(uname) == "Darwin" ]] && command -v brew &>/dev/null && brew list openssl &>/dev/null; then
if [[ $(uname) == "Darwin" ]] && command -v brew &>/dev/null && brew list openssl@1.1 &>/dev/null; then
export ARCHFLAGS="-arch x86_64"
export LDFLAGS="-L/usr/local/opt/openssl/lib"
export CFLAGS="-I/usr/local/opt/openssl/include"
export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib"
export CFLAGS="-I/usr/local/opt/openssl@1.1/include"
fi
exec tox $*