Skip to content

[COST-4953] Specify operating system for testing purposes. (#507) #1082

[COST-4953] Specify operating system for testing purposes. (#507)

[COST-4953] Specify operating system for testing purposes. (#507) #1082

Workflow file for this run

name: Unit Tests
on:
pull_request:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-20.04
strategy:
max-parallel: 4
matrix:
python-version: [3.8]
steps:
- name: Checkout repsository
uses: actions/checkout@v3.2.0
with:
fetch-depth: 0
- name: Display build environment
run: printenv
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4.4.0
with:
python-version: ${{ matrix.python-version }}
- name: Install Pipenv
run: python -m pip install --upgrade pip pipenv
- name: Cache dependencies
id: cache-dependencies
uses: actions/cache@v3.2.2
with:
path: |
~/.cache/pipenv
~/.local/share/virtualenvs
key: ${{ runner.os }}-env-${{ matrix.python-version }}-${{ hashFiles('**/Pipfile.lock') }}-${{ secrets.ACTIONS_CACHE_KEY_UUID }}
- name: Install dependencies
if: steps.cache-dependencies.outputs.cache-hit != 'true'
run: |
pipenv install --dev --ignore-pipfile --python ${{ matrix.python-version }}
- name: Run sanity tests
run: pipenv run tox -e sanity
- name: Run unit tests
run: pipenv run coverage run -m unittest discover ./tests/ -v
- name: Convert coverage report to XML
run: pipenv run coverage xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4.2.0
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
file: ./coverage.xml
flags: unittests
name: Python-${{ matrix.python-version}}
fail_ci_if_error: true
plugin: pycoverage # Only run one plugin even though we don't want any to run.