Skip to content

Commit a8910a5

Browse files
committed
feat: add linter workflow.
1 parent 41fc7de commit a8910a5

File tree

4 files changed

+72
-24
lines changed

4 files changed

+72
-24
lines changed

.github/workflows/lint.yml

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: lint
2+
3+
on:
4+
push:
5+
pull_request:
6+
types: [ opened, reopened, synchronize ]
7+
8+
jobs:
9+
check:
10+
runs-on: ubuntu-latest
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
python-version: [ '3.10', '3.x' ]
15+
16+
name: check ${{ matrix.python-version }}
17+
steps:
18+
- uses: actions/checkout@v2
19+
with:
20+
fetch-depth: 0
21+
22+
- name: Set up CPython ${{ matrix.python-version }}
23+
uses: actions/setup-python@v3
24+
with:
25+
python-version: ${{ matrix.python-version }}
26+
27+
- name: Install dependencies
28+
id: install-deps
29+
run: py -m pip install -U -r requirements_dev.txt
30+
31+
- name: Run mypy
32+
run: py -m mypy ./src/ ./tests/
33+
no-comments: ${{ matrix.python-version != '3.x' }}
34+
35+
- name: Run flake8
36+
if: ${{ always() && steps.install-deps.outcome == 'success' }}
37+
run: flake8 src tests

.github/workflows/publish-to-pypi.yml

+22-21
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,31 @@
11
name: Publish Python 🐍 distributions 📦 to PyPI and TestPyPI
2-
on: push
2+
3+
on:
4+
push:
5+
pull_request:
6+
types: [ opened, reopened, synchronize ]
7+
38
jobs:
49
build-n-publish:
10+
runs-on: ubuntu-latest
11+
512
name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI
6-
runs-on: ubuntu-18.04
713
steps:
8-
- uses: actions/checkout@v3
9-
- name: Set up Python 3.10
10-
uses: actions/setup-python@v3
11-
with:
12-
python-version: '3.10'
14+
- uses: actions/checkout@v3
1315

14-
- name: Install pypa/build
15-
run: python -m pip install build --user
16+
- name: Set up Python 3.10
17+
uses: actions/setup-python@v3
18+
with:
19+
python-version: '3.10'
1620

17-
- name: Build a binary wheel and a source tarball
18-
run: python -m build --sdist --wheel --outdir dist/ .
21+
- name: Install pypa/build
22+
run: python -m pip install build --user
1923

20-
# - name: Publish distribution 📦 to Test PyPI
21-
# uses: pypa/[email protected]
22-
# with:
23-
# password: ${{ secrets.TEST_PYPI_API_TOKEN }}
24-
# repository_url: https://test.pypi.org/legacy/
24+
- name: Build a binary wheel and a source tarball
25+
run: python -m build --sdist --wheel --outdir dist/ .
2526

26-
- name: Publish distribution 📦 to PyPI
27-
if: startsWith(github.ref, 'refs/tags')
28-
uses: pypa/[email protected]
29-
with:
30-
password: ${{ secrets.PYPI_API_TOKEN }}
27+
- name: Publish distribution 📦 to PyPI
28+
if: startsWith(github.ref, 'refs/tags')
29+
uses: pypa/[email protected]
30+
with:
31+
password: ${{ secrets.PYPI_API_TOKEN }}

setup.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ url = https://github.com/AiroPi/connect4-python-module
77
author = airo.pi_
88
license = MIT
99
license_files = LICENSE
10-
version = 1.0.1
10+
version = attr: connect4.__version__
1111
classifiers =
1212
Programming Language :: Python :: 3
1313
License :: OSI Approved :: MIT License

src/connect4/__init__.py

+12-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,12 @@
1-
from .core import *
2-
from .errors import *
1+
__title__ = 'connect4.py'
2+
__author__ = 'airo.pi_'
3+
__license__ = 'MIT'
4+
__version__ = '1.0.1'
5+
6+
from .core import Connect4 as Connect4
7+
from .core import Players as Players
8+
from .errors import ColumnFull as ColumnFull
9+
from .errors import GameOver as GameOver
10+
from .errors import InvalidColumn as InvalidColumn
11+
12+
__all__ = ['Connect4', 'Players', 'ColumnFull', 'GameOver', 'InvalidColumn']

0 commit comments

Comments
 (0)