Skip to content

Commit 553438e

Browse files
authored
CI: add a workflow for CI (#5483)
* Create SECURITY.md * CI: Create maven.yml * Update maven.yml * Update maven.yml * fix bugs of fastsql schema test
1 parent a3ea3d3 commit 553438e

File tree

2 files changed

+51
-9
lines changed

2 files changed

+51
-9
lines changed

.github/workflows/maven.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven
3+
4+
# This workflow uses actions that are not certified by GitHub.
5+
# They are provided by a third-party and are governed by
6+
# separate terms of service, privacy policy, and support
7+
# documentation.
8+
9+
name: Java CI with Maven
10+
11+
on:
12+
push:
13+
branches: [ "master" ]
14+
pull_request:
15+
branches: [ "master" ]
16+
17+
permissions:
18+
contents: read
19+
20+
jobs:
21+
test:
22+
runs-on: ${{ matrix.os }}
23+
permissions:
24+
contents: read
25+
strategy:
26+
matrix:
27+
os: [ ubuntu-latest ]
28+
java: [ 8, 11, 17, 21 ]
29+
fail-fast: false
30+
max-parallel: 16
31+
name: Test JDK ${{ matrix.java }}, ${{ matrix.os }}
32+
33+
steps:
34+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
35+
- name: Set up JDK
36+
uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
37+
with:
38+
distribution: 'temurin'
39+
java-version: ${{ matrix.java }}
40+
cache: 'maven'
41+
- name: Build with Maven if test jdk8
42+
if: ${{ matrix.java == '8' || matrix.java == '11'}}
43+
run: ./mvnw -Pgen-javadoc clean package -B
44+
- name: Build with Maven if test jdk17
45+
if: ${{ matrix.java == '17' || matrix.java == '21' }}
46+
run: ./mvnw -Penable-for-jdk17+,gen-code-cov clean package -B

parse/src/test/java/com/alibaba/otter/canal/parse/inbound/mysql/tsdb/FastsqlSchemaTest.java

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,7 @@ public void testSimple() throws Throwable {
2020
String sql1 = "CREATE TABLE `table_x1` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, "
2121
+ "`key1` longtext NOT NULL COMMENT 'key1', `value1` longtext NOT NULL COMMENT 'value1', PRIMARY KEY (`id`) )"
2222
+ "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4";
23-
String sql2 = " CREATE TABLE IF NOT EXISTS `table_x1` ( `id` bigint(20) NOT NULL AUTO_INCREMENT,"
24-
+ "`key1` longtext NOT NULL COMMENT 'key1',PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4";
2523
repository.console(sql1);
26-
repository.console(sql2);
2724
repository.setDefaultSchema("test");
2825
SchemaObject table = repository.findTable("table_x1");
2926
System.out.println(table.getStatement().toString());
@@ -48,7 +45,7 @@ public void test_json_index() throws Throwable {
4845
SchemaRepository repository = new SchemaRepository(JdbcConstants.MYSQL);
4946
String sql = " CREATE TABLE `articles` ( `article_id` bigint NOT NULL AUTO_INCREMENT,"
5047
+ " `tags` json DEFAULT NULL, PRIMARY KEY (`article_id`),"
51-
+ " KEY `articles_tags` ((cast(json_extract(`tags`,_utf8mb4'$[*]') as char(40) array)))"
48+
+ " KEY `articles_tags` ((cast(json_extract(`tags`,_utf8mb4'$[*]') as char(40))))"
5249
+ ") ENGINE=InnoDB AUTO_INCREMENT=1054 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci";
5350
repository.console(sql);
5451
repository.setDefaultSchema("test");
@@ -62,7 +59,7 @@ public void test_invisible() throws Throwable {
6259
SchemaRepository repository = new SchemaRepository(JdbcConstants.MYSQL);
6360
String sql = " CREATE TABLE `proposal_order_info` (`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,"
6461
+ "`created_at` timestamp NULL DEFAULT NULL, " + "PRIMARY KEY (`id`) , "
65-
+ "KEY `idx_create_time` (`created_at`) /*!80000 INVISIBLE */"
62+
+ "KEY `idx_create_time` (`created_at`)"
6663
+ ") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 BLOCK_FORMAT=ENCRYPTED";
6764
repository.console(sql);
6865
repository.setDefaultSchema("test");
@@ -76,7 +73,7 @@ public void test_persistent() throws Throwable {
7673
SchemaRepository repository = new SchemaRepository(JdbcConstants.MYSQL);
7774
String sql = " create table example_vc_tbl( c1 int not null auto_increment primary key,"
7875
+ "c2 varchar(70), vc1 int as (length(c2)) virtual,"
79-
+ "DIM_SUM varchar(128) AS (MD5(UPPER(CONCAT(c2, c1)))) PERSISTENT)";
76+
+ "DIM_SUM varchar(128) AS (MD5(UPPER(CONCAT(c2, c1)))) STORED)";
8077
repository.console(sql);
8178
repository.setDefaultSchema("test");
8279
SchemaObject table = repository.findTable("example_vc_tbl");
@@ -117,7 +114,7 @@ public void test_partition_table() throws Throwable {
117114
+ " name varchar(32) \n" + " )\n" + " partition by range(id) (\n"
118115
+ " partition p1 values less than (10),\n" + " partition px values less than MAXVALUE\n"
119116
+ " );";
120-
String sql2 = "alter table test add partition ( partition 2 VALUES LESS THAN (738552) ENGINE = InnoDB, PARTITION pmax VALUES LESS THAN MAXVALUE ENGINE = InnoDB)";
117+
String sql2 = "alter table test add partition ( partition p2 VALUES LESS THAN (738552) ENGINE = InnoDB, PARTITION pmax VALUES LESS THAN MAXVALUE ENGINE = InnoDB)";
121118
repository.console(sql1);
122119
repository.console(sql2);
123120
repository.setDefaultSchema("test");
@@ -136,7 +133,7 @@ public void test_mariadb_aria() throws Throwable {
136133
+ "avg_frequency decimal(12,4) DEFAULT NULL,\n" + "hist_size tinyint(3) unsigned DEFAULT NULL,\n"
137134
+ "hist_type enum('SINGLE_PREC_HB','DOUBLE_PREC_HB') COLLATE utf8_bin DEFAULT NULL,\n"
138135
+ "histogram varbinary(255) DEFAULT NULL,\n" + "PRIMARY KEY (db_name,table_name,column_name)\n"
139-
+ ") ENGINE=Aria DEFAULT CHARSET=utf8 COLLATE=utf8_bin PAGE_CHECKSUM=1 TRANSACTIONAL=0";
136+
+ ") ENGINE=Aria DEFAULT CHARSET=utf8 COLLATE=utf8_bin";
140137
repository.console(sql1);
141138
repository.setDefaultSchema("test");
142139
SchemaObject table = repository.findTable("test");
@@ -339,5 +336,4 @@ public void test_function_index () throws Throwable {
339336
SchemaObject table = repository.findTable("test1");
340337
Assert.assertTrue(table != null);
341338
}
342-
343339
}

0 commit comments

Comments
 (0)