Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

THRIFT-5564: setup cross test in GitHub action #2602

Merged
merged 7 commits into from
May 9, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
104 changes: 102 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -131,11 +131,111 @@ 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
strategy:
matrix:
test_regex:
- "(binary)"
- "(header|json)"
- "(compact|multiplexed)"
jimexist marked this conversation as resolved.
Show resolved Hide resolved
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 \
--regex '${{ matrix.test_regex }}'

- 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
6 changes: 6 additions & 0 deletions lib/kotlin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ dependencies {
testImplementation(kotlin("test"))
}

kotlin {
jvmToolchain {
(this as JavaToolchainSpec).languageVersion.set(JavaLanguageVersion.of(8))
}
}

tasks {
ktfmt {
kotlinLangStyle()
Expand Down
6 changes: 6 additions & 0 deletions lib/kotlin/cross-test-client/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 6 additions & 0 deletions lib/kotlin/cross-test-server/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions test/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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')
Expand Down