Skip to content

Package update

Package update #103

Workflow file for this run

name: Continuous Integration
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ main ]
pull_request:
branches: [ main ]
paths-ignore:
- '*.md'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build-python:
name: Test on ${{ matrix.os }}, Python ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10"]
os: [macOS-latest, ubuntu-latest, windows-latest]
defaults:
run:
shell: bash
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
#----------------------------------------------
# Check-out repo and set-up python
#----------------------------------------------
- name: Check out repository code
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
#----------------------------------------------
# Install dependencies
#----------------------------------------------
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest junit2html
#----------------------------------------------
# Lint with flake8
#----------------------------------------------
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
#----------------------------------------------
# Install & configure poetry
#----------------------------------------------
- name: Install poetry
run: |
python -m pip install poetry==1.3.1
- name: Configure poetry
run: |
python -m poetry config virtualenvs.in-project true
#----------------------------------------------
# load cached venv if cache exists
#----------------------------------------------
- name: Cache the virtualenv
uses: actions/cache@v2
with:
path: ./.venv
key: ${{ runner.os }}-venv-${{ hashFiles('**/poetry.lock') }}
#----------------------------------------------
# Install poetry dependencies
#----------------------------------------------
- name: Install dependencies
run: |
poetry install --with test
#----------------------------------------------
# Run test suite
#----------------------------------------------
- name: Run tests
run: |
poetry run python -m pytest tests --junitxml=junit/test-results.xml --cov=equalityml --cov-report term --cov-report=html
#----------------------------------------------
# Run junit2html
#----------------------------------------------
- name: Run junit2html
run: |
junit2html junit/test-results.xml test-results.html
#----------------------------------------------
# Upload pytest test results
#----------------------------------------------
- name: Upload pytest test results
uses: actions/upload-artifact@v3
with:
name: pytest-results
path: test-results.html
if: ${{ always() }}
#----------------------------------------------
# Upload pytest test coverage
#----------------------------------------------
- name: Upload pytest test coverage
uses: actions/upload-artifact@v3
with:
name: test-coverage
path: htmlcov
if: ${{ always() }}