diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1a60e50b203179908942a201fbb27c6a7648faa2..bb25a23eb35582df2a472aff9c50adf232d81e7f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,12 +2,17 @@ sha: 97b88d9610bcc03982ddac33caba98bb2b751f5f hooks: - id: check-added-large-files - - id: check-json - - id: check-xml - - id: check-yaml - id: check-merge-conflict - repo: https://www.shore.co.il/git/shell-pre-commit/ - sha: 604fe77b53d3514d5ad0f66764c7783850bb6e98 + sha: v0.1.0 hooks: - id: shell-lint - files: bundle-certs + files: bundle_certs +- repo: local + hooks: + - id: test + name: make test + language: system + entry: make test + files: bundle_certs + diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000000000000000000000000000000000000..e3a68d0d63f88e8c3fae720b253e0d0209d30c08 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,27 @@ +--- +language: python +python: "2.7" +dist: trusty +sudo: false +group: beta +cache: + - pip + - directories: + - $HOME/.pre-commit + +addons: + apt: + packages: + - mawk + - openssl + - curl + - build-essential + +install: + - pip install pre_commit + +script: + - pre-commit run --all-files + +notifications: + email: false diff --git a/Makefile b/Makefile index 4524ce27992fef02fd14bd4e0cd533c89b9dec01..a79872ba4bb27d1a868e9d97c279415ab3492b88 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,4 @@ -.PHONY: test clean lint - -lint: - /bin/sh -en bundle_certs - -clean: - if [ -f .server.pid ] && [ -d "/proc/$$(cat .server.pid)" ]; then kill "$$(cat .server.pid)"; fi - rm -rf .testcerts certs .server.pid +.PHONY: test .testcerts: mkdir -p .testcerts @@ -52,7 +45,7 @@ clean: .testcerts/bundle.crt: .testcerts/intermediates.crt .testcerts/server.crt ./bundle_certs .testcerts/* > .testcerts/bundle.crt -test: lint .testcerts/bundle.crt .testcerts/root.crt .testcerts/server.key +test: .testcerts/bundle.crt .testcerts/root.crt .testcerts/server.key openssl s_server -cert .testcerts/bundle.crt -key .testcerts/server.key -quiet -www -no_dhe & echo "$$!" > .server.pid test "$$(curl --fail --cacert .testcerts/root.crt --write-out '%{ssl_verify_result}' --silent --output /dev/null https://localhost:4433)" = "0" if [ -f .server.pid ] && [ -d "/proc/$$(cat .server.pid)" ]; then kill "$$(cat .server.pid)"; fi diff --git a/README.rst b/README.rst index 4d8ce79ea123a23a57cc3d2fed7b5956d1d0a7fe..2e1a21ea9af48f01b0bec88c853df20400a66612 100644 --- a/README.rst +++ b/README.rst @@ -1,6 +1,9 @@ bundle-certs ############ +.. image:: https://travis-ci.org/adarnimrod/bundle_certs.svg?branch=master + :target: https://travis-ci.org/adarnimrod/bundle_certs + A shell script to bundle SSL certificates in the correct order. The use case envisioned is programmatically handling SSL certificate renewal. @@ -58,10 +61,9 @@ Shell functions Development ----------- -To ease development :code:`make clean`, :code:`make lint` and :code:`make test` -are available. It's recommended to add :code:`make lint` and :code:`make test` -to to your Git pre-commit and pre-push hooks accordingly. Also, this repo has -`pre-commit <http://pre-commit.com/>`_ configured. +For testing run :code:`make test`. For cleaning temporary files run :code:`git +clean -fdx`. You can use `pre-commit <http://pre-commit.com/>`_ to have the test +(which is quite quick) run on every commit to ensure quality code. License -------