From b8c5a647e0bbd6c29138edaed5d820177687084f Mon Sep 17 00:00:00 2001 From: Peter Leibiger Date: Fri, 21 May 2021 08:45:50 +0200 Subject: [PATCH] [dart][ci] Move Dart samples from CircleCI to Github actions (#9515) * [dart] Move Dart samples from CircleCI to Github actions * Fix format failing with latest Dart version * Workflow naming * Split dart samples depending on version * use fixed version to prevent flaky builds * Change branch pattern for release branches --- .github/actions/run-samples/action.yaml | 19 +++++ .github/workflows/samples-dart.yaml | 78 +++++++++++++++++++ CI/circle_parallel.sh | 13 ---- pom.xml | 59 ++++++++++---- .../petstore_client_lib_fake/pom.xml | 20 ----- .../test/model/date_serializer_test.dart | 15 +++- 6 files changed, 154 insertions(+), 50 deletions(-) create mode 100644 .github/actions/run-samples/action.yaml create mode 100644 .github/workflows/samples-dart.yaml diff --git a/.github/actions/run-samples/action.yaml b/.github/actions/run-samples/action.yaml new file mode 100644 index 00000000000..64bc7745862 --- /dev/null +++ b/.github/actions/run-samples/action.yaml @@ -0,0 +1,19 @@ +name: 'Run samples' +description: 'Runs sample integration test profile with Maven' +inputs: + name: + description: 'The Maven profile name' + required: true + goal: + description: 'Maven goal' + required: false + default: 'verify' + args: + description: 'Additional maven arguments' + required: false + default: '' +runs: + using: "composite" + steps: + - run: mvn --no-snapshot-updates --batch-mode --quiet ${{ inputs.goal }} -P${{ inputs.name }} -Dintegration-test -Dmaven.javadoc.skip=true ${{ inputs.args }} + shell: bash \ No newline at end of file diff --git a/.github/workflows/samples-dart.yaml b/.github/workflows/samples-dart.yaml new file mode 100644 index 00000000000..a1392d65e7c --- /dev/null +++ b/.github/workflows/samples-dart.yaml @@ -0,0 +1,78 @@ +name: Samples Dart + +on: + push: + branches: + - master + - '[5-9]+.[0-9]+.x' + pull_request: + branches: + - master + - '[5-9]+.[0-9]+.x' + +jobs: + tests-dart-2-10: + name: Tests Dart 2.10 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-java@v2 + with: + distribution: 'adopt' + java-version: 8 + - name: Cache maven dependencies + uses: actions/cache@v2 + env: + cache-name: maven-repository + with: + path: | + ~/.m2/repository + ~/.gradle + key: ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }} + - name: Cache test dependencies + uses: actions/cache@v2 + env: + cache-name: pub-cache + with: + path: $PUB_CACHE + key: ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('samples/**/pubspec.yaml') }} + - uses: dart-lang/setup-dart@v1 + with: + sdk: 2.10.5 + - name: Run tests + uses: ./.github/actions/run-samples + with: + name: samples.dart-2.10 + + tests-dart-2-13: + name: Tests Dart 2.13 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-java@v2 + with: + distribution: 'adopt' + java-version: 8 + - name: Cache maven dependencies + uses: actions/cache@v2 + env: + cache-name: maven-repository + with: + path: | + ~/.m2/repository + ~/.gradle + key: ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }} + - name: Cache test dependencies + uses: actions/cache@v2 + env: + cache-name: pub-cache + with: + path: $PUB_CACHE + key: ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('samples/**/pubspec.yaml') }} + - uses: dart-lang/setup-dart@v1 + with: + sdk: 2.13.0 + - name: Run tests + uses: ./.github/actions/run-samples + with: + name: samples.dart-2.13 diff --git a/CI/circle_parallel.sh b/CI/circle_parallel.sh index b647131c7d7..36e0c179b24 100755 --- a/CI/circle_parallel.sh +++ b/CI/circle_parallel.sh @@ -14,17 +14,6 @@ function cleanup { trap cleanup EXIT -function installDart { - # install dart2 - sudo apt-get update - sudo apt-get install apt-transport-https - sudo sh -c 'wget -qO- https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -' - sudo sh -c 'wget -qO- https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > /etc/apt/sources.list.d/dart_stable.list' - sudo apt-get update - sudo apt-get install dart - export PATH="$PATH:/usr/lib/dart/bin" -} - if [ "$NODE_INDEX" = "1" ]; then echo "Running node $NODE_INDEX to test 'samples.circleci' defined in pom.xml ..." java -version @@ -35,8 +24,6 @@ if [ "$NODE_INDEX" = "1" ]; then ls -l /home/circleci/.ivy2/cache elif [ "$NODE_INDEX" = "2" ]; then - installDart - # run ensure-up-to-date sample script on SNAPSHOT version only project_version=`mvn org.apache.maven.plugins:maven-help-plugin:3.1.0:evaluate -Dexpression=project.version -q -DforceStdout` if [[ $project_version == *"-SNAPSHOT" ]]; then diff --git a/pom.xml b/pom.xml index f5954bbd850..b968a476900 100644 --- a/pom.xml +++ b/pom.xml @@ -1418,18 +1418,40 @@ - samples/openapi3/client/petstore/dart2/petstore_client_lib - samples/openapi3/client/petstore/dart2/petstore - samples/openapi3/client/petstore/dart-dio/petstore_client_lib - samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake - samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake - samples/client/petstore/R + + samples.dart-2.13 + + + env + samples.dart-2.13 + + + + samples/openapi3/client/petstore/dart2/petstore_client_lib + samples/openapi3/client/petstore/dart2/petstore + + samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake + + + + samples.dart-2.10 + + + env + samples.dart-2.10 + + + + samples/openapi3/client/petstore/dart-dio/petstore_client_lib + samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake + + samples.ios @@ -1475,15 +1497,24 @@ samples/client/petstore/objc/core-data/SwaggerClientTests--> + + openapi-generator + + true + + !integration-test + + + + modules/openapi-generator-core + modules/openapi-generator + modules/openapi-generator-cli + modules/openapi-generator-maven-plugin + modules/openapi-generator-gradle-plugin + modules/openapi-generator-online + + - - modules/openapi-generator-core - modules/openapi-generator - modules/openapi-generator-cli - modules/openapi-generator-maven-plugin - modules/openapi-generator-gradle-plugin - modules/openapi-generator-online - target/site diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/pom.xml b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/pom.xml index 86285381f97..dec7604a53a 100644 --- a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/pom.xml +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/pom.xml @@ -39,26 +39,6 @@ - - format - pre-integration-test - - exec - - - dart - - format - - --output=none - . - - - pub-run-build-runner pre-integration-test diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake_tests/test/model/date_serializer_test.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake_tests/test/model/date_serializer_test.dart index acae38e3d90..9422fe8e47d 100644 --- a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake_tests/test/model/date_serializer_test.dart +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake_tests/test/model/date_serializer_test.dart @@ -8,15 +8,24 @@ void main() { group(DateSerializer, () { test('serialize', () { - expect(serializer.serialize(serializers, date1), '1999-03-25'); + expect( + serializer.serialize(serializers, date1), + '1999-03-25', + ); }); test('deserialize date', () { - expect(serializer.deserialize(serializers, '1999-03-25'), date1); + expect( + serializer.deserialize(serializers, '1999-03-25'), + date1, + ); }); test('deserialize ISO', () { - expect(serializer.deserialize(serializers, '1999-03-25T12:30:55.123Z'), date1); + expect( + serializer.deserialize(serializers, '1999-03-25T12:30:55.123Z'), + date1, + ); }); }); }