-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
37 changed files
with
3,674 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: "setup-poetry-env" | ||
description: "Composite action to setup the Python and poetry environment." | ||
|
||
inputs: | ||
python-version: | ||
required: false | ||
description: "The python version to use" | ||
default: "3.11" | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Set up python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ inputs.python-version }} | ||
|
||
- name: Install Poetry | ||
uses: snok/install-poetry@v1 | ||
with: | ||
virtualenvs-in-project: true | ||
|
||
- name: Load cached venv | ||
id: cached-poetry-dependencies | ||
uses: actions/cache@v3 | ||
with: | ||
path: .venv | ||
key: venv-${{ runner.os }}-${{ inputs.python-version }}-${{ hashFiles('poetry.lock') }} | ||
|
||
- name: Install dependencies | ||
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | ||
run: poetry install --no-interaction | ||
shell: bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
name: Main | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
|
||
jobs: | ||
quality: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out | ||
uses: actions/checkout@v3 | ||
|
||
- uses: actions/cache@v3 | ||
with: | ||
path: ~/.cache/pre-commit | ||
key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }} | ||
|
||
- name: Set up the environment | ||
uses: ./.github/actions/setup-poetry-env | ||
|
||
- name: Run checks | ||
run: make check | ||
|
||
tox: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ['3.10', '3.11'] | ||
fail-fast: false | ||
steps: | ||
- name: Check out | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install Poetry | ||
uses: snok/install-poetry@v1 | ||
|
||
- name: Load cached venv | ||
uses: actions/cache@v3 | ||
with: | ||
path: .tox | ||
key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('poetry.lock') }} | ||
|
||
- name: Install tox | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install tox tox-gh-actions | ||
- name: Test with tox | ||
run: tox | ||
|
||
- name: Upload coverage reports to Codecov with GitHub Action on Python 3.11 | ||
uses: codecov/codecov-action@v3 | ||
if: ${{ matrix.python-version == '3.11' }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: release-main | ||
|
||
on: | ||
release: | ||
types: [published] | ||
branches: [main] | ||
|
||
jobs: | ||
|
||
publish: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up the environment | ||
uses: ./.github/actions/setup-poetry-env | ||
|
||
- name: Export tag | ||
id: vars | ||
run: echo tag=${GITHUB_REF#refs/*/} >> $GITHUB_OUTPUT | ||
|
||
- name: Build and publish | ||
run: | | ||
source .venv/bin/activate | ||
poetry version $RELEASE_VERSION | ||
make build-and-publish | ||
env: | ||
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} | ||
RELEASE_VERSION: ${{ steps.vars.outputs.tag }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
name: validate-codecov-config | ||
|
||
on: | ||
pull_request: | ||
paths: [codecov.yaml] | ||
push: | ||
branches: [main] | ||
|
||
jobs: | ||
validate-codecov-config: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Validate codecov configuration | ||
run: curl -sSL --fail-with-body --data-binary @codecov.yaml https://codecov.io/validate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
docs/source | ||
|
||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib64/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
share/python-wheels/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
MANIFEST | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.nox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*.cover | ||
*.py,cover | ||
.hypothesis/ | ||
.pytest_cache/ | ||
cover/ | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# IPython | ||
profile_default/ | ||
ipython_config.py | ||
|
||
|
||
# Environments | ||
.env | ||
.venv | ||
env/ | ||
venv/ | ||
ENV/ | ||
env.bak/ | ||
venv.bak/ | ||
|
||
# mkdocs documentation | ||
/site | ||
|
||
# mypy | ||
.mypy_cache/ | ||
.dmypy.json | ||
dmypy.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
repos: | ||
- repo: https://github.com/charliermarsh/ruff-pre-commit | ||
rev: "v0.0.230" | ||
hooks: | ||
- id: ruff | ||
|
||
- repo: https://github.com/psf/black | ||
rev: "22.8.0" | ||
hooks: | ||
- id: black |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
============ | ||
Contributing | ||
============ | ||
|
||
Contributions are welcome, and they are greatly appreciated! Every little bit | ||
helps, and credit will always be given. | ||
|
||
You can contribute in many ways: | ||
|
||
Types of Contributions | ||
---------------------- | ||
|
||
Report Bugs | ||
~~~~~~~~~~~ | ||
|
||
Report bugs at https://github.com/jdum/asciinema-scene/issues | ||
|
||
If you are reporting a bug, please include: | ||
|
||
* Your operating system name and version. | ||
* Any details about your local setup that might be helpful in troubleshooting. | ||
* Detailed steps to reproduce the bug. | ||
|
||
Fix Bugs | ||
~~~~~~~~ | ||
|
||
And so on... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
.PHONY: install | ||
install: ## Install the poetry environment and install the pre-commit hooks | ||
@echo "π Creating virtual environment using pyenv and poetry" | ||
@poetry install | ||
@ poetry run pre-commit install | ||
@poetry shell | ||
|
||
.PHONY: check | ||
check: ## Run code quality tools. | ||
@echo "π Checking Poetry lock file consistency with 'pyproject.toml': Running poetry lock --check" | ||
@poetry lock --check | ||
@echo "π Linting code: Running pre-commit" | ||
@poetry run pre-commit run -a | ||
@echo "π Static type checking: Running mypy" | ||
@poetry run mypy | ||
@echo "π Checking for obsolete dependencies: Running deptry" | ||
@poetry run deptry . | ||
|
||
.PHONY: test | ||
test: ## Test the code with pytest | ||
@echo "π Testing code: Running pytest" | ||
@poetry run pytest --cov --cov-config=pyproject.toml --cov-report=xml | ||
|
||
.PHONY: build | ||
build: clean-build ## Build wheel file using poetry | ||
@echo "π Creating wheel file" | ||
@poetry build | ||
|
||
.PHONY: clean-build | ||
clean-build: ## clean build artifacts | ||
@rm -rf dist | ||
|
||
.PHONY: publish | ||
publish: ## publish a release to pypi. | ||
@echo "π Publishing: Dry run." | ||
@poetry config pypi-token.pypi $(PYPI_TOKEN) | ||
@poetry publish --dry-run | ||
@echo "π Publishing." | ||
@poetry publish | ||
|
||
.PHONY: build-and-publish | ||
build-and-publish: build publish ## Build and publish. | ||
|
||
.PHONY: help | ||
help: | ||
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' | ||
|
||
.DEFAULT_GOAL := help |
Oops, something went wrong.