Skip to content
This repository has been archived by the owner on Oct 11, 2023. It is now read-only.

更新至 v2.1.0

更新至 v2.1.0 #271

name: Multiple Python Versions Test
on:
workflow_dispatch:
push:
paths:
- 'mys_goods_tool/**'
- '.github/workflows/python-package.yml'
- '__init__.py'
- 'pyproject.toml'
pull_request:
paths:
- 'mys_goods_tool/**'
- '.github/workflows/python-package.yml'
- '__init__.py'
- 'pyproject.toml'
permissions:
contents: read
env:
# Initialize vars context by reading it from env context
_: ${{ vars._ }}
jobs:
build-and-test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [ "3.9", "3.10", "3.11" ]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
curl -sSL https://install.python-poetry.org | python3 -
poetry install --with test
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
poetry run flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
poetry run flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
poetry run pytest -v --doctest-modules --capture=sys --html=report-${{ matrix.python-version }}.html --self-contained-html ${{ vars.V2_PATH }} --ignore=test --ignore=dev.py --ignore=mys_goods_tool_v1
- name: Upload pytest HTML result
uses: actions/upload-artifact@v3
with:
name: pytest-html-${{ matrix.python-version }}
path: report-${{ matrix.python-version }}.html
- name: Build package with Poetry
run: poetry build