Skip to content

Unit Testing

Unit Testing #61

name: Unit Testing
on:
pull_request:
workflow_dispatch:
schedule:
- cron: "0 4 * * *"
push:
tags:
- "*"
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
macOS:
runs-on: macos-latest
name: Mac OS Unit Testing
strategy:
fail-fast: false
matrix:
python-version: ['3.9', '3.11']
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: pyproject.toml
- name: Install npt-promote
run: pip install ".[dev]"
- name: Run Tests
run: pytest
- name: Software Report
if: always()
run: |
which python
pip list
Linux:
name: Linux Unit Testing
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Build wheel and install npt-promote
run: |
pip install build
python -m build --wheel
pip install dist/npt_promote*.whl
- name: Install Testing Requirements
run: pip install ".[dev]"
- name: Run Tests
run: python -m pytest
- name: Software Report
if: always()
run: |
which python
pip list
- name: Check package
run: |
pip install build twine
python -m build
twine check --strict dist/*
- name: Upload to PyPi
if: matrix.python-version == '3.9' && startsWith(github.ref, 'refs/tags/v')
run: |
twine upload --skip-existing dist/npt_promote*
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
TWINE_REPOSITORY_URL: "https://upload.pypi.org/legacy/"
windows:
name: Windows Unit Testing
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: pyproject.toml
- name: Install npt-promote
run: pip install ".[dev]"
- name: Run Tests
run: pytest
- name: Software Report
if: always()
run: |
which python
pip list