From 4f786cef4672da56966bc16cc293f1e754630df0 Mon Sep 17 00:00:00 2001 From: Alex Leith Date: Wed, 29 Jun 2022 11:48:48 +1000 Subject: [PATCH] Add Black linting to CI --- .github/workflows/test.yml | 11 +++++++++++ setup.py | 4 +++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 43364d6..9789888 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -15,19 +15,30 @@ jobs: python-version: [ '3.5', '3.8' ] steps: - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} + - name: Install dependencies run: | python -m pip install --upgrade pip pip install "numpy<1.19.0" pip install -r test_requirements.txt pip install pytest-cov + + - name: Run Black check for formatting + if: ${{ matrix.python-version != '3.5' }} + run: | + # Need to manually install Black while we support Python 3.5 + pip install black + black --check . + - name: Test with pytest run: | pytest --cov=./ --cov-report=xml + - name: Upload coverage to Codecov uses: codecov/codecov-action@v1 with: diff --git a/setup.py b/setup.py index be44198..4a2ab09 100644 --- a/setup.py +++ b/setup.py @@ -9,7 +9,9 @@ ] TESTS_REQUIRE = [ - 'pytest' + 'pytest', + # Need to manually install Black while we support Python 3.5 + # 'black' ] EXTRAS_REQUIRE = {