Skip to content

Commit

Permalink
ci/gh actions (#79)
Browse files Browse the repository at this point in the history
* Resolve GitLab [#76]: Update dependencies to resolve failing tests

* ci: Adds .github/workflows/ci.yml

* docs: Adds CI status badge to README.md

Co-authored-by: Bryant Finney <finneybp@gmail.com>
  • Loading branch information
jshwi and bryant-finney committed Nov 16, 2021
1 parent 16ee940 commit 488ce93
Show file tree
Hide file tree
Showing 35 changed files with 851 additions and 703 deletions.
67 changes: 67 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: ci

on:
push:
branches:
- master

pull_request:

jobs:
ci:
name: test-${{ matrix.os }}-python${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
matrix:

# this works like a loop; think `pytest.mark.parametrize`
python-version: [2.7, 3.5, 3.6, 3.7, 3.8]
os: [ubuntu-latest, windows-latest, macos-latest]

steps:
- name: checkout build
id: checkout-build
uses: actions/checkout@v2

# with this we do not need to worry about the various ways in which
# each os installs python
- name: setup python
id: setup-python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: upgrade pip
id: upgrade-pip
run: |
python -m pip install --upgrade pip
# gets the path to wherever each os stores pip's cache
- name: get pip cache dir
id: get-pip-cache-dir
run: |
echo "::set-output name=dir::$(pip cache dir)"
- name: cache pip
uses: actions/cache@v2
id: cache-pip
with:

# set above with `get pip cache dir`
path: ${{ steps.get-pip-cache-dir.outputs.dir }}

# determines whether the hash of setup.py has changed
# CACHE_VERSION: slight hack, see https://stackoverflow.com/a/64819132
key: ${{ runner.os }}-pip-${{ secrets.CACHE_VERSION }}-${{ hashFiles('**/setup.py') }}

- name: install packages
id: install-packages
run: |
python -m pip install .[dev] codecov
- name: test
id: test

# python -m codecov only to run if exit status is 0
run: |
python -m pytest --cov=pipenv_setup --cov-report=xml && python -m codecov
13 changes: 13 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"overrides": [
{
"files": "Pipfile",
"options": { "parser": "toml" }
},
{
"files": "Pipfile.lock",
"options": { "parser": "json", "tabWidth": 4 }
}
],
"tabWidth": 2
}
256 changes: 127 additions & 129 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,142 +13,140 @@ before_cache:

jobs:
include:
# linux
- python: '3.8'
script: python3 -m tox -e py38 -- --cov-report=xml
- python: '3.7'
script: python3 -m tox -e py37 -- --cov-report=xml
- python: '3.6.9'
script: python3 -m tox -e py36 -- --cov-report=xml
- python: '3.5'
script: python3 -m tox -e py35 -- --cov-report=xml
- python: '2.7.17'
install: python -m pip install .[dev] codecov
script: python -m tox -e py27 -- --cov-report=xml
# linux
- python: "3.8"
script: python3 -m tox -e py38 -- --cov-report=xml
- python: "3.7"
script: python3 -m tox -e py37 -- --cov-report=xml
- python: "3.6.9"
script: python3 -m tox -e py36 -- --cov-report=xml
- python: "3.5"
script: python3 -m tox -e py35 -- --cov-report=xml
- python: "2.7.17"
install: python -m pip install .[dev] codecov
script: python -m tox -e py27 -- --cov-report=xml

# osx python 3.8
- name: "Python: 3.8"
os: osx
osx_image: xcode11
language: shell
cache:
directories:
- $HOME/Library/Caches/Homebrew
- /usr/local/Homebrew
# switch to python 3.8
addons:
homebrew:
update: true
before_install:
- pyenv install 3.8-dev
- pyenv global 3.8-dev
- export PATH="/Users/travis/.pyenv/shims:${PATH}"
# end switch
install: python3 -m pip install --user .[dev] codecov
script: python3 -m tox -e py38 -- --cov-report=xml
after_success: python3 -m codecov
# osx python 3.8
- name: "Python: 3.8"
os: osx
osx_image: xcode11
language: shell
cache:
directories:
- $HOME/Library/Caches/Homebrew
- /usr/local/Homebrew
# switch to python 3.8
addons:
homebrew:
update: true
before_install:
- pyenv install 3.8-dev
- pyenv global 3.8-dev
- export PATH="/Users/travis/.pyenv/shims:${PATH}"
# end switch
install: python3 -m pip install --user .[dev] codecov
script: python3 -m tox -e py38 -- --cov-report=xml
after_success: python3 -m codecov

# osx python 3.7
- name: "Python: 3.7"
os: osx
# xcode 11 image comes with python 3.7
osx_image: xcode11
# language: python will error
language: shell
install: python3 -m pip install --user .[dev] codecov
script: python3 -m tox -e py37 -- --cov-report=xml
after_success: python3 -m codecov
# osx python 3.7
- name: "Python: 3.7"
os: osx
# xcode 11 image comes with python 3.7
osx_image: xcode11
# language: python will error
language: shell
install: python3 -m pip install --user .[dev] codecov
script: python3 -m tox -e py37 -- --cov-report=xml
after_success: python3 -m codecov

# osx python 3.6.5
- name: "Python: 3.6.5"
os: osx
osx_image: xcode9.4 # Python 3.6.5 running on macOS 10.13
before_script: python3 --version
language: shell
install: python3 -m pip install --user .[dev] codecov
script: python3 -m tox -e py36 -- --cov-report=xml
after_success: python3 -m codecov
# osx python 3.6.5
- name: "Python: 3.6.5"
os: osx
osx_image: xcode9.4 # Python 3.6.5 running on macOS 10.13
before_script: python3 --version
language: shell
install: python3 -m pip install --user .[dev] codecov
script: python3 -m tox -e py36 -- --cov-report=xml
after_success: python3 -m codecov

# osx python 3.5
- name: "Python: 3.5.7"
os: osx
osx_image: xcode11
cache:
directories:
- $HOME/Library/Caches/Homebrew
- /usr/local/Homebrew
language: shell
# switch to python 3.5
addons:
homebrew:
update: true
before_install:
- pyenv install 3.5.7
- pyenv global 3.5.7
- export PATH="/Users/travis/.pyenv/shims:${PATH}"
- python3 -m pip install --user --upgrade pip
- python3 -m pip install --user --upgrade setuptools
# end switch
install: python3 -m pip install --user .[dev] codecov
# for some reason tox cannot find python3.5. we have to use py instead of py35
script: python3 -m tox -e py35 -- --cov-report=xml
after_success: python3 -m codecov
# osx python 3.5
- name: "Python: 3.5.7"
os: osx
osx_image: xcode11
cache:
directories:
- $HOME/Library/Caches/Homebrew
- /usr/local/Homebrew
language: shell
# switch to python 3.5
addons:
homebrew:
update: true
before_install:
- pyenv install 3.5.7
- pyenv global 3.5.7
- export PATH="/Users/travis/.pyenv/shims:${PATH}"
- python3 -m pip install --user --upgrade pip
- python3 -m pip install --user --upgrade setuptools
# end switch
install: python3 -m pip install --user .[dev] codecov
# for some reason tox cannot find python3.5. we have to use py instead of py35
script: python3 -m tox -e py35 -- --cov-report=xml
after_success: python3 -m codecov

# osx python 2.7.14
- name: "Python: 2.7.14"
os: osx
osx_image: xcode9.3 # Python 2.7.14_2 running on macOS 10.13
language: shell
before_install:
- python -m pip install --user --upgrade pip
- python -m pip install --user --upgrade setuptools
install: python -m pip install --user .[dev] codecov
script: python -m tox -e py27 -- --cov-report=xml
after_success: python -m codecov

# osx python 2.7.14
- name: "Python: 2.7.14"
os: osx
osx_image: xcode9.3 # Python 2.7.14_2 running on macOS 10.13
language: shell
before_install:
- python -m pip install --user --upgrade pip
- python -m pip install --user --upgrade setuptools
install: python -m pip install --user .[dev] codecov
script: python -m tox -e py27 -- --cov-report=xml
after_success: python -m codecov
# windows python 3.8
- name: "Python: 3.8"
os: windows
# language: python will error
language: shell
# install python 3.8
before_install:
- choco install python --version 3.8.0
- python -m pip install --upgrade pip
install: python -m pip install --user .[dev] codecov
# On Windows, python3 does not exist
script: python -m tox -e py38 -- --cov-report=xml
env: PATH=/c/Python38:/c/Python38/Scripts:$PATH
after_success: python -m codecov

# windows python 3.8
- name: "Python: 3.8"
os: windows
# language: python will error
language: shell
# install python 3.8
before_install:
- choco install python --version 3.8.0
- python -m pip install --upgrade pip
install: python -m pip install --user .[dev] codecov
# On Windows, python3 does not exist
script: python -m tox -e py38 -- --cov-report=xml
env: PATH=/c/Python38:/c/Python38/Scripts:$PATH
after_success: python -m codecov

# windows python 3.7
- name: "Python: 3.7"
os: windows
# language: python will error
language: shell
# install python 3.7
before_install:
- choco install python --version 3.7.4
- python -m pip install --upgrade pip
install: python -m pip install --user .[dev] codecov
# On Windows, python3 does not exist
script: python -m tox -e py37 -- --cov-report=xml
env: PATH=/c/Python37:/c/Python37/Scripts:$PATH
after_success: python -m codecov

# windows python 3.6
- name: "Python: 3.6"
os: windows
language: shell
before_install:
- choco install python --version 3.6.8
- python -m pip install --upgrade pip
install: python -m pip install --user .[dev] codecov
script: python -m tox -e py36 -- --cov-report=xml
env: PATH=/c/Python36:/c/Python36/Scripts:$PATH
after_success: python -m codecov
# windows python 3.7
- name: "Python: 3.7"
os: windows
# language: python will error
language: shell
# install python 3.7
before_install:
- choco install python --version 3.7.4
- python -m pip install --upgrade pip
install: python -m pip install --user .[dev] codecov
# On Windows, python3 does not exist
script: python -m tox -e py37 -- --cov-report=xml
env: PATH=/c/Python37:/c/Python37/Scripts:$PATH
after_success: python -m codecov

# windows python 3.6
- name: "Python: 3.6"
os: windows
language: shell
before_install:
- choco install python --version 3.6.8
- python -m pip install --upgrade pip
install: python -m pip install --user .[dev] codecov
script: python -m tox -e py36 -- --cov-report=xml
env: PATH=/c/Python36:/c/Python36/Scripts:$PATH
after_success: python -m codecov
# 3.5 and 2.7 on Windows are temporally disabled
# cuz a timeout issue on travis builds
# see this issue: https://github.com/Madoshakalaka/pipenv-setup/issues/31
Expand Down Expand Up @@ -176,4 +174,4 @@ jobs:
# install: python -m pip install --user .[dev] codecov
# script: python -m tox -e py27 -- --cov-report=xml
# env: PATH=/c/Python27:/c/Python27/Scripts:$PATH
# after_success: python -m codecov
# after_success: python -m codecov

0 comments on commit 488ce93

Please sign in to comment.