forked from loafle/openapi-generator-original
[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
This commit is contained in:
parent
071dc3413d
commit
b8c5a647e0
19
.github/actions/run-samples/action.yaml
vendored
Normal file
19
.github/actions/run-samples/action.yaml
vendored
Normal file
@ -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
|
78
.github/workflows/samples-dart.yaml
vendored
Normal file
78
.github/workflows/samples-dart.yaml
vendored
Normal file
@ -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
|
@ -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
|
||||
|
59
pom.xml
59
pom.xml
@ -1418,18 +1418,40 @@
|
||||
</activation>
|
||||
<modules>
|
||||
<!-- clients -->
|
||||
<module>samples/openapi3/client/petstore/dart2/petstore_client_lib</module>
|
||||
<module>samples/openapi3/client/petstore/dart2/petstore</module>
|
||||
<module>samples/openapi3/client/petstore/dart-dio/petstore_client_lib</module>
|
||||
<module>samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake</module>
|
||||
<module>samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake</module>
|
||||
<!--<module>samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake</module>-->
|
||||
<module>samples/client/petstore/R</module>
|
||||
<!--<module>samples/client/petstore/haskell-http-client</module>-->
|
||||
<!-- servers -->
|
||||
<!--<module>samples/server/petstore/haskell-servant</module>-->
|
||||
</modules>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>samples.dart-2.13</id>
|
||||
<activation>
|
||||
<property>
|
||||
<name>env</name>
|
||||
<value>samples.dart-2.13</value>
|
||||
</property>
|
||||
</activation>
|
||||
<modules>
|
||||
<module>samples/openapi3/client/petstore/dart2/petstore_client_lib</module>
|
||||
<module>samples/openapi3/client/petstore/dart2/petstore</module>
|
||||
<!--<module>samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake</module>-->
|
||||
<module>samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake</module>
|
||||
</modules>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>samples.dart-2.10</id>
|
||||
<activation>
|
||||
<property>
|
||||
<name>env</name>
|
||||
<value>samples.dart-2.10</value>
|
||||
</property>
|
||||
</activation>
|
||||
<modules>
|
||||
<module>samples/openapi3/client/petstore/dart-dio/petstore_client_lib</module>
|
||||
<module>samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake</module>
|
||||
</modules>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>samples.ios</id>
|
||||
<activation>
|
||||
@ -1475,15 +1497,24 @@
|
||||
<module>samples/client/petstore/objc/core-data/SwaggerClientTests</module>-->
|
||||
</modules>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>openapi-generator</id>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
<property>
|
||||
<name>!integration-test</name>
|
||||
</property>
|
||||
</activation>
|
||||
<modules>
|
||||
<module>modules/openapi-generator-core</module>
|
||||
<module>modules/openapi-generator</module>
|
||||
<module>modules/openapi-generator-cli</module>
|
||||
<module>modules/openapi-generator-maven-plugin</module>
|
||||
<module>modules/openapi-generator-gradle-plugin</module>
|
||||
<module>modules/openapi-generator-online</module>
|
||||
</modules>
|
||||
</profile>
|
||||
</profiles>
|
||||
<modules>
|
||||
<module>modules/openapi-generator-core</module>
|
||||
<module>modules/openapi-generator</module>
|
||||
<module>modules/openapi-generator-cli</module>
|
||||
<module>modules/openapi-generator-maven-plugin</module>
|
||||
<module>modules/openapi-generator-gradle-plugin</module>
|
||||
<module>modules/openapi-generator-online</module>
|
||||
</modules>
|
||||
<reporting>
|
||||
<outputDirectory>target/site</outputDirectory>
|
||||
<plugins>
|
||||
|
@ -39,26 +39,6 @@
|
||||
</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>format</id>
|
||||
<phase>pre-integration-test</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<executable>dart</executable>
|
||||
<arguments>
|
||||
<argument>format</argument>
|
||||
<!--
|
||||
Need to format first so that analyze can be run later.
|
||||
But can not break the build with set-exit-if-changed
|
||||
since sample files are not formatted.
|
||||
-->
|
||||
<argument>--output=none</argument>
|
||||
<argument>.</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>pub-run-build-runner</id>
|
||||
<phase>pre-integration-test</phase>
|
||||
|
@ -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,
|
||||
);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user