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

update docker and xsd #201

Merged
merged 3 commits into from
Feb 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ on:
default: false
type: boolean
required: false
testVerifyDryRun:
description: 'dryrun coverage report?'
default: false
type: boolean
required: false
testLoggerLevel:
description: 'test logger level'
default: INFO
Expand Down Expand Up @@ -114,13 +119,15 @@ jobs:
run: |
mvn -P '!example,!devs' -Dmaven.test.skip=true clean install
mvn -pl ':devs-codegen' -Ddevs-initdb=true clean test
mvn -P 'coverage,!example,!devs' -Dmaven.test.failure.ignore=${{ inputs.testFailureIgnore }} test
mvn -P 'coverage,!example,!devs' -Dmaven.test.failure.ignore=$TESTFAILS_IGNORE test
mvn -pl ':devs-coverage' -am jacoco:report-aggregate
mvn -pl ':devs-coverage' -DrepoToken=$COVERALLS_WINGS verify
mvn -pl ':devs-coverage' -DrepoToken=$COVERALLS_WINGS -DdryRun=$COVERALLS_DRYRUN verify
env:
TZ: Asia/Shanghai
JAVA_HOME: ${{ steps.settings.outputs.JAVA_HOME }}
COVERALLS_WINGS: ${{ secrets.COVERALLS_REPO_TOKEN }}
COVERALLS_DRYRUN: ${{ inputs.testVerifyDryRun || 'false' }}
TESTFAILS_IGNORE: ${{ inputs.testFailureIgnore || 'false' }}

## import gpp private key
- name: Import GPG key
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,9 @@ private static String replaceDate999(String text) {
final String ymd1 = now.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
final String ymd2 = now.format(DateTimeFormatter.ofPattern("yyyy_MMdd"));
final String ymh = now.format(DateTimeFormatter.ofPattern("yyyy_MMdd_HHmm"));
return text.replace("9999-99-99", ymd1)
.replace("9999_9999_01L", ymd2 + "_01L")
.replace("9999_9999_9999L", ymh + "_01L")
return text.replace("2022-02-22", ymd1)
.replace("2022_0222_01L", ymd2 + "_01L")
.replace("2022_0222_2222L", ymh + "_01L")
;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ class Devops1SchemaManagerTest {
void initSchema() {
final Warlock1SchemaManager manager = new Warlock1SchemaManager(schemaRevisionManager);
// manager.init(WingsRevision.V04_20_1024_02_RolePermit.revision(),
manager.mergePublish(9999_9999_01L,
manager.mergePublish(2022_0222_01L,
includeWarlockPath(),
Helper::master
);
}

@Test
void resetSchema() {
long revi = 9999_9999_01L;
long revi = 2022_0222_01L;
final Warlock1SchemaManager manager = new Warlock1SchemaManager(schemaRevisionManager);
final Helper helper = FlywaveRevisionScanner.helper();
includeWarlockPath().accept(helper);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public void journal() {
schemaJournalManager.askWay(FlywaveInteractiveGui.askGui());
schemaJournalManager.logWay(FlywaveInteractiveGui.logGui());

long commitId = 9999_9999_9999L;
long commitId = 2022_0222_2222L;
boolean enable = true;
boolean manage = true;
List<String> tables = Arrays.asList(
Expand Down
10 changes: 8 additions & 2 deletions observe/docker/mysql/conf/wings.cnf
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
[mysqld]
authentication_policy = caching_sha2_password
max_allowed_packet = 16777216
max_connections = 4096
## table store lowercase compare case-sensitive
lower_case_table_names = 1
## FULLTEXT indexes by MeCab parser and ngram parser
innodb_ft_min_token_size = 2
ft_min_word_len = 2
ngram_token_size = 2
## default charset and timezone
character-set-server = UTF8MB4
default-time-zone = '+8:00'
default-time-zone = +08:00
log_bin_trust_function_creators = 1
innodb_file_per_table = 1
## local
innodb_file_per_table = 1
innodb_strict_mode = 0
#skip_grant_tables
1 change: 1 addition & 0 deletions observe/docker/mysql/init/2-data.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
CREATE DATABASE IF NOT EXISTS wings DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
CREATE DATABASE IF NOT EXISTS wings_example DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
CREATE DATABASE IF NOT EXISTS wings_faceless DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
CREATE DATABASE IF NOT EXISTS wings_shard_0 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
CREATE DATABASE IF NOT EXISTS wings_shard_1 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
Expand Down
2 changes: 1 addition & 1 deletion observe/meepo
Submodule meepo updated 0 files
2 changes: 1 addition & 1 deletion observe/mirana
Submodule mirana updated 0 files
24 changes: 17 additions & 7 deletions observe/scripts/wings-docker.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#!/bin/bash
THIS_VERSION=2022-01-22
THIS_VERSION=2024-02-03

TEMP_DIR="../../example/winx-devops/target" # To avoid copy, recommend the same partition on the hard disk.
BOOT_JAR="../../example/winx-devops/target/winx-devops-*-SNAPSHOT.jar"
BOOT_ENV="./wings-starter.env"
BOOT_BSH="./wings-starter.sh"

DOCK_DIR="/opt/"
DOCK_TAG="wings/winx-devops"
DOCK_DIR="/opt"

####
function show_help() {
Expand Down Expand Up @@ -52,7 +52,8 @@ function link_file() {
cnt=$(find "$frm" -name "$tkn" | wc -l)
if [[ $cnt -ne 1 ]]; then
find "$frm" -name "$tkn"
echo -e "\033[37;41;1mERROR: found $cnt file, $lnk_it \033[0m should clean"
echo -e "\033[37;41;1mERROR: found $cnt file, $lnk_it \033[0m"
echo -e "must existed 1 file, e.g. mvn clean package"
exit
fi
arg=$(find "$frm" -name "$tkn")
Expand Down Expand Up @@ -90,18 +91,26 @@ echo "temp-dir=$tmp_dir"
echo -e "\033[37;42;1m ==== Dockerfile ==== \033[0m"

tee Dockerfile <<EOF
FROM openjdk:11-jdk
FROM eclipse-temurin:21

EXPOSE 80

VOLUME /data
VOLUME /tmp
## external config dir to put env and config
VOLUME /wings
##
ENV BOOT_ENVF=/wings/application.env
ENV JAVA_OPTS=''
ENV BOOT_OPTS=''
ENV SPRING_APPLICATION_JSON='{}'

COPY ./* $DOCK_DIR
RUN chmod +x $DOCK_DIR/*.sh

WORKDIR $DOCK_DIR
# need bash to run
ENTRYPOINT ["/opt/wings-starter.sh", "docker"]
## need bash to run
ENTRYPOINT ["$DOCK_DIR/wings-starter.sh", "docker"]
EOF

ls -al
Expand All @@ -116,5 +125,6 @@ cat <<EOF
(cd "$tmp_dir" && docker build -t "$DOCK_TAG" .)
docker run -it --rm $DOCK_TAG
docker run -it --rm --entrypoint /bin/sh $DOCK_TAG
# use help as param1 to see help
## use help as param1 to see help
## map
EOF
32 changes: 24 additions & 8 deletions observe/scripts/wings-starter.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
#!/bin/bash
THIS_VERSION=2023-10-18
THIS_VERSION=2024-02-03
################ system env to use ################
# JAVA_HOME # if JDK_HOME is not valid
# JAVA_OPTS # prepend to java args
# BOOT_OPTS # prepend to spring-boot args
# BOOT_ENVF='' # `*.env` file, load after env-link and env-file
# TZ # java default timezone
# SPRING_APPLICATION_JSON # springboot default json properties
################ modify the following params ################
WORK_DIR='' # directory of script-generated files and logs. default empty (script location)
TAIL_LOG='log' # the log to tail, (log|out|new|ask)
Expand Down Expand Up @@ -74,7 +81,6 @@ BOOT_DTM=$(date '+%y%m%d%H%M%S') # datetime of boot
BOOT_TKN='' # boot token, Composed of jar+dtm
BOOT_MD5='' # execute md5+jar in safe mode
JAR_NAME='' # basename of boot-jar
JAVA_OPT='' # real args of java
#
function print_envs() {
echo -e "#################################################"
Expand All @@ -89,6 +95,8 @@ function print_envs() {
echo "work-dir=$WORK_DIR"
echo "env-link=$link_envs"
echo "env-file=$this_envs"
# shellcheck disable=SC2153
echo "env-boot=$BOOT_ENVF"
echo "grep-key='$grep_key'"
}

Expand Down Expand Up @@ -166,9 +174,8 @@ function check_java() {
JAVA_OPT="$JAVA_OPT -Duser.timezone=$TIME_ZID"
fi

if [[ "$JAVA_EXT" != "" ]]; then
JAVA_OPT="$JAVA_OPT $JAVA_EXT"
fi
# shellcheck disable=SC2153
JAVA_OPT="$JAVA_OPTS $JAVA_OPT $JAVA_EXT"
}

function check_boot() {
Expand Down Expand Up @@ -222,18 +229,27 @@ if [[ -L "$this_file" ]]; then
link_file=$(realpath "$this_file")
link_envs=${link_file%.*}.env
if [[ -f "$link_envs" ]]; then
echo -e "\033[37;42;1mINFO: load link-envs form $link_envs ==== \033[0m"
# shellcheck disable=SC1090
source "$link_envs"
fi
fi

this_envs=${this_file%.*}.env
if [[ -f "$this_envs" ]]; then
echo -e "\033[37;42;1mINFO: load this-envs form $this_envs ==== \033[0m"
# shellcheck disable=SC1090
source "$this_envs"
else
echo -e "\033[31mWARN: no env file found. $this_envs \033[0m"
fi

if [[ -f "$BOOT_ENVF" ]]; then
echo -e "\033[37;42;1mINFO: load boot-envs form $BOOT_ENVF ==== \033[0m"
# shellcheck disable=SC1090
source "$BOOT_ENVF"
fi

# change workdir
if [[ "$WORK_DIR" == "" ]]; then
WORK_DIR=$(dirname "$this_file")
Expand Down Expand Up @@ -376,9 +392,9 @@ fi
if [[ "$BOOT_LOG" != "" ]]; then
BOOT_ARG="--logging.file.name=$BOOT_LOG $BOOT_ARG"
fi
if [[ "$BOOT_EXT" != "" ]]; then
BOOT_ARG="$BOOT_ARG $BOOT_EXT"
fi

# shellcheck disable=SC2153
BOOT_ARG="$BOOT_OPTS $BOOT_ARG $BOOT_EXT"

# check ps
grep_key=" -jar ${BOOT_JAR}[ _-]"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package pro.fessional.wings.devs.init;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.EnabledIfSystemProperty;
import org.springframework.boot.test.context.SpringBootTest;

import static pro.fessional.wings.faceless.flywave.WingsRevision.V00_19_0512_01_Schema;
import static pro.fessional.wings.faceless.flywave.WingsRevision.V01_19_0520_01_IdLog;
import static pro.fessional.wings.faceless.flywave.WingsRevision.V01_19_0521_01_EnumI18n;
import static pro.fessional.wings.faceless.flywave.WingsRevision.V03_20_1023_01_AuthEnum;
import static pro.fessional.wings.faceless.flywave.WingsRevision.V04_20_1024_01_UserLogin;
import static pro.fessional.wings.faceless.flywave.WingsRevision.V04_20_1024_02_RolePermit;
import static pro.fessional.wings.faceless.flywave.WingsRevision.V05_20_1025_01_ConfRuntime;
import static pro.fessional.wings.faceless.flywave.WingsRevision.V91_22_0222_01_ExampleInit;


/**
* @author trydofor
* @since 2021-02-22
*/
@SpringBootTest(properties = "testing.dbname=wings_example")
@EnabledIfSystemProperty(named = "devs-initdb", matches = "true")
public class DatabaseExampleTest extends TestingDatabase {
@Test
void resetSchemaWings() {
reset(
V00_19_0512_01_Schema,
V01_19_0520_01_IdLog,
V01_19_0521_01_EnumI18n,
V03_20_1023_01_AuthEnum,
V04_20_1024_01_UserLogin,
V04_20_1024_02_RolePermit,
V05_20_1025_01_ConfRuntime,
V91_22_0222_01_ExampleInit
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

import static pro.fessional.wings.faceless.flywave.WingsRevision.V00_19_0512_01_Schema;
import static pro.fessional.wings.faceless.flywave.WingsRevision.V01_19_0520_01_IdLog;
import static pro.fessional.wings.faceless.flywave.WingsRevision.V90_19_0601_01_TestSchema;
import static pro.fessional.wings.faceless.flywave.WingsRevision.V90_19_0601_02_TestRecord;
import static pro.fessional.wings.faceless.flywave.WingsRevision.V90_22_0601_01_TestSchema;
import static pro.fessional.wings.faceless.flywave.WingsRevision.V90_22_0601_02_TestRecord;


/**
Expand All @@ -27,8 +27,8 @@ void resetSchemaWingsFaceless() {
reset(
V00_19_0512_01_Schema,
V01_19_0520_01_IdLog,
V90_19_0601_01_TestSchema,
V90_19_0601_02_TestRecord
V90_22_0601_01_TestSchema,
V90_22_0601_02_TestRecord
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

import static pro.fessional.wings.faceless.flywave.WingsRevision.V00_19_0512_01_Schema;
import static pro.fessional.wings.faceless.flywave.WingsRevision.V01_19_0520_01_IdLog;
import static pro.fessional.wings.faceless.flywave.WingsRevision.V90_19_0601_01_TestSchema;
import static pro.fessional.wings.faceless.flywave.WingsRevision.V90_19_0601_02_TestRecord;
import static pro.fessional.wings.faceless.flywave.WingsRevision.V90_22_0601_01_TestSchema;
import static pro.fessional.wings.faceless.flywave.WingsRevision.V90_22_0601_02_TestRecord;


/**
Expand All @@ -27,8 +27,8 @@ void resetSchemaWingsShard0() {
reset(
V00_19_0512_01_Schema,
V01_19_0520_01_IdLog,
V90_19_0601_01_TestSchema,
V90_19_0601_02_TestRecord
V90_22_0601_01_TestSchema,
V90_22_0601_02_TestRecord
);

shard("tst_sharding", 5);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

import static pro.fessional.wings.faceless.flywave.WingsRevision.V00_19_0512_01_Schema;
import static pro.fessional.wings.faceless.flywave.WingsRevision.V01_19_0520_01_IdLog;
import static pro.fessional.wings.faceless.flywave.WingsRevision.V90_19_0601_01_TestSchema;
import static pro.fessional.wings.faceless.flywave.WingsRevision.V90_19_0601_02_TestRecord;
import static pro.fessional.wings.faceless.flywave.WingsRevision.V90_22_0601_01_TestSchema;
import static pro.fessional.wings.faceless.flywave.WingsRevision.V90_22_0601_02_TestRecord;


/**
Expand All @@ -25,8 +25,8 @@ void resetSchemaWingsShard1() {
reset(
V00_19_0512_01_Schema,
V01_19_0520_01_IdLog,
V90_19_0601_01_TestSchema,
V90_19_0601_02_TestRecord
V90_22_0601_01_TestSchema,
V90_22_0601_02_TestRecord
);

shard("tst_sharding", 5);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* @author trydofor
* @since 2021-02-22
*/
@SpringBootTest
@SpringBootTest(properties = "testing.dbname=wings")
@EnabledIfSystemProperty(named = "devs-initdb", matches = "true")
public class DatabaseWingsTest extends TestingDatabase {
@Test
Expand Down
Loading