From 866d67a78fb42d9b141d78ab69a4bfbaa26e8eb8 Mon Sep 17 00:00:00 2001 From: William Cheng Date: Sun, 16 Oct 2022 16:20:49 +0800 Subject: [PATCH] Move some travis tests to github workflow, remove redundant c# test (#13704) * move some travis tests to github workflow, remove reduntant c# test * setup ruby * switch to setup-ruby * bundle install * remove bash * remove bundle install * remmvoe gemfile * add more folders in tab detection * comment out java folder in tab detection * undo changes in tab detection --- .github/workflows/misc-test.yaml | 32 +++++++++++++++++++ .travis.yml | 10 ------ bin/utils/detect_tab_in_templates.sh | 2 +- bin/utils/test_file_list.yaml | 2 +- .../Org.OpenAPITools.Test/Model/CatTests.cs | 5 ++- 5 files changed, 36 insertions(+), 15 deletions(-) create mode 100644 .github/workflows/misc-test.yaml diff --git a/.github/workflows/misc-test.yaml b/.github/workflows/misc-test.yaml new file mode 100644 index 00000000000..d359aab4b29 --- /dev/null +++ b/.github/workflows/misc-test.yaml @@ -0,0 +1,32 @@ +name: Misc Tests + +on: + push: + branches: + - master + - '[5-9]+.[0-9]+.x' + pull_request: + branches: + - master + - '[5-9]+.[0-9]+.x' + +jobs: + build: + name: Misc tests + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: '2.6' + bundler-cache: false # runs 'bundle install' and caches installed gems automatically + - name: Detect tabs + run: /bin/bash ./bin/utils/detect_tab_in_templates.sh + - name: Detect changes in test files + run: ./bin/utils/detect_test_file_changes.rb bin/utils/test_file_list.yaml + - name: Detect carriage return + run: /bin/bash ./bin/utils/detect_carriage_return.sh + - name: Detect merge conflicts + run: /bin/bash ./bin/utils/detect_merge_conflict.sh + - name: Detect tabs + run: /bin/bash ./bin/utils/detect_tab_in_java_class.sh diff --git a/.travis.yml b/.travis.yml index aa1007f065b..ddec30b70b5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -147,16 +147,6 @@ script: - set -e # show docker buildx version - docker buildx version - # fail if the template files contains tabs - - /bin/bash ./bin/utils/detect_tab_in_templates.sh - # fail if the test files have changes - - bin/utils/detect_test_file_changes.rb bin/utils/test_file_list.yaml - # 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 # WARN: Travis will timeout after 10 minutes of no stdout/stderr activity, which is problematic with mvn --quiet. - mvn -e --no-snapshot-updates --quiet --batch-mode --show-version clean install -Dorg.slf4j.simpleLogger.defaultLogLevel=error diff --git a/bin/utils/detect_tab_in_templates.sh b/bin/utils/detect_tab_in_templates.sh index e3ac60b104d..070b47e8a41 100755 --- a/bin/utils/detect_tab_in_templates.sh +++ b/bin/utils/detect_tab_in_templates.sh @@ -6,11 +6,11 @@ ## declare an array of folders declare -a samples=("modules/openapi-generator/src/main/resources/kotlin-server" "modules/openapi-generator/src/main/resources/kotlin-spring" - "modules/openapi-generator/src/main/resources/dart-dio" "modules/openapi-generator/src/main/resources/dart" "modules/openapi-generator/src/main/resources/dart2" "modules/openapi-generator/src/main/resources/aspnetcore" "modules/openapi-generator/src/main/resources/powershell" + "modules/openapi-generator/src/main/resources/r" ) ## now loop through the above array diff --git a/bin/utils/test_file_list.yaml b/bin/utils/test_file_list.yaml index 2409f0e2849..e294749026f 100644 --- a/bin/utils/test_file_list.yaml +++ b/bin/utils/test_file_list.yaml @@ -1,7 +1,7 @@ --- # csharp-netcore test files and image for upload - filename: "samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools.Test/JSONComposedSchemaTests.cs" - sha256: 64024927bc08a520ff11ba7083f83be960909a19ef273f63c1eaaef1cc6f34a2 + sha256: aaa596db60531417994533b0e7962eca21dcaf8fa3aea1e2e3cb8b1b216cb89f - filename: "samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools.Test/Api/PetApiTests.cs" sha256: dae985015ba461297927d544a78267f2def35e07c3f14ca66468fd61e1fd1c26 - filename: "samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools.Test/linux-logo.png" diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools.Test/Model/CatTests.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools.Test/Model/CatTests.cs index 6deb4b1b610..701ba760282 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools.Test/Model/CatTests.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools.Test/Model/CatTests.cs @@ -51,9 +51,8 @@ namespace Org.OpenAPITools.Test.Model [Fact] public void CatInstanceTest() { - // test to ensure both Cat and Animal (parent) can have "AdditionalProperties", which result in warnings - Cat c = JsonConvert.DeserializeObject("{\"className\":\"cat\",\"bar\":\"from json bar\"}"); - Assert.Equal("from json bar", c.AdditionalProperties["bar"]); + // TODO uncomment below to test "IsType" Cat + //Assert.IsType(instance); }