build(deploy): upgrade to setup-node v2 #299
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 }} |