From 6a263565e7e4526f036d437a35c87fc6efefa14f Mon Sep 17 00:00:00 2001 From: Tanmay Mohapatra Date: Thu, 13 Jul 2023 21:49:56 +0530 Subject: [PATCH] [Julia] add Julia tests to GitHub workflow (#16089) * [Julia] add Julia tests to GitHub workflow Added Julia client and server tests to GitHub workflow * fix paths --- .github/workflows/samples-julia.yaml | 41 +++++++++++++++++++ bin/configs/julia-client-petstore-new.yaml | 2 + bin/configs/julia-server-petstore-new.yaml | 2 + .../petstore/julia/src/PetStoreClient.jl | 13 ++++++ .../petstore/julia/src/PetStoreServer.jl | 8 ++++ 5 files changed, 66 insertions(+) create mode 100644 .github/workflows/samples-julia.yaml diff --git a/.github/workflows/samples-julia.yaml b/.github/workflows/samples-julia.yaml new file mode 100644 index 00000000000..622a87da43a --- /dev/null +++ b/.github/workflows/samples-julia.yaml @@ -0,0 +1,41 @@ +name: Samples Julia + +on: + push: + paths: + - 'samples/client/petstore/julia/**' + - 'samples/server/petstore/julia/**' + pull_request: + paths: + - 'samples/client/petstore/julia/**' + - 'samples/server/petstore/julia/**' + +jobs: + tests-julia: + name: Tests Julia + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: julia-actions/setup-julia@v1 + with: + version: 1 + arch: x64 + - name: Test + shell: bash + working-directory: 'samples' + run: | + currdir=`pwd` + # Using a specific version of OpenAPI.jl helps avoid introducing version inter-dependencies + # and allows breaking changes to be done in either repos independently + # Using develop mode to install package so that it is easier to modify the package test files + julia -e "using Pkg; Pkg.develop(\"OpenAPI\");" + cd ~/.julia/dev/OpenAPI + git checkout v0.1.12 + cd $currdir + rm -rf ~/.julia/dev/OpenAPI/test/client/petstore_v3/petstore + rm -rf ~/.julia/dev/OpenAPI/test/server/petstore_v3/petstore + cp -r client/petstore/julia ~/.julia/dev/OpenAPI/test/client/petstore_v3/petstore + cp -r server/petstore/julia ~/.julia/dev/OpenAPI/test/server/petstore_v3/petstore + # setting this env runs only the tests relevant to the openapi-generator repo + export OPENAPI_GENERATOR=true + julia -e "using Pkg; Pkg.test(\"OpenAPI\");" diff --git a/bin/configs/julia-client-petstore-new.yaml b/bin/configs/julia-client-petstore-new.yaml index c117487efd9..ff009f02d7c 100644 --- a/bin/configs/julia-client-petstore-new.yaml +++ b/bin/configs/julia-client-petstore-new.yaml @@ -5,3 +5,5 @@ templateDir: modules/openapi-generator/src/main/resources/julia-client additionalProperties: hideGenerationTimestamp: "true" packageName: PetStoreClient + exportOperations: "true" + exportModels: "true" \ No newline at end of file diff --git a/bin/configs/julia-server-petstore-new.yaml b/bin/configs/julia-server-petstore-new.yaml index 9b709b71db1..cabad7fdb9c 100644 --- a/bin/configs/julia-server-petstore-new.yaml +++ b/bin/configs/julia-server-petstore-new.yaml @@ -5,3 +5,5 @@ templateDir: modules/openapi-generator/src/main/resources/julia-server additionalProperties: hideGenerationTimestamp: "true" packageName: PetStoreServer + exportOperations: "true" + exportModels: "true" \ No newline at end of file diff --git a/samples/client/petstore/julia/src/PetStoreClient.jl b/samples/client/petstore/julia/src/PetStoreClient.jl index 1a427c742ef..e90d860dfe4 100644 --- a/samples/client/petstore/julia/src/PetStoreClient.jl +++ b/samples/client/petstore/julia/src/PetStoreClient.jl @@ -15,4 +15,17 @@ include("apis/api_PetApi.jl") include("apis/api_StoreApi.jl") include("apis/api_UserApi.jl") +# export models +export ApiResponse +export Category +export Order +export Pet +export Tag +export User + +# export operations +export PetApi +export StoreApi +export UserApi + end # module PetStoreClient diff --git a/samples/server/petstore/julia/src/PetStoreServer.jl b/samples/server/petstore/julia/src/PetStoreServer.jl index 2a628275035..a1b8a0a6970 100644 --- a/samples/server/petstore/julia/src/PetStoreServer.jl +++ b/samples/server/petstore/julia/src/PetStoreServer.jl @@ -112,4 +112,12 @@ function register(router::HTTP.Router, impl; path_prefix::String="", optional_mi return router end +# export models +export ApiResponse +export Category +export Order +export Pet +export Tag +export User + end # module PetStoreServer