Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/update ci #67

Merged
merged 7 commits into from
Feb 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[flake8]
extend-ignore = D1, D2, E1, E2, E3, E501, W1, W2, W3, W5
38 changes: 38 additions & 0 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: Publish Python Package

on:
release:
types: [published]

permissions:
contents: read

jobs:
deploy:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install dependencies via pip
run: |
python -m pip install --upgrade pip
python -m pip install flit
- name: Build package via flit
run: flit build
- name: Publish package to pypi
# nosemgrep
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
45 changes: 45 additions & 0 deletions .github/workflows/python-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: Test Python Package

on:
push:
pull_request:
branches: ["main"]

jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Run linters via pre-commit
# nosemgrep
uses: pre-commit/[email protected]
- name: Install dependencies via pip
run: |
python -m pip install --upgrade pip
python -m pip install flit
- name: Install package via flit
run: |
flit install
- name: Run tests via pytest
run: |
pytest -v --cov-report xml --cov euchre
- name: Upload test coverage to Codecov
# nosemgrep
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
fail_ci_if_error: true
verbose: true
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
.python-version
.node-version
.venv
.envrc

# python artifacts
__pycache__/
Expand Down
51 changes: 51 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-toml
- id: check-added-large-files
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.1.6
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- repo: https://github.com/psf/black
rev: 23.11.0
hooks:
- id: black
- repo: https://github.com/PyCQA/flake8
rev: 6.1.0
hooks:
- id: flake8
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
hooks:
- id: isort
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.27.1
hooks:
- id: check-github-workflows
- repo: https://github.com/gitleaks/gitleaks
rev: v8.18.1
hooks:
- id: gitleaks
# - repo: https://github.com/pre-commit/mirrors-prettier
# rev: v3.1.0
# hooks:
# - id: prettier
# - repo: https://github.com/returntocorp/semgrep
# rev: v1.50.0
# hooks:
# - id: semgrep
# args: ["--config", "auto", "--error", "--skip-unknown-extensions"]
- repo: https://github.com/dosisod/refurb
rev: v1.24.0
hooks:
- id: refurb
# additional_dependencies:
# - mypy<1.7 # SEE: https://github.com/dosisod/refurb/issues/305
53 changes: 0 additions & 53 deletions .travis.yml

This file was deleted.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@

# euchre-cli

[![Build Status](https://api.travis-ci.com/boldandbrad/euchre-cli.svg?branch=main)](https://travis-ci.com/github/boldandbrad/euchre-cli)
[![build status](https://img.shields.io/github/actions/workflow/status/boldandbrad/euchre-cli/python-test.yml?branch=main&logo=github)]
[![codecov](https://codecov.io/gh/boldandbrad/euchre-cli/branch/main/graph/badge.svg)](https://codecov.io/gh/boldandbrad/euchre-cli)
[![Docs](https://img.shields.io/website?down_message=down&label=docs&up_message=online&url=https%3A%2F%2Fboldandbrad.github.io%2Feuchre-cli%2F)](https://boldandbrad.github.io/euchre-cli/)
[![docs](https://img.shields.io/website?down_message=down&label=docs&up_message=online&url=https%3A%2F%2Fboldandbrad.github.io%2Feuchre-cli%2F)](https://boldandbrad.github.io/euchre-cli/)
[![PyPI](https://img.shields.io/pypi/v/euchre-cli)](https://pypi.org/project/euchre-cli/)
![PyPI - Downloads](https://img.shields.io/pypi/dm/euchre-cli)

Expand Down
2 changes: 1 addition & 1 deletion docs/_coverpage.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

[<img src="_media/logo_light.png" alt="logo" width="200"/>](/)

# [**euchre-cli** **<small>0.6.1</small>**](/)
# [**euchre-cli** **<small>0.7.0</small>**](/)

> Play euchre in your terminal.

Expand Down
21 changes: 21 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,27 @@ The format is based on
and this project adheres to
[Semantic Versioning](https://semver.org/spec/v2.0.0.html "Semantic Versioning").

## Unreleased

## [0.7.0] - 2024-02-19

### Added

- Add pre-commit hooks
- Support for python versions 3.11 and 3.12

### Updated

- Replace Travis CI build system with GitHub Actions
- Replace Setup.py with pyproject.toml built with flit
- Move `euchre` dir into `src`
- Rename `src/euchre.py` to `src/root.py`
- Cleanup code formatting

### Removed

- Remove support for python versions 3.8 and 3.9

## [0.6.1] - 2022-02-23

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@
<script src="//unpkg.com/docsify-footer-enh/dist/docsify-footer-enh.min.js"></script>
</body>

</html>
</html>
2 changes: 1 addition & 1 deletion docs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Start playing euchre in your terminal.

> Note: The latest version of **euchre-cli** is compatible with `python 3.8+`
> Note: The latest version of **euchre-cli** is compatible with `python 3.10+`
> on macOS, Windows, and Linux.

Install with pip.
Expand Down
2 changes: 0 additions & 2 deletions euchre/__init__.py

This file was deleted.

4 changes: 0 additions & 4 deletions euchre/util/__init__.py

This file was deleted.

49 changes: 49 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# activate venv
venv:
. .venv/bin/activate

# install euchre-cli from local
install:
pip install -q ."[test]"

# install euchre-cli via flit
flit-install:
pip install flit
flit install

# install editable
dev-install:
pip install -q -e .

# lint and format
lint:
pre-commit run --show-diff-on-failure --all-files

# run all tests
test: install
pytest

# run all tests with coverage
test-cov: install
pytest -v --cov-report xml --cov euchre

# build dist
build:
flit build

# generate homebrew formula
brew:
pip install -q ."[dev]"
poet -f euchre-cli >> formula.rb

# remove artifacts
# TODO: remove __pycache__ dirs from src/ and tests/
cleanup:
rm -f .coverage
rm -f coverage.xml
rm -f formula.rb
rm -rf .pytest_cache
rm -rf build
rm -rf dist
rm -rf *.egg-info
rm -rf .ruff_cache
55 changes: 55 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
[build-system]
requires = ["flit_core >=3.2,<4"]
build-backend = "flit_core.buildapi"

[project]
name = "euchre-cli"
authors = [{ name = "Bradley Wojcik", email = "[email protected]" }]
readme = "README.md"
license = { file = "LICENSE" }
classifiers = ["License :: OSI Approved :: MIT License"]
requires-python = ">=3.10"
dynamic = ["version", "description"]
dependencies = [
"click >=8",
"names ==0.3.0",
"loguru >=0.5.0",
]

[project.scripts]
euchre = "euchre.root:cli"

[project.urls]
Home = "https://boldandbrad.github.io/euchre-cli/"
Source = "https://github.com/boldandbrad/euchre-cli"

[project.optional-dependencies]
test = [
"pytest >=6",
"pytest-cov",
"pytest-mock",
]
dev = [
"black",
"flake8",
"flit",
"isort",
"pre-commit",
"homebrew-pypi-poet",
"refurb",
]

[tool.flit.module]
name = "euchre"

[tool.isort]
profile = "black"
skip = ["src/euchre/abstract/__init__.py"]

[tool.pytest.ini_options]
minversion = "6.0"
testpaths = ["tests"]

[tool.ruff]
# Never enforce `E501` (line length violations).
ignore = ["E501"]
2 changes: 0 additions & 2 deletions pytest.ini

This file was deleted.

Loading
Loading