From 4c92f89f0ff0198e18f1972e5f67ff8a0379d86b Mon Sep 17 00:00:00 2001 From: Sebastien Boeuf Date: Wed, 11 Dec 2019 08:49:06 +0100 Subject: [PATCH] ci: Add OpenAPI validation We need to validate that OpenAPI YAML definition is not broken by each and every pull request. The easiest way is to rely on the Docker image provided by OpenAPITools, as it allows us to validate the definition with one simple command. Signed-off-by: Sebastien Boeuf --- Jenkinsfile | 6 ++++++ scripts/run_openapi_tests.sh | 5 +++++ 2 files changed, 11 insertions(+) create mode 100755 scripts/run_openapi_tests.sh diff --git a/Jenkinsfile b/Jenkinsfile index 5abc0936b..4ad125a57 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -13,6 +13,7 @@ pipeline{ steps { sh "sudo DEBIAN_FRONTEND=noninteractive apt-get install -yq build-essential mtools libssl-dev pkg-config" sh "sudo apt-get install -yq flex bison libelf-dev qemu-utils qemu-system libglib2.0-dev libpixman-1-dev libseccomp-dev socat" + sh "sudo snap install docker" } } stage ('Install Rust') { @@ -25,6 +26,11 @@ pipeline{ sh "scripts/run_cargo_tests.sh" } } + stage ('Run OpenAPI tests') { + steps { + sh "scripts/run_openapi_tests.sh" + } + } stage ('Run unit tests') { steps { sh "scripts/run_unit_tests.sh" diff --git a/scripts/run_openapi_tests.sh b/scripts/run_openapi_tests.sh new file mode 100755 index 000000000..04ca14d59 --- /dev/null +++ b/scripts/run_openapi_tests.sh @@ -0,0 +1,5 @@ +#!/bin/bash +set -e +set -x + +sudo docker run --rm -v ${PWD}:/local openapitools/openapi-generator-cli validate -i /local/vmm/src/api/openapi/cloud-hypervisor.yaml