Skip to content

Commit

Permalink
Separate java and cpp/py UT (#305)
Browse files Browse the repository at this point in the history
  • Loading branch information
HTHou authored Nov 19, 2024
1 parent d30d283 commit 84fd5fe
Show file tree
Hide file tree
Showing 2 changed files with 96 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven

name: Unit-Test
name: Unit-Test-Cpp-Py

on:
push:
Expand All @@ -11,13 +11,15 @@ on:
- rc/*
paths-ignore:
- 'docs/**'
- 'java/**'
pull_request:
branches:
- develop
- iotdb
- rc/*
paths-ignore:
- 'docs/**'
- 'java/**'
# Enable manually starting builds, and allow forcing updating of SNAPSHOT dependencies.
workflow_dispatch:
inputs:
Expand All @@ -38,9 +40,8 @@ jobs:
unit-test:
strategy:
fail-fast: false
max-parallel: 20
max-parallel: 15
matrix:
java: [ 8, 17, 21 ]
os: [ ubuntu-latest, macos-latest, windows-latest ]
runs-on: ${{ matrix.os }}

Expand All @@ -49,12 +50,6 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v4
with:
distribution: corretto
java-version: ${{ matrix.java }}

# Setup caching of the artifacts in the .m2 directory, so they don't have to
# all be downloaded again for every build.
- name: Cache Maven packages
Expand All @@ -79,14 +74,13 @@ jobs:
core.setOutput('platform_suffix', ``)
}
# Run the actual maven build including all unit- and integration-tests.
# Run the actual maven build including all tests.
- name: Build and test with Maven
shell: bash
run: |
./mvnw${{ steps.platform_suffix.outputs.platform_suffix }} -P with-java,with-cpp,with-python clean verify
./mvnw${{ steps.platform_suffix.outputs.platform_suffix }} -P with-cpp,with-python clean verify
- name: Upload whl Artifact
if: ${{ matrix.java == '17'}}
uses: actions/upload-artifact@v4
with:
name: tsfile-${{ runner.os }}-whl
Expand Down
90 changes: 90 additions & 0 deletions .github/workflows/unit-test-java.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven

name: Unit-Test-Java

on:
push:
branches:
- develop
- iotdb
- rc/*
paths-ignore:
- 'docs/**'
- 'cpp/**'
- 'python/**'
pull_request:
branches:
- develop
- iotdb
- rc/*
paths-ignore:
- 'docs/**'
- 'cpp/**'
- 'python/**'
# Enable manually starting builds, and allow forcing updating of SNAPSHOT dependencies.
workflow_dispatch:
inputs:
forceUpdates:
description: "Forces a snapshot update"
required: false
default: 'false'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
MAVEN_OPTS: -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.http.retryHandler.class=standard -Dmaven.wagon.http.retryHandler.count=3
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GE_ACCESS_TOKEN }}

jobs:
unit-test:
strategy:
fail-fast: false
max-parallel: 15
matrix:
java: [ 8, 17, 21 ]
os: [ ubuntu-latest, macos-latest, windows-latest ]
runs-on: ${{ matrix.os }}

steps:

- name: Checkout repository
uses: actions/checkout@v4

- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v4
with:
distribution: corretto
java-version: ${{ matrix.java }}

# Setup caching of the artifacts in the .m2 directory, so they don't have to
# all be downloaded again for every build.
- name: Cache Maven packages
uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2-

# On Windows systems the 'mvnw' script needs an additional ".cmd" appended.
- name: Calculate platform suffix
id: platform_suffix
uses: actions/[email protected]
env:
OS: ${{ matrix.os }}
with:
script: |
const { OS } = process.env
if (OS.includes("windows")) {
core.setOutput('platform_suffix', `.cmd`)
} else {
core.setOutput('platform_suffix', ``)
}
# Run the actual maven build including all tests.
- name: Build and test with Maven
shell: bash
run: |
./mvnw${{ steps.platform_suffix.outputs.platform_suffix }} -P with-java clean verify

0 comments on commit 84fd5fe

Please sign in to comment.