travis ci scripts
This commit is contained in:
parent
ceea68d92b
commit
4c3ac44148
5
.travis.yml
Normal file → Executable file
5
.travis.yml
Normal file → Executable file
@ -9,7 +9,8 @@ cache:
|
||||
- travis_cache
|
||||
|
||||
before_install:
|
||||
- chmod +x ./travis_scripts/ci-build.sh
|
||||
- npm install remark-cli remark-validate-links
|
||||
|
||||
script: ./travis_scripts/ci-build.sh
|
||||
script:
|
||||
- git clone https://github.com/VoronDesign/GithubScripts.git .github_scripts
|
||||
- /bin/bash ./.github_scripts/travis/ci-build.sh
|
||||
|
@ -1,38 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
BASE_DIR=${PWD}
|
||||
CACHE_DIR=${PWD}/travis_cache
|
||||
|
||||
chmod +x ${BASE_DIR}/travis_scripts/*.py
|
||||
|
||||
ADMESH_DIR=${CACHE_DIR}/admesh-0.98.4
|
||||
mkdir -p ${CACHE_DIR}
|
||||
cd ${CACHE_DIR}
|
||||
if [ ! -d ${ADMESH_DIR} ]; then
|
||||
echo "Admesh cache miss; fetching and building ..."
|
||||
wget https://github.com/admesh/admesh/releases/download/v0.98.4/admesh-0.98.4.tar.gz
|
||||
tar -zxf admesh-0.98.4.tar.gz
|
||||
cd ${ADMESH_DIR}
|
||||
./configure
|
||||
make
|
||||
chmod +x admesh
|
||||
fi
|
||||
cd ${BASE_DIR}
|
||||
sudo ln -s ${ADMESH_DIR}/admesh /usr/bin/admesh
|
||||
|
||||
if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
|
||||
# Compare branch against master
|
||||
git remote set-branches --add origin master
|
||||
git fetch
|
||||
git diff --name-only --diff-filter=AMR origin/master | xargs -n 1 -I {} ${BASE_DIR}/travis_scripts/validate-file.py ${BASE_DIR}/{}
|
||||
else
|
||||
# Compare head against the branch to merge into (PR)
|
||||
git diff --name-only --diff-filter=AMR -R HEAD origin/${TRAVIS_BRANCH} | xargs -n 1 -I {} ${BASE_DIR}/travis_scripts/validate-file.py ${BASE_DIR}/{}
|
||||
fi
|
||||
|
||||
cd ${BASE_DIR}
|
||||
|
||||
# Validate all markdown files (eg, README.md).
|
||||
remark -u validate-links --no-stdout --frail .
|
||||
|
||||
|
@ -1,48 +0,0 @@
|
||||
#!/usr/bin/python3
|
||||
import subprocess, re, os, sys, getopt
|
||||
|
||||
def read_param(text, parameter):
|
||||
matches = re.search("(" + parameter + ")\s+\:\s+(\d+)", text)
|
||||
#print(matches)
|
||||
if matches:
|
||||
# The decimal group
|
||||
return int(matches.group(2))
|
||||
else:
|
||||
# Uh oh, no match
|
||||
print ("Could not find {0}".format(parameter))
|
||||
exit(1)
|
||||
|
||||
def assert_param_threshold(result, parameter, threshold):
|
||||
param_val = read_param(result, parameter)
|
||||
if param_val > threshold:
|
||||
print ("!! Detected \"{0}\" value of {1}".format(parameter, param_val))
|
||||
exit(1)
|
||||
#else:
|
||||
#print ("{0} value OK".format(parameter))
|
||||
|
||||
def process_stl(filename):
|
||||
cmd = "admesh \"{0}\"".format(filename)
|
||||
print ("Validating STL {0}".format(filename))
|
||||
result = subprocess.run(cmd, shell=True, check=True, stdout=subprocess.PIPE)
|
||||
output = str(result.stdout)
|
||||
|
||||
assert_param_threshold(output, "Edges fixed", 0)
|
||||
assert_param_threshold(output, "Backwards edges", 0)
|
||||
assert_param_threshold(output, "Degenerate facets", 0)
|
||||
assert_param_threshold(output, "Facets removed", 0)
|
||||
assert_param_threshold(output, "Facets added", 0)
|
||||
assert_param_threshold(output, "Facets reversed", 0)
|
||||
|
||||
def process_markdown(filename):
|
||||
cmd = "remark -u validate-links --no-stdout --frail \"{0}\"".format(filename)
|
||||
print ("Validating Markdown {0}".format(filename))
|
||||
subprocess.run(cmd, shell=True, check=True)
|
||||
|
||||
def main(argv):
|
||||
argument = " ".join(sys.argv[1:])
|
||||
|
||||
if argument.lower().endswith(".stl"):
|
||||
process_stl(argument)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main(sys.argv[1:])
|
Loading…
Reference in New Issue
Block a user