Skip to content

Commit

Permalink
Merge pull request #302 from python-adaptive/test-py39
Browse files Browse the repository at this point in the history
test tox with py39 on Github Actions CI
  • Loading branch information
basnijholt authored Mar 7, 2021
2 parents ae2ddf4 + fddcce8 commit b4475d7
Show file tree
Hide file tree
Showing 7 changed files with 93 additions and 105 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: coverage

on:
- push

jobs:
coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Install dependencies
run: pip install tox codecov
- name: Test with tox
run: tox -e py37-alldeps,report
- name: Upload test coverage
run: codecov -t ${{ secrets.CODECOV_TOKEN }} -f .coverage.xml
18 changes: 18 additions & 0 deletions .github/workflows/matchers/pytest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"problemMatcher": [
{
"owner": "python",
"pattern": [
{
"regexp": "^\\s*File\\s\\\"(.*)\\\",\\sline\\s(\\d+),\\sin\\s(.*)$",
"file": 1,
"line": 2
},
{
"regexp": "^\\s*raise\\s(.*)\\(\\'(.*)\\'\\)$",
"message": 2
}
]
}
]
}
14 changes: 14 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: pre-commit

on:
pull_request:
push:
branches: [master]

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: pre-commit/[email protected]
37 changes: 37 additions & 0 deletions .github/workflows/tox.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: tox

on:
pull_request:
push:
branches: [master]

jobs:
test:
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.6, 3.7, 3.8, 3.9]

steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Set Python version for tox
run: echo "PY_VERSION=$(echo py${version//./})" >> $GITHUB_ENV
shell: bash
env:
version: ${{ matrix.python-version }}
- name: Register Python problem matcher
run: echo "::add-matcher::.github/workflows/matchers/pytest.json"
- name: Install dependencies
run: pip install tox pytest-github-actions-annotate-failures
- name: Test with tox using minimal dependencies
run: tox -e ${{ env.PY_VERSION }}-mindeps
- name: Clean
run: tox -e clean
- name: Test with tox with all dependencies
run: tox -e ${{ env.PY_VERSION }}-alldeps
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.3.0
rev: v3.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
Expand All @@ -13,12 +13,12 @@ repos:
hooks:
- id: black
- repo: https://github.com/asottile/pyupgrade
rev: v2.7.3
rev: v2.10.0
hooks:
- id: pyupgrade
args: ['--py36-plus']
- repo: https://github.com/timothycrosley/isort
rev: 5.6.4
rev: 5.7.0
hooks:
- id: isort
- repo: https://gitlab.com/pycqa/flake8
Expand Down
95 changes: 0 additions & 95 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,101 +6,6 @@ pr:
- "*"

jobs:
- job: pytest
strategy:
# use cross-product when https://github.com/microsoft/azure-pipelines-yaml/issues/20 is solved
matrix:
UbuntuPy36:
python.version: '3.6'
vmImage: 'ubuntu-latest'
tox_env: 'py36'
UbuntuPy37:
python.version: '3.7'
vmImage: 'ubuntu-latest'
tox_env: 'py37'
UbuntuPy38:
python.version: '3.8'
vmImage: 'ubuntu-latest'
tox_env: 'py38'

macOSPy36:
python.version: '3.6'
vmImage: 'macOS-latest'
tox_env: 'py36'
macOSPy37:
python.version: '3.7'
vmImage: 'macOS-latest'
tox_env: 'py37'
macOSPy38:
python.version: '3.8'
vmImage: 'macOS-latest'
tox_env: 'py38'

WindowsServerPy36:
python.version: '3.6'
vmImage: 'vs2017-win2016'
tox_env: 'py36'
WindowsServerPy37:
python.version: '3.7'
vmImage: 'vs2017-win2016'
tox_env: 'py37'
WindowsServerPy38:
python.version: '3.8'
vmImage: 'vs2017-win2016'
tox_env: 'py38'

WindowsPy36:
python.version: '3.6'
vmImage: 'windows-latest'
tox_env: 'py36'
WindowsPy37:
python.version: '3.7'
vmImage: 'windows-latest'
tox_env: 'py37'
WindowsPy38:
python.version: '3.8'
vmImage: 'windows-latest'
tox_env: 'py38'

pool:
vmImage: '$(vmImage)'
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '$(python.version)'
- script: pip install tox
displayName: Install tox
- script: tox -e $(tox_env)-mindeps
displayName: Run the tests with minimal dependencies
- script: tox -e clean
displayName: Clean
- script: tox -e $(tox_env)-alldeps
displayName: Run the tests

- job: coverage
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.7'
- script: pip install tox
displayName: Install tox
- script: tox -e py37-alldeps,report
displayName: Run the tests and generate coverage
- script: |
pip install codecov
codecov -t $(CODECOV_TOKEN) -f .coverage.xml
displayName: Test upload coverage
- job: pre_commit
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.7'
- script: pip install tox
displayName: Install tox
- script: tox -e pre-commit
displayName: Lining tests

- job: authors_check
steps:
- script: |
Expand Down
8 changes: 1 addition & 7 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

[tox]
isolated_build = True
envlist = clean,py{36,37,38}-{mindeps,alldeps},report,pre-commit
envlist = clean,py{36,37,38,39}-{mindeps,alldeps},report

[pytest]
testpaths = adaptive
Expand Down Expand Up @@ -47,11 +46,6 @@ deps = coverage
skip_install = true
commands = coverage erase

[testenv:pre-commit]
skip_install = true
deps = pre-commit
commands = pre-commit run --all-files --show-diff-on-failure

[flake8]
max-line-length = 100
ignore = E501, W503, E203, E266, E741
Expand Down

0 comments on commit b4475d7

Please sign in to comment.