[Erlang] Plant CI for server #5559

Merged
merged 5 commits into from May 6, 2017

Conversation

Projects
None yet
2 participants
Contributor

lucafavatella commented May 4, 2017

This PR is not ready to be merged yet, and opened for receiving comments (RFC).

PR checklist

  • Read the contribution guidelines.
  • Ran the shell/batch script under ./bin/ to update Petstore sample so that CIs can verify the change. (For instance, only need to run ./bin/{LANG}-petstore.sh and ./bin/security/{LANG}-petstore.sh if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates)
    • bin/erlang-petstore-server.sh
    • (There is no erlang-server related script in ./bin/security/)
  • Filed the PR against the correct branch: master for non-breaking changes and 2.3.0 branch for breaking (non-backward compatible) changes.

Description of the PR

This PR plants CI for erlang-server. A related issue seems to be #3762

This PR tests that the sample compiles, that can be considered a very basic test.

I see the current version of the code generation leaves functions syntactically invalid - i.e. no body at all rather than e.g. raising a runtime error - hence the code will not compile. I suggest - and I plan to implement if I find time - the way forward is populating the (generated) body with error(unimplemented) and the "correct" separator/terminator i.e. ; or .. Any comments?

lucafavatella added some commits May 4, 2017

@lucafavatella lucafavatella [Erlang] Address apparent reproducibily issue of sample
Spotted running `bin/erlang-petstore-server.sh` on d08d55d .

Apart from newlines, this is the opposite change of ec6248c .
89c21f6
@lucafavatella lucafavatella [Erlang] Perform basic testing of sample server on CI 4dba9a7
Member

wing328 commented May 5, 2017

@lucafavatella thanks for the enhancement but the CI (travis) failed:

�[0;32m===> Package jesse-1.4.0 not found. Fetching registry updates and trying again...
�[0m�[0;32m===> Updating package registry...
�[0m�[0;32m===> Writing registry to /home/travis/.cache/rebar3/hex/default/registry
�[0m�[0;32m===> Generating package index...
�[0m�[0;32m===> Writing index to /home/travis/.cache/rebar3/hex/default/packages.idx
�[0m�[0;32m===> Verifying dependencies...
�[0m�[0;32m===> Fetching jesse ({pkg,<<"jesse">>,<<"1.4.0">>})
�[0m�[0;35m===> Insecure HTTPS request (peer verification disabled), please update to OTP 17.4 or later
�[0m�[0;32m===> Downloaded package, caching at /home/travis/.cache/rebar3/hex/default/packages/jesse-1.4.0.tar
�[0m�[0;32m===> Fetching jsx ({pkg,<<"jsx">>,<<"2.8.2">>})
�[0m�[0;35m===> Insecure HTTPS request (peer verification disabled), please update to OTP 17.4 or later
�[0m�[0;32m===> Downloaded package, caching at /home/travis/.cache/rebar3/hex/default/packages/jsx-2.8.2.tar
�[0m�[0;35m===> Skipping jsx (from {pkg,<<"jsx">>,<<"2.8.2">>,
                                    <<"7ACC7D785B5ABE8A6E9ADBDE926A24E481F29956DD8B4DF49E3E4E7BCC92A018">>}) as an app of the same name has already been fetched
�[0m�[0;32m===> Compiling jsx
�[0m�[0;32m===> Compiling jesse
�[0m�[0;31m===> �[1mCompiling _build/default/lib/jesse/src/jesse_tests_util.erl failed
�[0m�[0m_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:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	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]
[ERROR] 

Please take a look when you've time.

Contributor

lucafavatella commented May 5, 2017

@lucafavatella thanks for the enhancement but the CI (travis) failed:

After I opened PR I realized that, so I need to first manage to install recent Erlang on Travis.

Then I may go forward in error(unimplemented) and ;/..

lucafavatella added some commits May 4, 2017

@lucafavatella lucafavatella [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]
```
df232af
@lucafavatella lucafavatella [Erlang] Bump `jsx` dependency to latest stable version
9c9c08c
@lucafavatella lucafavatella [Erlang] Disable sample server from CI until compilation works
845e644
Contributor

lucafavatella commented May 5, 2017

After I opened PR I realized that, so I need to first manage to install recent Erlang on Travis.

In df232af I bumped Erlang version. Corresponding CI build fails with a different reason as expected:

===> 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 swagger
===> Compiling src/swagger_api.erl failed
src/swagger_api.erl:226: syntax error before: ','
src/swagger_api.erl:4: function request_param_info/2 undefined
src/swagger_api.erl:146: spec for undefined function request_param_info/2
src/swagger_api.erl:407: function request_param_info/2 undefined

In c9c08c I performed a trivial change - a minor dep bump - but the corresponding CI build passes (!!!). The build shows no evidence of test having run. Shall I assume that somehow Travis got confused with some cache shared with the shortly afterwards committed 845e644 ?

In 845e644 I disabled the erlang-server test in CI because known to fail, and it passes as expected.

lucafavatella changed the title from [RFC][Erlang] Plant CI for server to [Erlang] Plant CI for server May 5, 2017

Contributor

lucafavatella commented May 5, 2017

Then I may go forward in error(unimplemented) and ;/..

I am unable to do this now. I suggest to review and merge PR as it is i.e. keeping CI still disabled, and then new PR (help warmly welcome, not sure whether and when I will be able to come back to this) may address compilation.

Contributor

lucafavatella commented May 5, 2017

In c9c08c I performed a trivial change - a minor dep bump - but the corresponding CI build passes (!!!). The build shows no evidence of test having run. Shall I assume that somehow Travis got confused with some cache shared with the shortly afterwards committed 845e644 ?

It appears yes - as the same commit in my fork failed Travis CI as expected src/swagger_api.erl:226: syntax error before: ','.

Member

wing328 commented May 6, 2017

@lucafavatella agree with you that we can look into the CI (travis) issue later.

wing328 merged commit ea16da8 into swagger-api:master May 6, 2017

3 checks passed

Shippable Run 3365 status is SUCCESS.
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

wing328 added this to the v2.2.3 milestone May 6, 2017

lucafavatella deleted the lucafavatella:ci-erlang-server branch May 10, 2017

@davidgri davidgri pushed a commit to davidgri/swagger-codegen that referenced this pull request May 11, 2017

@lucafavatella @wing328 lucafavatella + wing328 [Erlang] Plant CI for server (#5559)
* [Erlang] Address apparent reproducibily issue of sample

Spotted running `bin/erlang-petstore-server.sh` on d08d55d .

Apart from newlines, this is the opposite change of ec6248c .

* [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
2adf1dd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment