diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ea2515d..ca69ab9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,7 +2,7 @@ name: 'CI' on: push: - branches: [ master ] + branches: [master] pull_request: jobs: @@ -12,16 +12,14 @@ jobs: matrix: pythonversion: ['3.6', '3.7', '3.8', '3.9', '3.10', '3.11'] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: set up python - uses: actions/setup-python@v2 + uses: actions/setup-python@v3 with: python-version: ${{ matrix.pythonversion }} - name: install dependencies - run: | - python -m pip install -r test_requirements.txt - python -m pip install -e . + run: make install - name: lint with flake8 - run: flake8 ssh_certificate_parser/ tests/ + run: make lint - name: test with pytest - run: pytest --cov=ssh_certificate_parser --cov-report=term-missing --cov-fail-under=60 tests/ + run: make coverage diff --git a/CHANGES.md b/CHANGES.md index a5e3594..3f2e7ed 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,41 +1,38 @@ -ChangeLog -========= +# CHANGELOG -1.5.0 ------ +## v1.6.0 + +- Adds support for certs that last forever +- Adds support for `ed25519` certs + +## v1.5.0 - Adds proper support for `ecdsa-sha2-nistp256` -1.4.0 ------ +## v1.4.0 - Adds proper support for `ecdsa-sha2-nistp384` -1.3.3 ------ +## v1.3.3 - Fix RtD link issue -1.3.2 ------ +## v1.3.2 - Fix PyPI project URLs -1.3.1 ------ +## v1.3.1 - Fix `setup.py` issues -1.3.0 ------ +## v1.3.0 - Can now parse ECDSA keys (if they're signed with an RSA CA) - Add `.from_file` constructor on `SSHCertificate` - Add a bunch of type hints - Improve documentation a bit -1.2.0 ------ +## v1.2.0 - Can now parse DSA and Ed25519 keys (although they still have to have been signed by an RSA CA) - Unit tests @@ -43,7 +40,10 @@ ChangeLog - `pubkey_parts` is a dictionary containing the appropriate parts for that key (e.g., `n` and `e` for RSA) - Now raises subclasses of `ssh_certificate_parser.errors.SSHCertificateParserError` instead of just `ValueError` with a string description -1.1.0 ------ +## v1.1.0 - CA certificate fingerprint (equivalent to `ssh-keygen -l -f /path/to/key.pub`) is now parsed for ssh-rsa CAs. I don't have any ECDSA/Ed25519 CAs so I haven't tested them! + +## v1.0.0 + +- Initial release diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..6994d67 --- /dev/null +++ b/Makefile @@ -0,0 +1,47 @@ +PYTHON_BINARY := python3 +VIRTUAL_ENV := venv +VIRTUAL_BIN := $(VIRTUAL_ENV)/bin +PROJECT_NAME := ssh_certificate_parser +TEST_DIR := tests + +## help - Display help about make targets for this Makefile +help: + @cat Makefile | grep '^## ' --color=never | cut -c4- | sed -e "`printf 's/ - /\t- /;'`" | column -s "`printf '\t'`" -t + +## build - Builds the project in preparation for release +build: + $(VIRTUAL_BIN)/python -m build + +## clean - Remove the virtual environment and clear out .pyc files +clean: + rm -rf $(VIRTUAL_ENV) dist/ build/ *.egg-info/ .pytest_cache .mypy_cache + find . -name '*.pyc' -delete + +## coverage - Test the project and generate an HTML coverage report +coverage: + $(VIRTUAL_BIN)/pytest --cov=$(PROJECT_NAME) --cov-branch --cov-report=html --cov-report=term-missing --cov-fail-under=80 + +## install - Install the project locally +install: + $(PYTHON_BINARY) -m venv $(VIRTUAL_ENV) + $(VIRTUAL_BIN)/pip install -e . + $(VIRTUAL_BIN)/pip install -r test_requirements.txt + +## lint - Lint the project +lint: + $(VIRTUAL_BIN)/flake8 $(PROJECT_NAME)/ $(TEST_DIR)/ + +## publish - Publish the project to PyPI +publish: + $(VIRTUAL_BIN)/twine upload dist/* + +## release - Cuts a release for the project on GitHub (requires GitHub CLI) +# tag = The associated tag title of the release +release: + gh release create ${tag} dist/* + +## test - Test the project +test: + $(VIRTUAL_BIN)/pytest + +.PHONY: help build clean coverage install lint publish release test diff --git a/README.md b/README.md index c5f1601..23e3dd8 100644 --- a/README.md +++ b/README.md @@ -18,3 +18,17 @@ remaining_seconds_of_validity = cert.remaining_validity ``` Full documentation is at . + +## Development + +```sh +# Install dependencies +make install + +# Lint project +make lint + +# Test project +make test +make coverage +``` diff --git a/setup.py b/setup.py index 00bf3f2..52b6cf0 100755 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ setup( name="ssh_certificate_parser", - version="1.5.0", + version="1.6.0", author="James Brown", author_email="jbrown@easypost.com", url="https://github.com/easypost/ssh_certificate_parser", diff --git a/test_requirements.txt b/test_requirements.txt index 65db00e..9800aed 100644 --- a/test_requirements.txt +++ b/test_requirements.txt @@ -1,5 +1,8 @@ -flake8==3.9.* -importlib_metadata<5 -pytest-cov==2.* +build==0.9.* +flake8==5.* +importlib_metadata==4.* +pytest-cov==3.* pytest-mock==3.* pytest==6.* +twine==3.* +wheel==0.37.*