Skip to content

Instantly share code, notes, and snippets.

@hasandiwan
Created October 19, 2020 04:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hasandiwan/e5bcb955a642c62f7c32c9ff2beb5246 to your computer and use it in GitHub Desktop.
Save hasandiwan/e5bcb955a642c62f7c32c9ff2beb5246 to your computer and use it in GitHub Desktop.
Simple CI tool
import datetime
from hashlib import sha256
import logging
import pytest
logging.basicConfig(level=logging.DEBUG)
old = ''
with open('app.py') as op:
hash_bytes = op.read()
old = sha256(hash_bytes.encode('utf-8')).hexdigest()
logging.debug(f'{old} is the sha256 hash as of {datetime.datetime.now()}')
while True:
latest = ''
with open('app.py') as op:
hash_bytes = op.read()
latest = sha256(hash_bytes.encode('utf-8')).hexdigest()
if latest != old:
logging.debug(f'change detected between {old} and {latest} on {datetime.datetime.now()}')
pytest.main(['app.py'])
old = latest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment