Skip to content

Commit

Permalink
Add Travis integration (#74)
Browse files Browse the repository at this point in the history
* 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
sgrossberndt and haeckerbaer committed Apr 21, 2020
1 parent 2924aec commit 88339ce
Show file tree
Hide file tree
Showing 22 changed files with 74 additions and 19 deletions.
10 changes: 10 additions & 0 deletions .travis.yml
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
58 changes: 58 additions & 0 deletions .travis/travis-ci_git-commit.sh
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
4 changes: 4 additions & 0 deletions .travis/xmllint-check.sh
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
1 change: 0 additions & 1 deletion OJP.xsd
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSpy v2016 rel. 2 sp1 (x64) (http://www.altova.com) by Christophe Duquesne (Aurige) -->
<xs:schema xmlns:ojp="http://www.vdv.de/ojp" xmlns:siri="http://www.siri.org.uk/siri" xmlns="http://www.siri.org.uk/siri" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.siri.org.uk/siri" elementFormDefault="qualified" attributeFormDefault="unqualified" version="1.0" id="OJP_siri">
<!-- ===Dependencies ======================================= -->
<xs:import namespace="http://www.vdv.de/ojp" schemaLocation="OJP_Requests.xsd"/>
Expand Down
1 change: 0 additions & 1 deletion OJP_Common.xsd
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSpy v2015 rel. 3 sp1 (x64) (http://www.altova.com) by Jutta Schmedding (Mentz Datenverarbeitung GmbH) -->
<xs:schema xmlns="http://www.vdv.de/ojp" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:siri="http://www.siri.org.uk/siri" targetNamespace="http://www.vdv.de/ojp" elementFormDefault="qualified" attributeFormDefault="unqualified">
<!-- ===Dependencies ======================================= -->
<xs:import namespace="http://www.siri.org.uk/siri" schemaLocation="./siri_model/siri_reference-v2.0.xsd"/>
Expand Down
1 change: 0 additions & 1 deletion OJP_FacilitySupport.xsd
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSpy v2007 sp2 (http://www.altova.com) by Werner Kohl (Mentz Datenverarbeitung GmbH) -->
<xs:schema xmlns="http://www.vdv.de/ojp" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:siri="http://www.siri.org.uk/siri" targetNamespace="http://www.vdv.de/ojp" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:import namespace="http://www.siri.org.uk/siri" schemaLocation="./siri_model/siri_facilities-v1.2.xsd"/>
<!-- <xs:include schemaLocation="OJP_Common.xsd"/>-->
Expand Down
1 change: 0 additions & 1 deletion OJP_Fare.xsd
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSpy v2007 sp2 (http://www.altova.com) by Werner Kohl (Mentz Datenverarbeitung GmbH) -->
<xs:schema xmlns="http://www.vdv.de/ojp" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:siri="http://www.siri.org.uk/siri" targetNamespace="http://www.vdv.de/ojp" elementFormDefault="qualified" attributeFormDefault="unqualified">
<!-- ===Dependencies ======================================= -->
<xs:import namespace="http://www.siri.org.uk/siri" schemaLocation="./siri_model/siri_modes-v1.1.xsd"/>
Expand Down
1 change: 0 additions & 1 deletion OJP_FareSupport.xsd
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSpy v2016 rel. 2 sp1 (x64) (http://www.altova.com) by Christophe Duquesne (Aurige) -->
<xs:schema xmlns="http://www.vdv.de/ojp" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.vdv.de/ojp" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:include schemaLocation="OJP_Common.xsd"/>
<xs:simpleType name="TypeOfFareClassEnumeration">
Expand Down
1 change: 0 additions & 1 deletion OJP_JourneySupport.xsd
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSpy v2016 rel. 2 sp1 (x64) (http://www.altova.com) by Christophe Duquesne (Aurige) -->
<xs:schema xmlns="http://www.vdv.de/ojp" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ns1="http://www.siri.org.uk/siri" xmlns:siri="http://www.siri.org.uk/siri" targetNamespace="http://www.vdv.de/ojp" elementFormDefault="qualified" attributeFormDefault="unqualified">
<!-- ===Dependencies ======================================= -->
<xs:import namespace="http://www.siri.org.uk/siri" schemaLocation="./siri_utility/siri_location-v2.0.xsd"/>
Expand Down
1 change: 0 additions & 1 deletion OJP_ModesSupport.xsd
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSpy v2015 rel. 3 sp1 (x64) (http://www.altova.com) by Jutta Schmedding (Mentz Datenverarbeitung GmbH) -->
<xs:schema xmlns="http://www.vdv.de/ojp" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:siri="http://www.siri.org.uk/siri" targetNamespace="http://www.vdv.de/ojp" elementFormDefault="qualified" attributeFormDefault="unqualified">
<!-- ===Dependencies ======================================= -->
<xs:import namespace="http://www.siri.org.uk/siri" schemaLocation="./siri_model/siri_modes-v1.1.xsd"/>
Expand Down
1 change: 0 additions & 1 deletion OJP_RequestSupport.xsd
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSpy v2015 rel. 3 sp1 (x64) (http://www.altova.com) by Jutta Schmedding (Mentz Datenverarbeitung GmbH) -->
<xs:schema xmlns="http://www.vdv.de/ojp" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:siri="http://www.siri.org.uk/siri" targetNamespace="http://www.vdv.de/ojp" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:import namespace="http://www.siri.org.uk/siri" schemaLocation="./siri/siri_all_framework-v2.0.xsd"/>
<xs:import namespace="http://www.siri.org.uk/siri" schemaLocation="./siri_model/siri_journey_support-v2.0.xsd"/>
Expand Down
1 change: 0 additions & 1 deletion OJP_Requests.xsd
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSpy v2016 rel. 2 sp1 (x64) (http://www.altova.com) by Christophe Duquesne (Aurige) -->
<xs:schema xmlns="http://www.vdv.de/ojp" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:siri="http://www.siri.org.uk/siri" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.vdv.de/ojp" elementFormDefault="qualified" attributeFormDefault="unqualified" id="OJP_siri_service">
<!-- ===Dependencies ======================================= -->
<xs:import namespace="http://www.siri.org.uk/siri" schemaLocation="./siri/siri_requests-v2.0.xsd"/>
Expand Down
1 change: 0 additions & 1 deletion OJP_SituationSupport.xsd
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSpy v2007 sp2 (http://www.altova.com) by Werner Kohl (Mentz Datenverarbeitung GmbH) -->
<xs:schema xmlns="http://www.vdv.de/ojp" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:siri="http://www.siri.org.uk/siri" targetNamespace="http://www.vdv.de/ojp" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:import namespace="http://www.siri.org.uk/siri" schemaLocation="./siri_model/siri_all_situation-v2.0.xsd"/>
<xs:complexType name="SituationsStructure">
Expand Down
1 change: 0 additions & 1 deletion OJP_StopEvents.xsd
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSpy v2015 rel. 3 sp1 (x64) (http://www.altova.com) by Jutta Schmedding (Mentz Datenverarbeitung GmbH) -->
<xs:schema xmlns="http://www.vdv.de/ojp" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:siri="http://www.siri.org.uk/siri" targetNamespace="http://www.vdv.de/ojp" elementFormDefault="qualified" attributeFormDefault="unqualified">
<!-- ===Dependencies ======================================= -->
<xs:import namespace="http://www.siri.org.uk/siri" schemaLocation="./siri_model/siri_modes-v1.1.xsd"/>
Expand Down
1 change: 0 additions & 1 deletion OJP_TripInfo.xsd
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSpy v2015 rel. 3 sp1 (x64) (http://www.altova.com) by Jutta Schmedding (Mentz Datenverarbeitung GmbH) -->
<xs:schema xmlns="http://www.vdv.de/ojp" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.vdv.de/ojp" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:include schemaLocation="OJP_Common.xsd"/>
<xs:include schemaLocation="OJP_JourneySupport.xsd"/>
Expand Down
2 changes: 1 addition & 1 deletion datex2/DATEXIISchema_2_0RC1_2_0 with definitions.xsd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<xs:schema xmlns:D2LogicalModel="http://datex2.eu/schema/2_0RC1/2_0" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified" targetNamespace="http://datex2.eu/schema/2_0RC1/2_0">
<xs:complexType name="AbnormalTraffic">
<xs:annotation>
Expand Down
2 changes: 1 addition & 1 deletion datex2/DATEXIISchema_2_0RC1_2_0.xsd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<xs:schema xmlns:D2LogicalModel="http://datex2.eu/schema/2_0RC1/2_0" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified" targetNamespace="http://datex2.eu/schema/2_0RC1/2_0">
<xs:complexType name="AbnormalTraffic">
<xs:complexContent>
Expand Down
1 change: 0 additions & 1 deletion siri/siri_common_services-v2.0.xsd
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSpy v2011 rel. 2 sp1 (x64) (http://www.altova.com) by Christophe Duquesne (Dryade) -->
<xsd:schema xmlns="http://www.siri.org.uk/siri" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:acsb="http://www.ifopt.org.uk/acsb" targetNamespace="http://www.siri.org.uk/siri" elementFormDefault="qualified" attributeFormDefault="unqualified" version="2.0" id="siri_common_services">
<xsd:annotation>
<xsd:appinfo>
Expand Down
1 change: 0 additions & 1 deletion siri/siri_request_errorConditions-v2.0.xsd
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSpy v2011 rel. 2 sp1 (x64) (http://www.altova.com) by Christophe Duquesne (Dryade) -->
<xsd:schema xmlns="http://www.siri.org.uk/siri" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.siri.org.uk/siri" elementFormDefault="qualified" attributeFormDefault="unqualified" version="2.0" id="siri_request_errorConditions">
<xsd:include schemaLocation="../siri_utility/siri_types-v2.0.xsd"/>
<xsd:include schemaLocation="siri_request_support-v2.0.xsd"/>
Expand Down
1 change: 0 additions & 1 deletion siri_model/siri_datedVehicleJourney-v2.0.xsd
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSpy v2011 rel. 2 sp1 (x64) (http://www.altova.com) by Christophe Duquesne (Dryade) -->
<xsd:schema xmlns="http://www.siri.org.uk/siri" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.siri.org.uk/siri" elementFormDefault="qualified" attributeFormDefault="unqualified" version="2.0" id="siri_datedVehicleJourney">
<xsd:annotation>
<xsd:appinfo>
Expand Down
1 change: 0 additions & 1 deletion siri_model/siri_estimatedVehicleJourney-v2.0.xsd
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSpy v2011 rel. 2 sp1 (x64) (http://www.altova.com) by Christophe Duquesne (Dryade) -->
<xsd:schema xmlns="http://www.siri.org.uk/siri" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.siri.org.uk/siri" elementFormDefault="qualified" attributeFormDefault="unqualified" version="2.0" id="siri_estimatedVehicleJourney">
<xsd:annotation>
<xsd:appinfo>
Expand Down
1 change: 0 additions & 1 deletion siri_model/siri_journey-v2.0.xsd
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSpy v2011 rel. 2 sp1 (x64) (http://www.altova.com) by Christophe Duquesne (Dryade) -->
<xsd:schema xmlns="http://www.siri.org.uk/siri" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.siri.org.uk/siri" elementFormDefault="qualified" attributeFormDefault="unqualified" version="2.0" id="siri_journey">
<xsd:annotation>
<xsd:appinfo>
Expand Down

0 comments on commit 88339ce

Please sign in to comment.