Created
February 21, 2023 15:05
-
-
Save mfurquimdev/04b0539f6e4d4b9c16b4974cdf3eac11 to your computer and use it in GitHub Desktop.
Automatically run Haskell unit tests inside docker upon change on ./src/* files
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
#!/bin/bash | |
pushd pangram | |
stack test --allow-different-user --install-ghc |
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
#!/bin/bash | |
inotifywait -q -m -e close_write -r pangram/src/ | while read -r path event filename; | |
do | |
clear | |
echo -e "\n\n\033[1;7;37mExecuting ./execute.sh because $path$filename was $event\033[0;1;0m" | |
./execute.sh | |
done; |
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
#!/bin/bash | |
./install_dependencies.sh | |
./update_yaml.py | |
./execute.sh | |
./hotload.sh |
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
#!/bin/bash | |
apt update && apt install -y inotify-tools python3-pip | |
pip3 install pyyaml |
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
#!/bin/bash | |
docker run -it --rm -v "${PWD}:/app" -w /app haskell ./init.sh |
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
#!/usr/bin/python3 | |
from yaml import dump | |
from yaml import load | |
from yaml import YAMLError | |
try: | |
from yaml import CLoader as Loader | |
from yaml import CDumper as Dumper | |
except ImportError: | |
from yaml import Loader | |
from yaml import Dumper | |
import pprint | |
with open("pangram/package.yaml", "r") as stream: | |
try: | |
data = load(stream, Loader=Loader) | |
except YAMLError as exc: | |
print(exc) | |
def append_if_not_present(m_list, item): | |
"""Append item if not present in m_list""" | |
if m_list is None: | |
m_list = [item] | |
else: | |
if item not in m_list: | |
m_list.append(item) | |
return m_list | |
data["library"]["dependencies"] = append_if_not_present( | |
data["library"]["dependencies"], | |
"containers", | |
) | |
data["tests"]["test"]["dependencies"] = append_if_not_present( | |
data["tests"]["test"]["dependencies"], | |
"containers", | |
) | |
pprint.pprint(data) | |
with open("pangram/package.yaml", "w") as stream: | |
try: | |
output = dump(data, Dumper=Dumper) | |
stream.write(output) | |
except YAMLError as exc: | |
print(exc) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment