Skip to content

Commit b9b7d8a

Browse files
ci(gha): Switch CI from Travis to GHA (#791)
* ci: revisit GHA * ci(gha): ready CI for production release * ci(gha): add windows testing with legacy resolver * ci(gha): remove python 3.6/3.7 for windows Co-authored-by: Angelo Paparazzi <Angelo.Paparazzi@ibm.com>
1 parent 07b40c1 commit b9b7d8a

File tree

7 files changed

+47
-73
lines changed

7 files changed

+47
-73
lines changed

.bumpversion.cfg

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ commit = True
66
search = __version__ = '{current_version}'
77
replace = __version__ = '{new_version}'
88

9-
[bumpversion:file:setup.py]
10-
search = __version__ = '{current_version}'
11-
replace = __version__ = '{new_version}'
9+
[bumpversion:file:setup.cfg]
10+
search = version = '{current_version}'
11+
replace = version = '{new_version}'

.github/workflows/build-test.yml

Lines changed: 31 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,36 +17,53 @@ on:
1717

1818
jobs:
1919
build_test:
20-
name: Build and Test on Python ${{ matrix.python-version }} and ${{ matrix.os }}
20+
name: Build on Python ${{ matrix.python-version }} using ${{ matrix.os }}
2121
runs-on: ${{ matrix.os }}
2222
strategy:
2323
matrix:
24-
python-version: ['3.5', '3.6', '3.7', '3.8']
25-
os: [ubuntu-latest]
24+
python-version: ['3.6', '3.7', '3.8']
25+
os: [ubuntu-latest, windows-latest]
26+
exclude:
27+
- os: windows-latest
28+
python-version: '3.6'
29+
- os: windows-latest
30+
python-version: '3.7'
2631

2732
steps:
2833
- uses: actions/checkout@v2
2934
- name: Set up Python
3035
uses: actions/setup-python@v2
3136
with:
3237
python-version: ${{ matrix.python-version }}
33-
- name: Install dependencies
38+
- name: Install dependencies (ubuntu)
39+
if: matrix.os == 'ubuntu-latest'
3440
run: |
3541
pip3 install -r requirements.txt
36-
pip3 install -r requirements-dev.txt --use-deprecated=legacy-resolver
42+
pip3 install -r requirements-dev.txt
3743
pip3 install --editable .
38-
- name: Execute Python unit tests for code coverage
39-
if: matrix.python-version == '3.5'
44+
- name: Install dependencies (windows)
45+
if: matrix.os == 'windows-latest'
46+
run: |
47+
pip3 install -r requirements.txt --use-deprecated=legacy-resolver
48+
pip3 install -r requirements-dev.txt --use-deprecated=legacy-resolver
49+
pip3 install --editable . --use-deprecated=legacy-resolver
50+
- name: Execute Python 3.6/3.7 unit tests
51+
if: matrix.python-version != '3.8'
52+
run: |
53+
pip3 install -U python-dotenv
54+
py.test test/unit
55+
- name: Execute Python 3.8 unit tests (windows)
56+
if: matrix.os == 'windows-latest'
4057
run: |
4158
pip3 install -U python-dotenv
42-
py.test --reruns 3 --cov=ibm_watson
59+
py.test test/unit --reruns 3
60+
- name: Execute Python 3.8 unit tests (ubuntu)
61+
if: matrix.python-version == '3.8' && matrix.os == 'ubuntu-latest'
62+
run: |
63+
pip3 install -U python-dotenv
64+
py.test test/unit --reruns 3 --cov=ibm_watson
4365
- name: Upload coverage to Codecov
44-
if: matrix.python-version == '3.5'
66+
if: matrix.python-version == '3.8' && matrix.os == 'ubuntu-latest'
4567
uses: codecov/codecov-action@v1
4668
with:
4769
name: py${{ matrix.python-version }}-${{ matrix.os }}
48-
- name: Execute Python unit tests
49-
if: matrix.python-version != '3.5'
50-
run: |
51-
pip3 install -U python-dotenv
52-
py.test

.github/workflows/deploy.yml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ on:
1212
branches: [ master ]
1313
types:
1414
- completed
15-
1615
# Allows you to run this workflow manually from the Actions tab
1716
workflow_dispatch:
1817

@@ -34,11 +33,6 @@ jobs:
3433
uses: actions/setup-node@v1
3534
with:
3635
node-version: 12
37-
- name: Install dependencies
38-
run: |
39-
pip3 install -r requirements.txt
40-
pip3 install -r requirements-dev.txt --use-deprecated=legacy-resolver
41-
pip3 install --editable .
4236
- name: Install Semantic Release dependencies
4337
run: |
4438
sudo apt-get install bumpversion
@@ -49,8 +43,10 @@ jobs:
4943
npm install -g @semantic-release/github
5044
npm install -g @semantic-release/commit-analyzer
5145
npm install -g @semantic-release/release-notes-generator
46+
npm install -g semantic-release-pypi
47+
pip3 install setuptools wheel twine
5248
- name: Publish js docs
53-
if: github.event.workflow_run.conclusion == 'success' && startsWith(github.ref, 'refs/tags')
49+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
5450
env:
5551
GH_TOKEN: ${{ secrets.GH_TOKEN }}
5652
GHA_BRANCH: ${{ github.ref }} # non PR only need to get last part
@@ -63,6 +59,7 @@ jobs:
6359
env:
6460
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
6561
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
66-
run: npx semantic-release --dry-run
62+
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
63+
run: npx semantic-release #--dry-run --branches 9388_gha Uncomment for testxing purposes
6764
- name: Build binary wheel and a source tarball
6865
run: python setup.py sdist

.releaserc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@
1616
"message": "chore(release): ${nextRelease.version} release notes\n\n${nextRelease.notes}"
1717
}
1818
],
19+
[
20+
"semantic-release-pypi",
21+
{
22+
"repoUrl": "https://upload.pypi.org/legacy"
23+
}
24+
],
1925
"@semantic-release/github"
2026
]
2127
}

.travis.yml

Lines changed: 0 additions & 45 deletions
This file was deleted.

setup.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[metadata]
2+
version = 5.2.0

setup.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
import os
1919
import sys
2020

21-
__version__ = '5.2.0'
22-
2321

2422
if sys.argv[-1] == 'publish':
2523
# test server
@@ -61,7 +59,6 @@ def run_tests(self):
6159

6260

6361
setup(name='ibm-watson',
64-
version=__version__,
6562
description='Client library to use the IBM Watson Services',
6663
license='Apache 2.0',
6764
install_requires=['requests>=2.0, <3.0', 'python_dateutil>=2.5.3', 'websocket-client==0.48.0', 'ibm_cloud_sdk_core>=3.3.6, == 3.*'],

0 commit comments

Comments
 (0)