Skip to content

Commit

Permalink
Implement python version text matrix; move black check to PR only (#30)
Browse files Browse the repository at this point in the history
* 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"
  • Loading branch information
rlskoeser authored Nov 10, 2022
1 parent c97ea87 commit c2e623b
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 5 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -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
11 changes: 6 additions & 5 deletions .github/workflows/ci.yml → .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI
name: unit tests

on:
push:
Expand All @@ -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: .
Expand All @@ -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
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit c2e623b

Please sign in to comment.