From c2e623be0587f9c58686ded4f2ea4d1305cf4c3e Mon Sep 17 00:00:00 2001 From: Rebecca Sutton Koeser Date: Thu, 10 Nov 2022 15:23:42 -0500 Subject: [PATCH] Implement python version text matrix; move black check to PR only (#30) * Implement python version text matrix; move black check to PR only ref #13 * Use strings for python versions so 3.10 doesn't turn into 3.1 * Add badges to readme for unit tests, python black, and apache 2 license * Update python versions in setup.py to match tested versions * Rename workflow to "style check" --- .github/workflows/check.yml | 26 ++++++++++++++++++++ .github/workflows/{ci.yml => unit_tests.yml} | 11 +++++---- README.md | 3 +++ setup.py | 2 ++ 4 files changed, 37 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/check.yml rename .github/workflows/{ci.yml => unit_tests.yml} (79%) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml new file mode 100644 index 0000000..c5bdf24 --- /dev/null +++ b/.github/workflows/check.yml @@ -0,0 +1,26 @@ +name: style check + +on: + pull_request: + +jobs: + check: + runs-on: ubuntu-latest + + defaults: + run: + working-directory: . + + steps: + - uses: actions/checkout@v3 + - name: Set up Python 3.9 + uses: actions/setup-python@v4 + with: + python-version: 3.9 + cache: 'pip' + cache-dependency-path: '**/setup.py' + - name: Install package with dependencies + run: pip install -e ".[dev]" + if: steps.python-cache.outputs.cache-hit != 'true' + - name: Run black + run: black undate --check --diff diff --git a/.github/workflows/ci.yml b/.github/workflows/unit_tests.yml similarity index 79% rename from .github/workflows/ci.yml rename to .github/workflows/unit_tests.yml index 063b996..35ec10f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/unit_tests.yml @@ -1,4 +1,4 @@ -name: CI +name: unit tests on: push: @@ -10,8 +10,11 @@ on: pull_request: jobs: - qa: + python-unit: runs-on: ubuntu-latest + strategy: + matrix: + python: ["3.8", "3.9", "3.10", "3.11"] defaults: run: working-directory: . @@ -21,13 +24,11 @@ jobs: - name: Set up Python 3.9 uses: actions/setup-python@v4 with: - python-version: 3.9 + python-version: ${{ matrix.python }} cache: 'pip' cache-dependency-path: '**/setup.py' - name: Install package with dependencies run: pip install -e ".[dev]" if: steps.python-cache.outputs.cache-hit != 'true' - - name: Run black - run: black undate --check --diff - name: Run unit tests run: pytest diff --git a/README.md b/README.md index 4157fb3..c26d0d1 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,9 @@ Repository for the DHTech 2022 Hackathon +[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) +[![unit tests](https://github.com/dh-tech/hackathon-2022/actions/workflows/unit_tests.yml/badge.svg)](https://github.com/dh-tech/hackathon-2022/actions/workflows/unit_tests.yml) +[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) ## License diff --git a/setup.py b/setup.py index f8b8c0c..f714111 100644 --- a/setup.py +++ b/setup.py @@ -41,6 +41,8 @@ "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: Utilities", "Typing :: Typed",