-
Notifications
You must be signed in to change notification settings - Fork 826
77 lines (72 loc) · 2.86 KB
/
build-test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support documentation.
# This workflow will do a clean install of python dependencies, build the source code and run tests across different versions of python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Build and Test
on:
push:
branches: [ '**' ]
pull_request:
branches: [ master ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build_test:
name: Build on Python ${{ matrix.python-version }} using ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11']
os: [ubuntu-latest, windows-latest]
exclude:
- os: windows-latest
python-version: '3.9'
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies (ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
pip3 install -r requirements.txt
pip3 install -r requirements-dev.txt
pip3 install --editable .
- name: Install dependencies (windows)
if: matrix.os == 'windows-latest'
run: |
pip3 install -r requirements.txt --use-deprecated=legacy-resolver
pip3 install -r requirements-dev.txt --use-deprecated=legacy-resolver
pip3 install --editable . --use-deprecated=legacy-resolver
- name: Execute Python 3.9 unit tests
if: matrix.python-version == '3.9'
run: |
pip3 install -U python-dotenv
py.test test/unit
- name: Execute Python 3.10 unit tests (windows)
if: matrix.python-version == '3.10' && matrix.os == 'windows-latest'
run: |
pip3 install -U python-dotenv
py.test test/unit --reruns 3
- name: Execute Python 3.10 unit tests (ubuntu)
if: matrix.python-version == '3.10' && matrix.os == 'ubuntu-latest'
run: |
pip3 install -U python-dotenv
py.test test/unit --reruns 3 --cov=ibm_watson
- name: Execute Python 3.11 unit tests (windows)
if: matrix.python-version == '3.11' && matrix.os == 'windows-latest'
run: |
pip3 install -U python-dotenv
py.test test/unit --reruns 3
- name: Execute Python 3.11 unit tests (ubuntu)
if: matrix.python-version == '3.11' && matrix.os == 'ubuntu-latest'
run: |
pip3 install -U python-dotenv
py.test test/unit --reruns 3
- name: Upload coverage to Codecov
if: matrix.python-version == '3.10' && matrix.os == 'ubuntu-latest'
uses: codecov/codecov-action@v1
with:
name: py${{ matrix.python-version }}-${{ matrix.os }}