-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add TravisCI and xmllint scripts automated checks (#68) * Improve Travis xmllint * Use only one find for xsd and xml, remove unused wsdl * Change indent from one space to one tab * Enforce UTF-8 encoding * Use NULL-bytes to separate files when iterating * Remove XMLSpy comments * Use better variable name * Remove tagging from Travis commit script * Make Travis fail commit script on changed ref * Allow Travis to push updates to all branches except master * Travis CI update to fix linting issues Co-authored-by: haeckerbaer <[email protected]>
- Loading branch information
1 parent
2924aec
commit 88339ce
Showing
22 changed files
with
74 additions
and
19 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,10 @@ | ||
language: minimal | ||
|
||
before_script: | ||
- sudo apt-get install -qq libxml2-utils | ||
|
||
script: | ||
- bash .travis/xmllint-check.sh | ||
|
||
after_script: | ||
- bash .travis/travis-ci_git-commit.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#!/bin/bash | ||
# function to make a commit on a branch in a Travis CI build | ||
# be sure to avoid creating a Travis CI fork bomb | ||
# see https://gist.github.com/mitchellkrogza/a296ab5102d7e7142cc3599fca634203 and https://github.com/travis-ci/travis-ci/issues/1701 | ||
function travis-branch-commit() { | ||
local head_ref branch_ref | ||
head_ref=$(git rev-parse HEAD) | ||
if [[ $? -ne 0 || ! $head_ref ]]; then | ||
err "failed to get HEAD reference" | ||
return 1 | ||
fi | ||
branch_ref=$(git rev-parse "$TRAVIS_BRANCH") | ||
if [[ $? -ne 0 || ! $branch_ref ]]; then | ||
err "failed to get $TRAVIS_BRANCH reference" | ||
return 1 | ||
fi | ||
if [[ $head_ref != "$branch_ref" ]]; then | ||
msg "HEAD ref ($head_ref) does not match $TRAVIS_BRANCH ref ($branch_ref)" | ||
msg "Someone may have pushed new commits before this build cloned the repo" | ||
return 1 | ||
fi | ||
if ! git checkout "$TRAVIS_BRANCH"; then | ||
err "failed to checkout $TRAVIS_BRANCH" | ||
return 1 | ||
fi | ||
|
||
if ! git add --all .; then | ||
err "failed to add modified files to git index" | ||
return 1 | ||
fi | ||
# make Travis CI skip this build | ||
if ! git commit -m "Travis CI update [skip ci]"; then | ||
err "failed to commit updates" | ||
return 1 | ||
fi | ||
local remote=origin | ||
if [[ $GH_TOKEN ]]; then | ||
remote=https://$GH_TOKEN@github.com/$GH_REPO | ||
fi | ||
if [[ $TRAVIS_BRANCH == master ]]; then | ||
msg "not pushing updates to branch $TRAVIS_BRANCH" | ||
return 0 | ||
fi | ||
if ! git push --quiet --follow-tags "$remote" "$TRAVIS_BRANCH" > /dev/null 2>&1; then | ||
err "failed to push git changes" | ||
return 1 | ||
fi | ||
} | ||
|
||
function msg() { | ||
echo "travis-commit: $*" | ||
} | ||
|
||
function err() { | ||
msg "$*" 1>&2 | ||
} | ||
|
||
travis-branch-commit |
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,4 @@ | ||
#!/bin/bash | ||
/usr/bin/find . -type f \( -name "*.xsd" -or -name "*.xml" \) -print0 | while read -r -d $'\0' filename; do XMLLINT_INDENT=$'\t' xmllint --encode UTF-8 --pretty 1 "${filename}" > "${filename}.pretty"; mv "${filename}.pretty" "${filename}"; grep -i -v "xmlspy" "${filename}" > "${filename}.tmp" && mv "${filename}.tmp" "${filename}"; done; | ||
echo "finished formatting" | ||
# xmllint --noout --schema OJP.xsd examples/subdirectory1/*xml examples/subdirectory2/*xml |
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
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
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
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
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
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
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