Skip to content

Update unit_tests.yml to the workflow on windows, ubuntu, and macos. #136

Update unit_tests.yml to the workflow on windows, ubuntu, and macos.

Update unit_tests.yml to the workflow on windows, ubuntu, and macos. #136

Workflow file for this run

name: Tests and Lint
on: [ push ]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
python-version: [ "3.9", "3.10", "3.11" ]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ruff pytest coverage
pip install -r requirements.txt
- name: Lint with ruff
run: |
# stop the build if there are Python syntax errors or undefined names
ruff --format=github --select=E9,F63,F7,F82 --target-version=py37 .
# default set of ruff rules with GitHub Annotations
ruff --format=github --target-version=py37 .
continue-on-error: true
- name: List files in workspace
run: |
ls "${{ github.workspace }}"
- name: Run unit tests with coverage
env: # Add the env section with GITHUB_TOKEN
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
coverage run -m pytest tests/
coverage xml -o coverage.xml
- name: Upload coverage report
uses: actions/upload-artifact@v3
with:
name: coverage-report
path: coverage.xml
- name: Coveralls (Run only on Linux and macOS)
if: ${{ matrix.os != 'windows-latest' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: coverallsapp/github-action@v2