forked from VoronDesign/Voron-2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
104 additions
and
3 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# This is a travis-ci.org continuous integration configuration file. | ||
language: node_js | ||
node_js: | ||
- 12 | ||
|
||
cache: | ||
npm: true | ||
directories: | ||
- travis_cache | ||
|
||
before_install: | ||
- chmod +x ./travis_scripts/ci-build.sh | ||
- npm install remark-cli remark-validate-links | ||
|
||
script: ./travis_scripts/ci-build.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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/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 . | ||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#!/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:]) |