Skip to content

Commit

Permalink
Init nativeTest by GraalVM CE in CI (#560)
Browse files Browse the repository at this point in the history
  • Loading branch information
linghengqian authored Sep 5, 2023
1 parent 08e2f0a commit 2aed8df
Show file tree
Hide file tree
Showing 36 changed files with 842 additions and 61 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,28 @@ env:
MAVEN_OPTS: -Dhttps.protocols=TLSv1.2 -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN -Dorg.slf4j.simpleLogger.showDateTime=true -Djava.awt.headless=true

jobs:
# TODO
test-graalvm-ce-ci:
name: NativeTest CI - GraalVM CE ${{ matrix.java-version }} on ${{ matrix.os }} (This CI failure is reasonable)
runs-on: ${{ matrix.os }}
timeout-minutes: 90
continue-on-error: true
strategy:
matrix:
os: [ ubuntu-latest ]
java-version: [ '17.0.8' ]
steps:
- uses: actions/checkout@v3
- uses: graalvm/setup-graalvm@v1
with:
java-version: ${{ matrix.java-version }}
distribution: 'graalvm-community'
github-token: ${{ secrets.GITHUB_TOKEN }}
cache: 'maven'
- name: Build Spring Boot Starter 3 test with Maven
run: |
./mvnw -T1C -B -PgenerateMetadata -DskipNativeTests clean test
# ./mvnw -am -pl dynamic-datasource-spring-boot3-starter -PnativeTestInSpringBoot clean test
test-maximum-jdk-ci:
name: Test CI - JDK ${{ matrix.java-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.baomidou.dynamic.datasource.fixture;
package com.baomidou.dynamic.datasource.fixture.v1;

import com.baomidou.dynamic.datasource.DynamicRoutingDataSource;
import com.baomidou.dynamic.datasource.creator.DataSourceProperty;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.baomidou.dynamic.datasource.fixture;
package com.baomidou.dynamic.datasource.fixture.v1;

import com.baomidou.dynamic.datasource.DynamicRoutingDataSource;
import com.baomidou.dynamic.datasource.creator.DataSourceProperty;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.baomidou.dynamic.datasource.fixture;
package com.baomidou.dynamic.datasource.fixture.v1;

import com.baomidou.dynamic.datasource.DynamicRoutingDataSource;
import com.baomidou.dynamic.datasource.creator.DataSourceProperty;
import com.baomidou.dynamic.datasource.creator.DefaultDataSourceCreator;
import com.baomidou.dynamic.datasource.fixture.service.nest.SchoolService;
import com.baomidou.dynamic.datasource.fixture.service.nest.Student;
import com.baomidou.dynamic.datasource.fixture.service.nest.StudentService;
import com.baomidou.dynamic.datasource.fixture.service.nest.TeacherService;
import com.baomidou.dynamic.datasource.fixture.v1.service.nest.SchoolService;
import com.baomidou.dynamic.datasource.fixture.v1.service.nest.Student;
import com.baomidou.dynamic.datasource.fixture.v1.service.nest.StudentService;
import com.baomidou.dynamic.datasource.fixture.v1.service.nest.TeacherService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.baomidou.dynamic.datasource.fixture;
package com.baomidou.dynamic.datasource.fixture.v1;

import com.baomidou.dynamic.datasource.DynamicRoutingDataSource;
import com.baomidou.dynamic.datasource.creator.DataSourceProperty;
import com.baomidou.dynamic.datasource.creator.DefaultDataSourceCreator;
import com.baomidou.dynamic.datasource.fixture.service.spel.CustomResultHandler;
import com.baomidou.dynamic.datasource.fixture.service.spel.User;
import com.baomidou.dynamic.datasource.fixture.service.spel.UserService;
import com.baomidou.dynamic.datasource.fixture.v1.service.spel.CustomResultHandler;
import com.baomidou.dynamic.datasource.fixture.v1.service.spel.User;
import com.baomidou.dynamic.datasource.fixture.v1.service.spel.UserService;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.baomidou.dynamic.datasource.fixture.controller;
package com.baomidou.dynamic.datasource.fixture.v1.controller;

import com.baomidou.dynamic.datasource.fixture.service.spel.User;
import com.baomidou.dynamic.datasource.fixture.service.spel.UserService;
import com.baomidou.dynamic.datasource.fixture.v1.service.spel.User;
import com.baomidou.dynamic.datasource.fixture.v1.service.spel.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.baomidou.dynamic.datasource.fixture.service.nest;
package com.baomidou.dynamic.datasource.fixture.v1.service.nest;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class SchoolService {

private final TeacherService teacherService;
private final StudentService studentService;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.baomidou.dynamic.datasource.fixture.service.nest;
package com.baomidou.dynamic.datasource.fixture.v1.service.nest;

import lombok.AllArgsConstructor;
import lombok.Data;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.baomidou.dynamic.datasource.fixture.service.nest;
package com.baomidou.dynamic.datasource.fixture.v1.service.nest;

import com.baomidou.dynamic.datasource.annotation.DS;
import org.springframework.stereotype.Service;
Expand All @@ -32,7 +32,6 @@
@Service
@DS("student")
public class StudentService {

private final DataSource dataSource;

public StudentService(DataSource dataSource) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.baomidou.dynamic.datasource.fixture.service.nest;
package com.baomidou.dynamic.datasource.fixture.v1.service.nest;

import lombok.AllArgsConstructor;
import lombok.Data;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.baomidou.dynamic.datasource.fixture.service.nest;
package com.baomidou.dynamic.datasource.fixture.v1.service.nest;

import com.baomidou.dynamic.datasource.annotation.DS;
import org.springframework.stereotype.Service;
Expand All @@ -32,7 +32,6 @@
@Service
@DS("teacher")
public class TeacherService {

private final DataSource dataSource;

public TeacherService(DataSource dataSource) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.baomidou.dynamic.datasource.fixture.service.spel;
package com.baomidou.dynamic.datasource.fixture.v1.service.spel;

import org.springframework.test.web.servlet.MvcResult;
import org.springframework.test.web.servlet.ResultHandler;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.baomidou.dynamic.datasource.fixture.service.spel;
package com.baomidou.dynamic.datasource.fixture.v1.service.spel;

import lombok.AllArgsConstructor;
import lombok.Data;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.baomidou.dynamic.datasource.fixture.service.spel;
package com.baomidou.dynamic.datasource.fixture.v1.service.spel;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
Expand Down
4 changes: 1 addition & 3 deletions dynamic-datasource-spring-boot3-starter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
https://github.com/baomidou/dynamic-datasource-spring-boot-starter/tree/master/dynamic-datasource-spring-boot3-starter
</url>


<properties>
<java.version>17</java.version>
<spring-boot-dependencies.version>3.1.1</spring-boot-dependencies.version>
Expand Down Expand Up @@ -51,5 +50,4 @@
<scope>test</scope>
</dependency>
</dependencies>

</project>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.baomidou.dynamic.datasource.fixture;
package com.baomidou.dynamic.datasource.fixture.v3;

import com.baomidou.dynamic.datasource.DynamicRoutingDataSource;
import com.baomidou.dynamic.datasource.creator.DataSourceProperty;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.baomidou.dynamic.datasource.fixture;
package com.baomidou.dynamic.datasource.fixture.v3;

import com.baomidou.dynamic.datasource.DynamicRoutingDataSource;
import com.baomidou.dynamic.datasource.creator.DataSourceProperty;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.baomidou.dynamic.datasource.fixture;
package com.baomidou.dynamic.datasource.fixture.v3;

import com.baomidou.dynamic.datasource.DynamicRoutingDataSource;
import com.baomidou.dynamic.datasource.creator.DataSourceProperty;
import com.baomidou.dynamic.datasource.creator.DefaultDataSourceCreator;
import com.baomidou.dynamic.datasource.fixture.service.nest.SchoolService;
import com.baomidou.dynamic.datasource.fixture.service.nest.Student;
import com.baomidou.dynamic.datasource.fixture.service.nest.StudentService;
import com.baomidou.dynamic.datasource.fixture.service.nest.TeacherService;
import com.baomidou.dynamic.datasource.fixture.v3.service.nest.SchoolService;
import com.baomidou.dynamic.datasource.fixture.v3.service.nest.Student;
import com.baomidou.dynamic.datasource.fixture.v3.service.nest.StudentService;
import com.baomidou.dynamic.datasource.fixture.v3.service.nest.TeacherService;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.baomidou.dynamic.datasource.fixture;
package com.baomidou.dynamic.datasource.fixture.v3;

import com.baomidou.dynamic.datasource.DynamicRoutingDataSource;
import com.baomidou.dynamic.datasource.creator.DataSourceProperty;
import com.baomidou.dynamic.datasource.creator.DefaultDataSourceCreator;
import com.baomidou.dynamic.datasource.fixture.service.spel.User;
import com.baomidou.dynamic.datasource.fixture.service.spel.UserService;
import com.baomidou.dynamic.datasource.fixture.v3.service.spel.User;
import com.baomidou.dynamic.datasource.fixture.v3.service.spel.UserService;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledInNativeImage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
Expand All @@ -42,7 +43,11 @@
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import static org.springframework.test.web.servlet.setup.MockMvcBuilders.webAppContextSetup;

/**
* TODO It looks like SPEL is not available under the test with GraalVM Tracing Agent.
*/
@SpringBootTest(classes = SPELApplication.class, webEnvironment = RANDOM_PORT)
@DisabledInNativeImage
public class SPELTest {

MockMvc mockMvc;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.baomidou.dynamic.datasource.fixture.controller;
package com.baomidou.dynamic.datasource.fixture.v3.controller;

import com.baomidou.dynamic.datasource.fixture.service.spel.User;
import com.baomidou.dynamic.datasource.fixture.service.spel.UserService;
import com.baomidou.dynamic.datasource.fixture.v3.service.spel.User;
import com.baomidou.dynamic.datasource.fixture.v3.service.spel.UserService;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.baomidou.dynamic.datasource.fixture.service.nest;
package com.baomidou.dynamic.datasource.fixture.v3.service.nest;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class SchoolService {

private final TeacherService teacherService;
private final StudentService studentService;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.baomidou.dynamic.datasource.fixture.service.nest;
package com.baomidou.dynamic.datasource.fixture.v3.service.nest;

public record Student(Integer id, String name, Integer age) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.baomidou.dynamic.datasource.fixture.service.nest;
package com.baomidou.dynamic.datasource.fixture.v3.service.nest;

import com.baomidou.dynamic.datasource.annotation.DS;
import org.springframework.stereotype.Service;
Expand All @@ -32,6 +32,7 @@
@Service
@DS("student")
public class StudentService {

private final DataSource dataSource;

public StudentService(DataSource dataSource) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.baomidou.dynamic.datasource.fixture.service.nest;
package com.baomidou.dynamic.datasource.fixture.v3.service.nest;

public record Teacher(Integer id, String name, Integer age) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.baomidou.dynamic.datasource.fixture.service.nest;
package com.baomidou.dynamic.datasource.fixture.v3.service.nest;

import com.baomidou.dynamic.datasource.annotation.DS;
import org.springframework.stereotype.Service;
Expand All @@ -32,6 +32,7 @@
@Service
@DS("teacher")
public class TeacherService {

private final DataSource dataSource;

public TeacherService(DataSource dataSource) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.baomidou.dynamic.datasource.fixture.service.spel;
package com.baomidou.dynamic.datasource.fixture.v3.service.spel;

public record User(Integer id, String name, Integer age, String tenantName) {
public User(String tenantName) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.baomidou.dynamic.datasource.fixture.service.spel;
package com.baomidou.dynamic.datasource.fixture.v3.service.spel;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[
{
"type":"agent-extracted",
"classes":[
]
}
]

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[
]
Loading

0 comments on commit 2aed8df

Please sign in to comment.