Updated package name and added github workflow

This commit is contained in:
Dmitriy Shishkov 2021-08-10 14:40:38 +03:00
parent 8a14b0033a
commit 693b824298
No known key found for this signature in database
GPG Key ID: 14358F96FCDD8060
6 changed files with 101 additions and 6 deletions

92
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,92 @@
name: Test and Publish
on:
release:
types: [published]
push:
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.x"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install pytest pytest-cov
- name: Run tests
run: pytest --cov=src/ttt_game --cov-report=xml tests
- name: Upload Coverage Report to Codecov.io
uses: codecov/codecov-action@v1
with:
file: ./coverage.xml
flags: unittests
build:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.x"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install build
- name: Build package
run: python -m build
- name: Archive production artifacts
uses: actions/upload-artifact@v2
with:
name: built-files
path: dist
publish-pypi:
needs: [test, build]
runs-on: ubuntu-latest
if: github.event_name == 'release'
steps:
- uses: actions/checkout@v2
- name: Download a single artifact
uses: actions/download-artifact@v2
with:
name: built-files
path: dist
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
publish-testing:
needs: [test, build]
runs-on: ubuntu-latest
if: github.event_name == 'push'
steps:
- uses: actions/checkout@v2
- name: Download a single artifact
uses: actions/download-artifact@v2
with:
name: built-files
path: dist
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/

View File

@ -1,10 +1,13 @@
# Tic Tac Toe
# TTT-game
[![codecov](https://codecov.io/gh/dm1sh/tic-tac-toe/branch/main/graph/badge.svg)](https://codecov.io/gh/dm1sh/tic-tac-toe)
![CI](https://github.com/dm1sh/tic-tac-toe/actions/workflows/ci.yaml/badge.svg)
A simple tic tac toe game implementation
## Usage
tic-tac-toe module exports main game class `Game` and `Pl` and `Tr` enums to simplify typing.
tic_tac_toe module exports main game class `Game` and `Pl` and `Tr` enums to simplify typing.
### `Game` class

View File

@ -4,16 +4,16 @@ with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
setuptools.setup(
name="tic-tac-toe-dm1sh",
name="ttt_game",
version="0.0.1",
author="dm1sh",
author_email="me@dmitriy.icu",
description="A simple tic tac toe game implementation",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/dm1sh/tic-tac-toe",
url="https://github.com/dm1sh/ttt-game",
project_urls={
"Bug Tracker": "https://github.com/dm1sh/tic-tac-toe/issues",
"Bug Tracker": "https://github.com/dm1sh/ttt-game/issues",
},
classifiers=[
"Programming Language :: Python :: 3",

View File

@ -1,4 +1,4 @@
from src.tic_tac_toe import Game, Tr
from src.ttt_game import Game, Tr
def test_init():