Skip to content

tests

tests #258

Workflow file for this run

name: tests
on:
push:
branches: [main]
pull_request:
schedule:
# Run every Sunday
- cron: "0 0 * * 0"
workflow_dispatch:
jobs:
code-quality:
name: Code Quality
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry
poetry install
- name: Lint package
run: |
poetry run make lint
tests:
name: Tests (${{ matrix.os }}, Python ${{ matrix.python-version }})
needs: code-quality
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.7, 3.8, 3.9, "3.10", "3.11"]
defaults:
run:
shell: bash
steps:
- name: Disable git auto-CRLF for Windows
run: git config --global core.autocrlf false
if: ${{ matrix.os == 'windows-latest'}}
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry
poetry install
- name: Test package
run: |
poetry run make test
- name: Test docs
if: ${{ matrix.os == 'ubuntu-latest' && matrix.python-version == '3.10'}}
run: |
poetry run make docs
- name: Test building package
run: |
poetry run make build
if [[ ${{ matrix.os }} == "windows-latest" ]]; then
PYTHON_BIN=Scripts/python
else
PYTHON_BIN=bin/python
fi
# Test wheel install
python -m venv wheel-env
wheel-env/$PYTHON_BIN -m pip install dist/quickhttp-*.whl
wheel-env/$PYTHON_BIN -m quickhttp --version
# Test source install
python -m venv source-env
source-env/$PYTHON_BIN -m pip install dist/quickhttp-*.tar.gz
source-env/$PYTHON_BIN -m quickhttp --version
- name: Upload coverage to codecov
if: ${{ matrix.os == 'ubuntu-latest'}}
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
fail_ci_if_error: true
notify:
name: Notify failed build
needs: [code-quality, tests]
if: failure() && github.event.pull_request == null
runs-on: ubuntu-latest
steps:
- uses: jayqi/failed-build-issue-action@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}