diff options
author | Jiayu Liu <Jimexist@users.noreply.github.com> | 2022-05-10 01:56:30 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-09 13:56:30 -0400 |
commit | ab83ffc894c00f0a8feade2f54cb444c22e16461 (patch) | |
tree | 715e73c16b47dbab617ec1056dc9fb7c7809d17f | |
parent | 5fdfd0cae0abaa89a26fa0015d31b6d369b32777 (diff) | |
download | thrift-ab83ffc894c00f0a8feade2f54cb444c22e16461.tar.gz |
THRIFT-5564: setup cross test in GitHub action (#2602)
* include java and kotlin into precross
-rw-r--r-- | .github/workflows/build.yml | 97 | ||||
-rw-r--r-- | lib/kotlin/build.gradle.kts | 6 | ||||
-rw-r--r-- | lib/kotlin/cross-test-client/build.gradle.kts | 6 | ||||
-rw-r--r-- | lib/kotlin/cross-test-server/build.gradle.kts | 6 | ||||
-rwxr-xr-x | test/test.py | 4 |
5 files changed, 115 insertions, 4 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cc2d1c90f..d1afc3383 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,7 +7,7 @@ on: branches: ["*"] env: - BUILD_DEPS: automake bison flex g++ git libboost-all-dev libevent-dev libssl-dev libtool make pkg-config + BUILD_DEPS: automake bison flex git libboost-all-dev libevent-dev libssl-dev libtool make pkg-config jobs: # TODO windows and macos @@ -22,7 +22,7 @@ jobs: - name: Install dependencies run: | sudo apt-get update -yq - sudo apt-get install -y --no-install-recommends $BUILD_DEPS + sudo apt-get install -y --no-install-recommends g++ $BUILD_DEPS - name: Run bootstrap run: ./bootstrap.sh @@ -131,11 +131,104 @@ jobs: - name: Run make for java run: make -C lib/java + - name: Run make install for java + run: make -C lib/java install + + - name: Upload java libthrift artifacts + uses: actions/upload-artifact@v3 + with: + name: libthrift + if-no-files-found: error + path: ~/.m2/repository/org/apache/thrift + - name: Run make check for java run: make -C lib/java check + - name: Run make precross for java + run: make -C lib/java precross + + - name: Upload java precross artifacts + uses: actions/upload-artifact@v3 + with: + name: java-precross + if-no-files-found: error + path: | + lib/java/build/functionalTestJar/ + lib/java/build/runclient + lib/java/build/runnonblockingserver + lib/java/build/runserver + lib/java/build/runservletserver + retention-days: 3 + - name: Run make for kotlin run: make -C lib/kotlin - name: Run make check for kotlin run: make -C lib/kotlin check + + - name: Run make precross for kotlin + run: make -C lib/kotlin precross + + - name: Upload kotlin precross artifacts + uses: actions/upload-artifact@v3 + with: + name: kotlin-precross + if-no-files-found: error + path: | + lib/kotlin/cross-test-client/build/install/TestClient/ + lib/kotlin/cross-test-server/build/install/TestServer/ + retention-days: 3 + + cross-test: + needs: + - lib-java-kotlin + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v3 + with: + python-version: "3.x" + - uses: actions/setup-java@v3 + with: + distribution: temurin + # here we intentionally use java 8 so that we also verify java 11 compiles to version 8 + java-version: 8 + cache: "gradle" + + - name: Download java precross artifacts + uses: actions/download-artifact@v3 + with: + name: java-precross + path: lib/java/build + + - name: Download kotlin precross artifacts + uses: actions/download-artifact@v3 + with: + name: kotlin-precross + path: lib/kotlin + + - name: Set back executable flags + run: | + chmod a+x \ + lib/java/build/run* \ + lib/kotlin/cross-test-client/build/install/TestClient/bin/* \ + lib/kotlin/cross-test-server/build/install/TestServer/bin/* + + - name: Run cross test + env: + THRIFT_CROSSTEST_CONCURRENCY: 4 + PRECROSS_LANGS: java,kotlin + run: | + python test/test.py \ + --retry-count 5 \ + --skip-known-failures \ + --server $PRECROSS_LANGS \ + --client $PRECROSS_LANGS + + - name: Upload log files from failed cross test runs + uses: actions/upload-artifact@v3 + if: failure() + with: + name: cross-test-log + path: test/log/ + retention-days: 3 diff --git a/lib/kotlin/build.gradle.kts b/lib/kotlin/build.gradle.kts index 842c1b9dd..1f7711a5a 100644 --- a/lib/kotlin/build.gradle.kts +++ b/lib/kotlin/build.gradle.kts @@ -34,6 +34,12 @@ dependencies { testImplementation(kotlin("test")) } +kotlin { + jvmToolchain { + (this as JavaToolchainSpec).languageVersion.set(JavaLanguageVersion.of(8)) + } +} + tasks { ktfmt { kotlinLangStyle() diff --git a/lib/kotlin/cross-test-client/build.gradle.kts b/lib/kotlin/cross-test-client/build.gradle.kts index 92b451a85..deda4671c 100644 --- a/lib/kotlin/cross-test-client/build.gradle.kts +++ b/lib/kotlin/cross-test-client/build.gradle.kts @@ -50,6 +50,12 @@ dependencies { testImplementation("org.jetbrains.kotlin:kotlin-test-junit") } +kotlin { + jvmToolchain { + (this as JavaToolchainSpec).languageVersion.set(JavaLanguageVersion.of(8)) + } +} + tasks { application { applicationName = "TestClient" diff --git a/lib/kotlin/cross-test-server/build.gradle.kts b/lib/kotlin/cross-test-server/build.gradle.kts index 7a0c48b39..508b29d1f 100644 --- a/lib/kotlin/cross-test-server/build.gradle.kts +++ b/lib/kotlin/cross-test-server/build.gradle.kts @@ -48,6 +48,12 @@ dependencies { testImplementation("org.jetbrains.kotlin:kotlin-test-junit") } +kotlin { + jvmToolchain { + (this as JavaToolchainSpec).languageVersion.set(JavaLanguageVersion.of(8)) + } +} + tasks { application { applicationName = "TestServer" diff --git a/test/test.py b/test/test.py index f59256a26..cd5c4d41d 100755 --- a/test/test.py +++ b/test/test.py @@ -121,7 +121,7 @@ def run_feature_tests(server_match, feature_match, jobs, skip_known_failures, on return False -def default_concurrenty(): +def default_concurrency(): try: return int(os.environ.get('THRIFT_CROSSTEST_CONCURRENCY')) except (TypeError, ValueError): @@ -145,7 +145,7 @@ def main(argv): parser.add_argument('-r', '--retry-count', type=int, default=0, help='maximum retry on failure') parser.add_argument('-j', '--jobs', type=int, - default=default_concurrenty(), + default=default_concurrency(), help='number of concurrent test executions') g = parser.add_argument_group(title='Advanced') |