2016-01-05 04:25:45 +00:00
sudo : required
2017-11-12 13:50:11 +00:00
language : java
jdk :
2018-04-17 07:19:10 +00:00
- openjdk8
2017-11-12 13:50:11 +00:00
2019-05-05 19:15:18 +00:00
# See https://docs.travis-ci.com/user/languages/java/#caching
before_cache :
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
2019-05-21 00:41:41 +00:00
# Avoid caching our built dependencies between runs.
- rm -fr $HOME/.m2/repository/org/openapitools/
2016-07-15 01:57:24 +00:00
cache :
2020-02-17 16:19:18 +00:00
yarn : true
2016-07-15 01:57:24 +00:00
directories :
- $HOME/.m2
2017-03-12 16:52:10 +00:00
- $HOME/.ivy2
2017-03-21 13:48:40 +00:00
- $HOME/.gradle/caches/
- $HOME/.gradle/wrapper/
2018-06-09 18:21:31 +00:00
- $HOME/samples/client/petstore/javascript/node_modules
2018-05-09 02:34:19 +00:00
- $HOME/samples/client/petstore/php/OpenAPIToolsClient-php/vendor
2018-06-09 18:21:31 +00:00
- $HOME/samples/client/petstore/ruby/vendor/bundle
2017-03-11 08:59:17 +00:00
- $HOME/samples/client/petstore/python/.venv/
2017-11-12 13:50:11 +00:00
- $HOME/samples/client/petstore/typescript-node/npm/node_modules
- $HOME/samples/client/petstore/typescript-node/npm/typings/
- $HOME/samples/client/petstore/typescript-fetch/tests/default/node_modules
- $HOME/samples/client/petstore/typescript-fetch/tests/default/typings
- $HOME/samples/client/petstore/typescript-fetch/builds/default/node_modules
- $HOME/samples/client/petstore/typescript-fetch/builds/default/typings
- $HOME/samples/client/petstore/typescript-fetch/builds/es6-target/node_modules
- $HOME/samples/client/petstore/typescript-fetch/builds/es6-target/typings
- $HOME/samples/client/petstore/typescript-fetch/builds/with-npm-version/node_modules
- $HOME/samples/client/petstore/typescript-fetch/npm/with-npm-version/typings
- $HOME/samples/client/petstore/typescript-angular/node_modules
- $HOME/samples/client/petstore/typescript-angular/typings
2018-06-13 16:05:49 +00:00
- $HOME/samples/server/petstore/rust-server/target
2018-05-12 17:31:13 +00:00
- $HOME/perl5
2018-06-13 16:05:49 +00:00
- $HOME/.cargo
2018-08-31 17:49:18 +00:00
- $HOME/.pub-cache
2018-07-22 08:41:20 +00:00
- $HOME/samples/server/petstore/cpp-pistache/pistache
2018-08-23 08:25:26 +00:00
- $HOME/.npm
- $HOME/.rvm/gems/ruby-2.4.1
2019-01-18 09:39:33 +00:00
- $HOME/website/node_modules/
2017-11-12 13:50:11 +00:00
services :
- docker
2016-07-15 01:57:24 +00:00
2017-06-05 07:43:20 +00:00
# comment out the host table change to use the public petstore server
2016-07-19 14:36:10 +00:00
addons :
2018-07-22 08:41:20 +00:00
apt :
sources :
- ubuntu-toolchain-r-test
packages :
- g++-5
2018-07-03 09:55:26 +00:00
chrome : stable
2016-07-19 14:36:10 +00:00
hosts :
- petstore.swagger.io
2016-01-05 12:08:52 +00:00
before_install :
2020-02-17 16:19:18 +00:00
- curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.22.0
- export PATH="$HOME/.yarn/bin:$PATH"
2018-05-12 17:31:13 +00:00
# install rust
2018-06-13 16:05:49 +00:00
- curl https://sh.rustup.rs -sSf | sh -s -- -y -v
2017-11-12 13:50:11 +00:00
# required when sudo: required for the Ruby petstore tests
- gem install bundler
2016-05-20 06:15:04 +00:00
- npm install -g typescript
2017-11-12 13:50:11 +00:00
- npm install -g npm
2019-11-25 07:21:11 +00:00
#- npm install -g elm@0.18.0-exp5
2017-05-31 09:39:58 +00:00
- npm config set registry http://registry.npmjs.org/
2018-02-01 09:28:55 +00:00
# set python 3.6.3 as default
- source ~/virtualenv/python3.6/bin/activate
2016-07-19 14:36:10 +00:00
# to run petstore server locally via docker
2017-11-12 13:50:11 +00:00
- docker pull swaggerapi/petstore
- docker run -d -e SWAGGER_HOST=http://petstore.swagger.io -e SWAGGER_BASE_PATH=/v2 -p 80:8080 swaggerapi/petstore
- docker ps -a
# Add bats test framework and cURL for Bash script integration tests
2019-10-26 03:30:08 +00:00
- sudo add-apt-repository ppa:duggan/bats --yes
- sudo apt-get update -qq
- sudo apt-get install -qq bats
- sudo apt-get install -qq curl
2018-08-31 17:49:18 +00:00
# install dart
#- sudo apt-get update
2018-11-30 17:04:00 +00:00
#- sudo apt-get install apt-transport-https
#- sudo sh -c 'curl https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -'
#- sudo sh -c 'curl https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > /etc/apt/sources.list.d/dart_stable.list'
#- sudo apt-get update
#- sudo apt-get install dart
2018-11-26 01:59:22 +00:00
# switch to php7
- phpenv global 7.1
- php -v
2018-05-03 01:46:39 +00:00
# install perl module
2018-05-12 17:31:13 +00:00
#- cpanm --local-lib=~/perl5 local::lib && eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib)
#- cpanm Test::Exception Test::More Log::Any LWP::UserAgent JSON URI:Query Module::Runtime DateTime Module::Find Moose::Role
2017-11-12 13:50:11 +00:00
# comment out below as installation failed in travis
[Erlang] Plant CI for server (#5559)
* [Erlang] Address apparent reproducibily issue of sample
Spotted running `bin/erlang-petstore-server.sh` on d08d55d41 .
Apart from newlines, this is the opposite change of ec6248cbc .
* [Erlang] Perform basic testing of sample server on CI
* [Erlang] Install recent Erlang/OTP version
... in order to satisfy `jesse` compilation.
The error I faced is:
```
$ curl -f -L -o ./rebar3 https://s3.amazonaws.com/rebar3/rebar3 && chmod +x ./rebar3 && ./rebar3 version && export PATH="${TRAVIS_BUILD_DIR}:$PATH"
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 766k 100 766k 0 0 1041k 0 --:--:-- --:--:-- --:--:-- 1041k
rebar 3.3.6 on Erlang/OTP R16B03 Erts 5.10.4
...
===> Verifying dependencies...
===> Fetching jesse ({git,"https://github.com/for-GET/jesse.git",
{tag,"1.4.0"}})
===> Fetching jsx ({git,"https://github.com/talentdeficit/jsx.git",
{branch,"v2.8.0"}})
===> Skipping jsx (from {git,"git://github.com/talentdeficit/jsx.git",
{tag,"2.8.0"}}) as an app of the same name has already been fetched
===> Compiling jsx
===> Compiling jesse
===> Compiling _build/default/lib/jesse/src/jesse_tests_util.erl failed
_build/default/lib/jesse/src/jesse_tests_util.erl:28: can't find include lib "common_test/include/ct.hrl"
_build/default/lib/jesse/src/jesse_tests_util.erl:55: undefined macro 'config/2'
_build/default/lib/jesse/src/jesse_tests_util.erl:24: function do_test/2 undefined
_build/default/lib/jesse/src/jesse_tests_util.erl:72: function test_schema/3 is unused
_build/default/lib/jesse/src/jesse_tests_util.erl:102: function get_path/2 is unused
_build/default/lib/jesse/src/jesse_tests_util.erl:105: function load_schema/1 is unused
[ERROR] Command execution failed.
org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)
at org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:404)
at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:166)
at org.codehaus.mojo.exec.ExecMojo.executeCommandLine(ExecMojo.java:804)
at org.codehaus.mojo.exec.ExecMojo.executeCommandLine(ExecMojo.java:751)
at org.codehaus.mojo.exec.ExecMojo.execute(ExecMojo.java:313)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:106)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:317)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:152)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:555)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.6.0:exec (Erlang Test) on project ErlangServerTests: Command execution failed. Process exited with an error: 1 (Exit value: 1) -> [Help 1]
```
* [Erlang] Bump `jsx` dependency to latest stable version
* [Erlang] Disable sample server from CI until compilation works
2017-05-06 03:23:30 +00:00
# Add rebar3 build tool and recent Erlang/OTP for Erlang petstore server tests.
# - Travis CI does not support rebar3 [yet](https://github.com/travis-ci/travis-ci/issues/6506#issuecomment-275189490).
# - Rely on `kerl` for [pre-compiled versions available](https://docs.travis-ci.com/user/languages/erlang#Choosing-OTP-releases-to-test-against). Rely on installation path chosen by [`travis-erlang-builder`](https://github.com/travis-ci/travis-erlang-builder/blob/e6d016b1a91ca7ecac5a5a46395bde917ea13d36/bin/compile#L18).
2017-11-12 13:50:11 +00:00
# - . ~/otp/18.2.1/activate && erl -version
#- curl -f -L -o ./rebar3 https://s3.amazonaws.com/rebar3/rebar3 && chmod +x ./rebar3 && ./rebar3 version && export PATH="${TRAVIS_BUILD_DIR}:$PATH"
2019-10-17 09:48:35 +00:00
# install C++ tools
- sudo apt install -y --no-install-recommends valgrind cmake build-essential
# install Qt5
- sudo apt install -y --no-install-recommends qt5-default
- cmake --version
2016-07-19 14:36:10 +00:00
# show host table to confirm petstore.swagger.io is mapped to localhost
- cat /etc/hosts
2017-03-21 13:48:40 +00:00
# show java version
- java -version
2018-06-10 00:53:26 +00:00
- if [ "$TRAVIS_BRANCH" = "master" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
openssl aes-256-cbc -K $encrypted_6e2c8bba47c6_key -iv $encrypted_6e2c8bba47c6_iv -in sec.gpg.enc -out sec.gpg -d ;
gpg --keyserver keyserver.ubuntu.com --recv-key $SIGNING_KEY ;
gpg --check-trustdb ;
fi;
2020-02-17 16:19:18 +00:00
- pushd .; cd website; yarn install; popd
2016-01-06 17:31:06 +00:00
2016-01-05 12:08:52 +00:00
install :
2016-07-27 08:19:23 +00:00
# Add Godeps dependencies to GOPATH and PATH
2018-07-22 08:41:20 +00:00
#- eval "$(curl -sL https://raw.githubusercontent.com/travis-ci/gimme/master/gimme | GIMME_GO_VERSION=1.4 bash)"
#- export GOPATH="${TRAVIS_BUILD_DIR}/Godeps/_workspace"
2018-08-31 17:49:18 +00:00
- export PATH="${TRAVIS_BUILD_DIR}/Godeps/_workspace/bin:$HOME/.cargo/bin:$PATH:/usr/lib/dart/bin"
2018-07-22 08:41:20 +00:00
#- go version
- gcc -v
- echo $CC
- echo $CXX
2018-11-30 17:04:00 +00:00
#- pub version
#- dart --version
2016-01-06 17:31:06 +00:00
2016-01-05 04:25:45 +00:00
script :
2017-01-09 10:29:41 +00:00
# fail fast
- set -e
2018-11-15 04:25:14 +00:00
# fail if templates/generators contain carriage return '\r'
- /bin/bash ./bin/utils/detect_carriage_return.sh
# fail if generators contain merge conflicts
- /bin/bash ./bin/utils/detect_merge_conflict.sh
# fail if generators contain tab '\t'
- /bin/bash ./bin/utils/detect_tab_in_java_class.sh
# run integration tests defined in maven pom.xml
2019-05-05 19:15:18 +00:00
# WARN: Travis will timeout after 10 minutes of no stdout/stderr activity, which is problematic with mvn --quiet.
2020-01-29 08:28:42 +00:00
- mvn --quiet --batch-mode --show-version clean install -Dorg.slf4j.simpleLogger.defaultLogLevel=error
- mvn --quiet --batch-mode --show-version verify -Psamples -Dorg.slf4j.simpleLogger.defaultLogLevel=error
2019-06-04 16:07:15 +00:00
# test maven plugin
2020-01-29 08:28:42 +00:00
- mvn --quiet clean compile -f modules/openapi-generator-maven-plugin/examples/java-client.xml -Dorg.slf4j.simpleLogger.defaultLogLevel=error
- mvn --quiet clean compile -f modules/openapi-generator-maven-plugin/examples/multi-module/pom.xml -Dorg.slf4j.simpleLogger.defaultLogLevel=error
- mvn --quiet clean compile -f modules/openapi-generator-maven-plugin/examples/kotlin.xml -Dorg.slf4j.simpleLogger.defaultLogLevel=error
- mvn --quiet clean compile -f modules/openapi-generator-maven-plugin/examples/spring.xml -Dorg.slf4j.simpleLogger.defaultLogLevel=error
2019-06-06 19:09:26 +00:00
# test gradle plugin
- (cd modules/openapi-generator-gradle-plugin/samples/local-spec && ./gradlew buildGoSdk)
- (cd modules/openapi-generator-gradle-plugin/samples/local-spec && ./gradlew openApiGenerate)
2018-01-21 15:21:42 +00:00
after_success :
2018-06-09 18:21:31 +00:00
# push to maven repo
2019-05-31 12:43:21 +00:00
- if [ $SONATYPE_USERNAME ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
if [ "$TRAVIS_BRANCH" = "master" ] && [ -z $TRAVIS_TAG ]; then
echo "Publishing from branch $TRAVIS_BRANCH";
2018-08-27 08:51:51 +00:00
mvn clean deploy -DskipTests=true -B -U -P release --settings CI/settings.xml;
echo "Finished mvn clean deploy for $TRAVIS_BRANCH";
2018-06-12 14:25:47 +00:00
pushd .;
cd modules/openapi-generator-gradle-plugin;
2019-06-02 03:36:17 +00:00
./gradlew -Psigning.keyId="$SIGNING_KEY" -Psigning.password="$SIGNING_PASSPHRASE" -Psigning.secretKeyRingFile="${TRAVIS_BUILD_DIR}/sec.gpg" -PossrhUsername="${SONATYPE_USERNAME}" -PossrhPassword="${SONATYPE_PASSWORD}" publishMavenJavaPublicationToNexusRepository closeAndReleaseRepository --no-daemon;
2019-05-31 12:43:21 +00:00
echo "Finished ./gradlew publishPluginMavenPublicationToNexusRepository closeAndReleaseRepository";
2018-06-12 14:25:47 +00:00
popd;
2019-05-31 12:43:21 +00:00
elif [ -z $TRAVIS_TAG ] && [[ "$TRAVIS_BRANCH" =~ ^[0-9]+\.[0-9]+\.x$ ]]; then
echo "Publishing from branch $TRAVIS_BRANCH";
2018-08-27 08:51:51 +00:00
mvn clean deploy --settings CI/settings.xml;
echo "Finished mvn clean deploy for $TRAVIS_BRANCH";
2018-06-12 14:25:47 +00:00
pushd .;
cd modules/openapi-generator-gradle-plugin;
2019-05-31 12:43:21 +00:00
./gradlew -PossrhUsername="${SONATYPE_USERNAME}" -PossrhPassword="${SONATYPE_PASSWORD}" publishPluginMavenPublicationToNexusRepository closeAndReleaseRepository --no-daemon;
echo "Finished ./gradlew publishPluginMavenPublicationToNexusRepository closeAndReleaseRepository";
popd;
fi;
if [ -n $TRAVIS_TAG ] && [[ "$TRAVIS_TAG" =~ ^[v][0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Publishing the gradle plugin to Gradle Portal on tag $TRAVIS_TAG (only)";
pushd .;
cd modules/openapi-generator-gradle-plugin;
2019-03-26 01:24:49 +00:00
./gradlew -Psigning.keyId="$SIGNING_KEY" -Psigning.password="$SIGNING_PASSPHRASE" -Psigning.secretKeyRingFile="${TRAVIS_BUILD_DIR}/sec.gpg" publishPlugins -Dgradle.publish.key=$GRADLE_PUBLISH_KEY -Dgradle.publish.secret=$GRADLE_PUBLISH_SECRET --no-daemon;
2019-03-25 02:19:19 +00:00
echo "Finished ./gradlew publishPlugins (plugin portal)";
2018-06-12 14:25:47 +00:00
popd;
fi;
2018-01-21 15:21:42 +00:00
fi;
2018-07-06 03:28:10 +00:00
## docker: build and push openapi-generator-online to DockerHub
2020-04-02 03:05:25 +00:00
- if [ $DOCKER_HUB_USERNAME ]; then
echo "$DOCKER_HUB_PASSWORD" | docker login --username=$DOCKER_HUB_USERNAME --password-stdin;
export cli_version=$(\mvn -o org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version | grep -v '\[');
export build_date=$(date -u +"%Y-%m-%dT%H:%M:%SZ");
docker build --label=org.opencontainers.image.created=$build_date --label=org.opencontainers.image.title=openapi-generator-online --label=org.opencontainers.image.revision=$TRAVIS_COMMIT --label=org.opencontainers.image.version=$cli_version -t $DOCKER_GENERATOR_IMAGE_NAME ./modules/openapi-generator-online;
if [ ! -z "$TRAVIS_TAG" ]; then
docker tag $DOCKER_GENERATOR_IMAGE_NAME:latest $DOCKER_GENERATOR_IMAGE_NAME:$TRAVIS_TAG;
fi;
if [ ! -z "$TRAVIS_TAG" ] || [ "$TRAVIS_BRANCH" = "master" ]; then
docker push $DOCKER_GENERATOR_IMAGE_NAME && echo "Pushed to $DOCKER_GENERATOR_IMAGE_NAME";
fi;
fi;
2018-07-06 03:28:10 +00:00
## docker: build cli image and push to Docker Hub
2020-04-02 03:05:25 +00:00
- if [ $DOCKER_HUB_USERNAME ]; then
echo "$DOCKER_HUB_PASSWORD" | docker login --username=$DOCKER_HUB_USERNAME --password-stdin;
cp docker-entrypoint.sh ./modules/openapi-generator-cli;
export cli_version=$(\mvn -o org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version | grep -v '\[');
export build_date=$(date -u +"%Y-%m-%dT%H:%M:%SZ");
docker build --label=org.opencontainers.image.created=$build_date --label=org.opencontainers.image.title=openapi-generator-cli --label=org.opencontainers.image.revision=$TRAVIS_COMMIT --label=org.opencontainers.image.version=$cli_version -t $DOCKER_CODEGEN_CLI_IMAGE_NAME ./modules/openapi-generator-cli;
if [ ! -z "$TRAVIS_TAG" ]; then
docker tag $DOCKER_CODEGEN_CLI_IMAGE_NAME:latest $DOCKER_CODEGEN_CLI_IMAGE_NAME:$TRAVIS_TAG;
fi;
if [ ! -z "$TRAVIS_TAG" ] || [ "$TRAVIS_BRANCH" = "master" ]; then
docker push $DOCKER_CODEGEN_CLI_IMAGE_NAME;
echo "Pushed to $DOCKER_CODEGEN_CLI_IMAGE_NAME";
fi;
fi;
2019-01-18 09:39:33 +00:00
## publish latest website, variables below are secure environment variables which are unavailable to PRs from forks.
- if [ "$TRAVIS_BRANCH" = "master" ] && [ -z $TRAVIS_TAG ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
cd website;
git config --global user.name "${GH_NAME}";
git config --global user.email "${GH_EMAIL}";
echo "machine github.com login ${GH_NAME} password ${GH_TOKEN}" > ~/.netrc;
2020-02-17 16:19:18 +00:00
yarn install;
GIT_USER="${GH_NAME}" yarn run publish-gh-pages;
2019-01-18 09:39:33 +00:00
fi;
2018-07-06 03:28:10 +00:00
2017-11-12 13:50:11 +00:00
env :
2018-07-22 08:41:20 +00:00
- DOCKER_GENERATOR_IMAGE_NAME=openapitools/openapi-generator-online DOCKER_CODEGEN_CLI_IMAGE_NAME=openapitools/openapi-generator-cli NODE_ENV=test CC=gcc-5 CXX=g++-5
2019-05-05 19:15:18 +00:00