From d4744b35e2f8564780dc0fa29cd387a9701aab8d Mon Sep 17 00:00:00 2001 From: "Mr. Python" <2789762371@qq.com> Date: Fri, 4 Oct 2024 13:36:01 +0800 Subject: [PATCH] Add GitHub Actions workflow for Python package testing --- .github/workflows/test.yml | 36 ++++++++++++++++++++++++++++++++++++ .gitignore | 2 ++ tox.ini | 21 ++++++++++++++++++++- 3 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..b190c4c --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,36 @@ +name: Python package + +on: + - push + - pull_request + +jobs: + build: + strategy: + matrix: + platform: [ubuntu-20.04, windows-latest] + runs-on: ${{ matrix.platform }} + steps: + - uses: actions/checkout@v3 + - name: Set up Python 3.6 + uses: actions/setup-python@v4 + with: + python-version: '3.6' + - name: Set up Python 3.8 + uses: actions/setup-python@v4 + with: + python-version: '3.8' + - name: Set up Python 3.10 + uses: actions/setup-python@v4 + with: + python-version: '3.10' + - name: Set up Python 3.12 + uses: actions/setup-python@v4 + with: + python-version: '3.12' + - name: Install dependencies + run: | + python3.12 -m pip install --upgrade pip + python3.12 -m pip install tox tox-gh-actions + - name: Test with tox + run: python3.12 -m tox diff --git a/.gitignore b/.gitignore index 66d0bc3..bf4997a 100644 --- a/.gitignore +++ b/.gitignore @@ -138,3 +138,5 @@ venv/ # VS Code .vscode + +.python-version diff --git a/tox.ini b/tox.ini index ed1e45d..6d58fae 100644 --- a/tox.ini +++ b/tox.ini @@ -1,2 +1,21 @@ +[tox] +envlist = py36, py37, py38, py39, py310, py311, py312 +requires = virtualenv < 20.22.0 +isolated_build = true + [testenv] -commands=python unit_test.py +deps = + xeger + colorful +commands = python unit_test.py +allowlist_externals = poetry + +[gh-actions] +python = + 3.6: py36 + 3.7: py37 + 3.8: py38 + 3.9: py39 + 3.10: py310 + 3.11: py311 + 3.12: py312