mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-05-12 12:40:53 +00:00
Turns on python-experimental CI tests (#11390)
* Installs python3.9 in node3 * Moves python clients into separate node so they can use a docker image * Installs java and maven into docker * Switches off some python tests
This commit is contained in:
parent
6ac8d9b123
commit
42f3258faa
@ -1,16 +1,135 @@
|
||||
version: 2
|
||||
version: 2.1
|
||||
commands: # a reusable command with parameters
|
||||
command_build_and_test:
|
||||
parameters:
|
||||
nodeNo:
|
||||
default: "0"
|
||||
type: string
|
||||
steps:
|
||||
# Restore the dependency cache
|
||||
- restore_cache:
|
||||
keys:
|
||||
# Default branch if not
|
||||
- source-v2-{{ .Branch }}-{{ .Revision }}
|
||||
- source-v2-{{ .Branch }}-
|
||||
- source-v2-
|
||||
# Machine Setup
|
||||
# If you break your build into multiple jobs with workflows, you will probably want to do the parts of this that are relevant in each
|
||||
# The following `checkout` command checks out your code to your working directory. In 1.0 we did this implicitly. In 2.0 you can choose where in the course of a job your code should be checked out.
|
||||
- checkout
|
||||
# Prepare for artifact and test results collection equivalent to how it was done on 1.0.
|
||||
# In many cases you can simplify this from what is generated here.
|
||||
# 'See docs on artifact collection here https://circleci.com/docs/2.0/artifacts/'
|
||||
- run: mkdir -p $CIRCLE_ARTIFACTS $CIRCLE_TEST_REPORTS
|
||||
# This is based on your 1.0 configuration file or project settings
|
||||
- run:
|
||||
command: sudo update-alternatives --set java /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java; sudo update-alternatives --set javac /usr/lib/jvm/java-8-openjdk-amd64/bin/javac; echo -e "export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64" >> $BASH_ENV
|
||||
- run:
|
||||
command: 'sudo docker info >/dev/null 2>&1 || sudo service docker start; '
|
||||
- run:
|
||||
command: |-
|
||||
printf '127.0.0.1 petstore.swagger.io
|
||||
' | sudo tee -a /etc/hosts
|
||||
# - run: docker pull openapitools/openapi-petstore
|
||||
# - run: docker run -d -e OPENAPI_BASE_PATH=/v3 -e DISABLE_API_KEY=1 -e DISABLE_OAUTH=1 -p 80:8080 openapitools/openapi-petstore
|
||||
- run: docker pull swaggerapi/petstore
|
||||
- run: docker run --name petstore.swagger -d -e SWAGGER_HOST=http://petstore.swagger.io -e SWAGGER_BASE_PATH=/v2 -p 80:8080 swaggerapi/petstore
|
||||
- run: docker ps -a
|
||||
- run: sleep 30
|
||||
- run: cat /etc/hosts
|
||||
# Test
|
||||
- run: mvn --no-snapshot-updates --quiet clean install -Dorg.slf4j.simpleLogger.defaultLogLevel=error
|
||||
- run:
|
||||
name: "Setup custom environment variables"
|
||||
command: echo 'export CIRCLE_NODE_INDEX="<<parameters.nodeNo>>"' >> $BASH_ENV
|
||||
- run: ./CI/circle_parallel.sh
|
||||
# Save dependency cache
|
||||
- save_cache:
|
||||
key: source-v2-{{ .Branch }}-{{ .Revision }}
|
||||
paths:
|
||||
# This is a broad list of cache paths to include many possible development environments
|
||||
# You can probably delete some of these entries
|
||||
- vendor/bundle
|
||||
- ~/virtualenvs
|
||||
- ~/.m2
|
||||
- ~/.ivy2
|
||||
- ~/.sbt
|
||||
- ~/.bundle
|
||||
- ~/.go_workspace
|
||||
- ~/.gradle
|
||||
- ~/.cache/bower
|
||||
- ".git"
|
||||
- ~/.stack
|
||||
- /home/circleci/OpenAPITools/openapi-generator/samples/client/petstore/haskell-http-client/.stack-work
|
||||
- ~/R
|
||||
# save "default" cache using the key "source-v2-"
|
||||
- save_cache:
|
||||
key: source-v2-
|
||||
paths:
|
||||
# This is a broad list of cache paths to include many possible development environments
|
||||
# You can probably delete some of these entries
|
||||
- vendor/bundle
|
||||
- ~/virtualenvs
|
||||
- ~/.m2
|
||||
- ~/.ivy2
|
||||
- ~/.sbt
|
||||
- ~/.bundle
|
||||
- ~/.go_workspace
|
||||
- ~/.gradle
|
||||
- ~/.cache/bower
|
||||
- ".git"
|
||||
- ~/.stack
|
||||
- /home/circleci/OpenAPITools/openapi-generator/samples/client/petstore/haskell-http-client/.stack-work
|
||||
- ~/R
|
||||
# Teardown
|
||||
# If you break your build into multiple jobs with workflows, you will probably want to do the parts of this that are relevant in each
|
||||
# Save test results
|
||||
- store_test_results:
|
||||
path: /tmp/circleci-test-results
|
||||
# Save artifacts
|
||||
- store_artifacts:
|
||||
path: /tmp/circleci-artifacts
|
||||
- store_artifacts:
|
||||
path: /tmp/circleci-test-results
|
||||
command_docker_build_and_test:
|
||||
parameters:
|
||||
nodeNo:
|
||||
default: "0"
|
||||
type: string
|
||||
steps:
|
||||
# Machine Setup
|
||||
# If you break your build into multiple jobs with workflows, you will probably want to do the parts of this that are relevant in each
|
||||
# The following `checkout` command checks out your code to your working directory. In 1.0 we did this implicitly. In 2.0 you can choose where in the course of a job your code should be checked out.
|
||||
- checkout
|
||||
# Prepare for artifact and test results collection equivalent to how it was done on 1.0.
|
||||
# In many cases you can simplify this from what is generated here.
|
||||
# 'See docs on artifact collection here https://circleci.com/docs/2.0/artifacts/'
|
||||
- run: mkdir -p $CIRCLE_ARTIFACTS $CIRCLE_TEST_REPORTS
|
||||
# This is based on your 1.0 configuration file or project settings
|
||||
# - run:
|
||||
# command: sudo update-alternatives --set java /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java; sudo update-alternatives --set javac /usr/lib/jvm/java-8-openjdk-amd64/bin/javac; echo -e "export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64" >> $BASH_ENV
|
||||
# - run:
|
||||
# Test
|
||||
# - run: mvn --no-snapshot-updates --quiet clean install -Dorg.slf4j.simpleLogger.defaultLogLevel=error
|
||||
- run:
|
||||
name: "Setup custom environment variables"
|
||||
command: echo 'export CIRCLE_NODE_INDEX="<<parameters.nodeNo>>"' >> $BASH_ENV
|
||||
- run: ./CI/circle_parallel.sh
|
||||
# Teardown
|
||||
# If you break your build into multiple jobs with workflows, you will probably want to do the parts of this that are relevant in each
|
||||
# Save test results
|
||||
- store_test_results:
|
||||
path: /tmp/circleci-test-results
|
||||
# Save artifacts
|
||||
- store_artifacts:
|
||||
path: /tmp/circleci-artifacts
|
||||
- store_artifacts:
|
||||
path: /tmp/circleci-test-results
|
||||
jobs:
|
||||
build:
|
||||
# docker:
|
||||
# #- image: openapitools/openapi-generator
|
||||
# - image: swaggerapi/petstore
|
||||
# environment:
|
||||
# SWAGGER_HOST=http://petstore.swagger.io
|
||||
# SWAGGER_BASE_PATH=/v2
|
||||
node0:
|
||||
machine:
|
||||
image: circleci/classic:latest
|
||||
working_directory: ~/OpenAPITools/openapi-generator
|
||||
parallelism: 4
|
||||
shell: /bin/bash --login
|
||||
environment:
|
||||
CIRCLE_ARTIFACTS: /tmp/circleci-artifacts
|
||||
@ -18,85 +137,68 @@ jobs:
|
||||
DOCKER_GENERATOR_IMAGE_NAME: openapitools/openapi-generator
|
||||
DOCKER_CODEGEN_CLI_IMAGE_NAME: openapitools/openapi-generator-cli
|
||||
steps:
|
||||
# Restore the dependency cache
|
||||
- restore_cache:
|
||||
keys:
|
||||
# Default branch if not
|
||||
- source-v2-{{ .Branch }}-{{ .Revision }}
|
||||
- source-v2-{{ .Branch }}-
|
||||
- source-v2-
|
||||
# Machine Setup
|
||||
# If you break your build into multiple jobs with workflows, you will probably want to do the parts of this that are relevant in each
|
||||
# The following `checkout` command checks out your code to your working directory. In 1.0 we did this implicitly. In 2.0 you can choose where in the course of a job your code should be checked out.
|
||||
- checkout
|
||||
# Prepare for artifact and test results collection equivalent to how it was done on 1.0.
|
||||
# In many cases you can simplify this from what is generated here.
|
||||
# 'See docs on artifact collection here https://circleci.com/docs/2.0/artifacts/'
|
||||
- run: mkdir -p $CIRCLE_ARTIFACTS $CIRCLE_TEST_REPORTS
|
||||
# This is based on your 1.0 configuration file or project settings
|
||||
- run:
|
||||
command: sudo update-alternatives --set java /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java; sudo update-alternatives --set javac /usr/lib/jvm/java-8-openjdk-amd64/bin/javac; echo -e "export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64" >> $BASH_ENV
|
||||
- run:
|
||||
command: 'sudo docker info >/dev/null 2>&1 || sudo service docker start; '
|
||||
- run:
|
||||
command: |-
|
||||
printf '127.0.0.1 petstore.swagger.io
|
||||
' | sudo tee -a /etc/hosts
|
||||
# - run: docker pull openapitools/openapi-petstore
|
||||
# - run: docker run -d -e OPENAPI_BASE_PATH=/v3 -e DISABLE_API_KEY=1 -e DISABLE_OAUTH=1 -p 80:8080 openapitools/openapi-petstore
|
||||
- run: docker pull swaggerapi/petstore
|
||||
- run: docker run --name petstore.swagger -d -e SWAGGER_HOST=http://petstore.swagger.io -e SWAGGER_BASE_PATH=/v2 -p 80:8080 swaggerapi/petstore
|
||||
- run: docker ps -a
|
||||
- run: sleep 30
|
||||
- run: cat /etc/hosts
|
||||
# Test
|
||||
- run: mvn --no-snapshot-updates --quiet clean install -Dorg.slf4j.simpleLogger.defaultLogLevel=error
|
||||
- run: ./CI/circle_parallel.sh
|
||||
# Save dependency cache
|
||||
- save_cache:
|
||||
key: source-v2-{{ .Branch }}-{{ .Revision }}
|
||||
paths:
|
||||
# This is a broad list of cache paths to include many possible development environments
|
||||
# You can probably delete some of these entries
|
||||
- vendor/bundle
|
||||
- ~/virtualenvs
|
||||
- ~/.m2
|
||||
- ~/.ivy2
|
||||
- ~/.sbt
|
||||
- ~/.bundle
|
||||
- ~/.go_workspace
|
||||
- ~/.gradle
|
||||
- ~/.cache/bower
|
||||
- ".git"
|
||||
- ~/.stack
|
||||
- /home/circleci/OpenAPITools/openapi-generator/samples/client/petstore/haskell-http-client/.stack-work
|
||||
- ~/R
|
||||
# save "default" cache using the key "source-v2-"
|
||||
- save_cache:
|
||||
key: source-v2-
|
||||
paths:
|
||||
# This is a broad list of cache paths to include many possible development environments
|
||||
# You can probably delete some of these entries
|
||||
- vendor/bundle
|
||||
- ~/virtualenvs
|
||||
- ~/.m2
|
||||
- ~/.ivy2
|
||||
- ~/.sbt
|
||||
- ~/.bundle
|
||||
- ~/.go_workspace
|
||||
- ~/.gradle
|
||||
- ~/.cache/bower
|
||||
- ".git"
|
||||
- ~/.stack
|
||||
- /home/circleci/OpenAPITools/openapi-generator/samples/client/petstore/haskell-http-client/.stack-work
|
||||
- ~/R
|
||||
# Teardown
|
||||
# If you break your build into multiple jobs with workflows, you will probably want to do the parts of this that are relevant in each
|
||||
# Save test results
|
||||
- store_test_results:
|
||||
path: /tmp/circleci-test-results
|
||||
# Save artifacts
|
||||
- store_artifacts:
|
||||
path: /tmp/circleci-artifacts
|
||||
- store_artifacts:
|
||||
path: /tmp/circleci-test-results
|
||||
- command_build_and_test:
|
||||
nodeNo: "0"
|
||||
node1:
|
||||
machine:
|
||||
image: circleci/classic:latest
|
||||
working_directory: ~/OpenAPITools/openapi-generator
|
||||
shell: /bin/bash --login
|
||||
environment:
|
||||
CIRCLE_ARTIFACTS: /tmp/circleci-artifacts
|
||||
CIRCLE_TEST_REPORTS: /tmp/circleci-test-results
|
||||
DOCKER_GENERATOR_IMAGE_NAME: openapitools/openapi-generator
|
||||
DOCKER_CODEGEN_CLI_IMAGE_NAME: openapitools/openapi-generator-cli
|
||||
steps:
|
||||
- command_build_and_test:
|
||||
nodeNo: "1"
|
||||
node2:
|
||||
machine:
|
||||
image: circleci/classic:latest
|
||||
working_directory: ~/OpenAPITools/openapi-generator
|
||||
shell: /bin/bash --login
|
||||
environment:
|
||||
CIRCLE_ARTIFACTS: /tmp/circleci-artifacts
|
||||
CIRCLE_TEST_REPORTS: /tmp/circleci-test-results
|
||||
DOCKER_GENERATOR_IMAGE_NAME: openapitools/openapi-generator
|
||||
DOCKER_CODEGEN_CLI_IMAGE_NAME: openapitools/openapi-generator-cli
|
||||
steps:
|
||||
- command_build_and_test:
|
||||
nodeNo: "2"
|
||||
node3:
|
||||
machine:
|
||||
image: circleci/classic:latest
|
||||
working_directory: ~/OpenAPITools/openapi-generator
|
||||
shell: /bin/bash --login
|
||||
environment:
|
||||
CIRCLE_ARTIFACTS: /tmp/circleci-artifacts
|
||||
CIRCLE_TEST_REPORTS: /tmp/circleci-test-results
|
||||
DOCKER_GENERATOR_IMAGE_NAME: openapitools/openapi-generator
|
||||
DOCKER_CODEGEN_CLI_IMAGE_NAME: openapitools/openapi-generator-cli
|
||||
steps:
|
||||
- checkout
|
||||
- command_build_and_test:
|
||||
nodeNo: "3"
|
||||
node4:
|
||||
docker:
|
||||
- image: fkrull/multi-python
|
||||
working_directory: ~/OpenAPITools/openapi-generator
|
||||
shell: /bin/bash --login
|
||||
environment:
|
||||
CIRCLE_ARTIFACTS: /tmp/circleci-artifacts
|
||||
CIRCLE_TEST_REPORTS: /tmp/circleci-test-results
|
||||
DOCKER_GENERATOR_IMAGE_NAME: openapitools/openapi-generator
|
||||
DOCKER_CODEGEN_CLI_IMAGE_NAME: openapitools/openapi-generator-cli
|
||||
steps:
|
||||
- checkout
|
||||
- command_docker_build_and_test:
|
||||
nodeNo: "4"
|
||||
workflows:
|
||||
version: 2
|
||||
build:
|
||||
jobs:
|
||||
- node0
|
||||
- node1
|
||||
- node2
|
||||
- node3
|
||||
- node4
|
@ -11,7 +11,9 @@ export NODE_ENV=test
|
||||
|
||||
function cleanup {
|
||||
# Show logs of 'petstore.swagger' container to troubleshoot Unit Test failures, if any.
|
||||
docker logs petstore.swagger # container name specified in circle.yml
|
||||
if [ "$NODE_INDEX" != "4" ]; then
|
||||
docker logs petstore.swagger # container name specified in circle.yml
|
||||
fi
|
||||
}
|
||||
|
||||
trap cleanup EXIT
|
||||
@ -61,7 +63,6 @@ elif [ "$NODE_INDEX" = "3" ]; then
|
||||
pyenv install 3.6.3
|
||||
pyenv install 2.7.14
|
||||
pyenv global 3.6.3
|
||||
python3 --version
|
||||
|
||||
# Install node@stable (for angular 6)
|
||||
set +e
|
||||
@ -80,6 +81,20 @@ elif [ "$NODE_INDEX" = "3" ]; then
|
||||
|
||||
mvn --no-snapshot-updates --quiet verify -Psamples.circleci.node3 -Dorg.slf4j.simpleLogger.defaultLogLevel=error
|
||||
|
||||
elif [ "$NODE_INDEX" = "4" ]; then
|
||||
|
||||
echo "Running node $NODE_INDEX to test 'samples.circleci.node4' defined in pom.xml ..."
|
||||
|
||||
# install maven and java so we can use them to run our tests
|
||||
apt-get update && apt-get install -y default-jdk maven sudo
|
||||
java -version
|
||||
export JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:bin/java::")
|
||||
echo $JAVA_HOME
|
||||
# show os version
|
||||
uname -a
|
||||
|
||||
mvn --no-snapshot-updates --quiet verify -Psamples.circleci.node4 -Dorg.slf4j.simpleLogger.defaultLogLevel=error
|
||||
|
||||
else
|
||||
echo "Running node $NODE_INDEX to test 'samples.circleci.others' defined in pom.xml ..."
|
||||
#sudo update-java-alternatives -s java-1.7.0-openjdk-amd64
|
||||
|
@ -1,5 +1,5 @@
|
||||
[tox]
|
||||
envlist = py3
|
||||
envlist = py39
|
||||
|
||||
[testenv]
|
||||
deps=-r{toxinidir}/requirements.txt
|
||||
|
16
pom.xml
16
pom.xml
@ -1285,7 +1285,6 @@
|
||||
<!-- clients -->
|
||||
<module>samples/client/petstore/python</module>
|
||||
<module>samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent</module>
|
||||
<module>samples/openapi3/client/petstore/python</module>
|
||||
<!--<module>samples/openapi3/client/petstore/python-legacy</module>-->
|
||||
<!-- TODO comment out below when the test for typescript-nestjs is ready
|
||||
<module>samples/client/petstore/typescript-nestjs-v6-provided-in-root</module>-->
|
||||
@ -1316,6 +1315,21 @@
|
||||
<module>samples/client/petstore/javascript-promise-es6</module>
|
||||
</modules>
|
||||
</profile>
|
||||
<!-- node 4 tests in CircleCI -->
|
||||
<profile>
|
||||
<id>samples.circleci.node4</id>
|
||||
<activation>
|
||||
<property>
|
||||
<name>env</name>
|
||||
<value>samples.circleci.node4</value>
|
||||
</property>
|
||||
</activation>
|
||||
<modules>
|
||||
<!-- python clients which don't need the server running -->
|
||||
<module>samples/openapi3/client/petstore/python</module>
|
||||
<module>samples/openapi3/client/petstore/python-experimental</module>
|
||||
</modules>
|
||||
</profile>
|
||||
<!-- other tests in CircleCI -->
|
||||
<profile>
|
||||
<id>samples.circleci.others</id>
|
||||
|
46
samples/openapi3/client/petstore/python-experimental/pom.xml
Normal file
46
samples/openapi3/client/petstore/python-experimental/pom.xml
Normal file
@ -0,0 +1,46 @@
|
||||
<project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>PythonExperimentalOAS3PetstoreTests</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<name>Python Experimental OpenAPI3 Petstore Client</name>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>copy-dependencies</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${project.build.directory}</outputDirectory>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<version>1.2.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>test</id>
|
||||
<phase>integration-test</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<executable>make</executable>
|
||||
<arguments>
|
||||
<argument>test</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
@ -1,5 +1,5 @@
|
||||
[tox]
|
||||
envlist = py3
|
||||
envlist = py39
|
||||
|
||||
[testenv]
|
||||
deps=-r{toxinidir}/requirements.txt
|
||||
|
Loading…
x
Reference in New Issue
Block a user