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

🐲 Happy Loooong Year 🐉 #207

Merged
merged 5 commits into from
Feb 16, 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
20 changes: 0 additions & 20 deletions .github/workflows/qodana.yml

This file was deleted.

43 changes: 34 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ on:
- INFO
- WARN
- ERROR
applyQodanaScan:
description: 'apply Qodana Scan?'
default: true
type: boolean
required: false
deployOssrh:
description: 'deploy to ossrh?'
default: true
Expand All @@ -42,6 +47,10 @@ jobs:
release:
name: Release to Sonatype
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
checks: write
env:
MAVEN_OPTS: -Xmx2g
LOG_LEVEL: ${{ inputs.testLoggerLevel || 'INFO' }}
Expand Down Expand Up @@ -73,31 +82,43 @@ jobs:
- name: Maven settings.xml
id: settings
run: |
echo "# env and var" >> "$GITHUB_STEP_SUMMARY"
echo "" >> "$GITHUB_STEP_SUMMARY"
JAVA_HOME=$(asdf where java)
echo "- JAVA_HOME=$JAVA_HOME" >> "$GITHUB_STEP_SUMMARY"
echo "JAVA_HOME=$JAVA_HOME" >> "$GITHUB_OUTPUT"
echo "- GIT_BRANCH=$(git branch --show-current)" >> "$GITHUB_STEP_SUMMARY"
echo "GIT_BRANCH=$(git branch --show-current)" >> "$GITHUB_OUTPUT"

_opt=$(git describe --tags --exact-match 2>/dev/null || true)
if [ "$_opt" != "" ]; then
_opt="-Drevision=$_opt"
echo "MVN_REVISION=$_opt"
echo "- MVN_REVISION=$_opt" >> "$GITHUB_STEP_SUMMARY"
echo "MVN_REVISION=$_opt" >> "$GITHUB_OUTPUT"
fi

_ver=$(mvn --quiet --non-recursive -DforceStdout -Dexpression=project.version $_opt help:evaluate)
echo "WINGS_VERSION=$_ver"
echo "- WINGS_VERSION=$_ver" >> "$GITHUB_STEP_SUMMARY"
echo "WINGS_VERSION=$_ver" >> "$GITHUB_OUTPUT"

_cov=${{ inputs.testCoverReport || github.event_name == 'push' }}
echo "MVN_COVERAGE=$_cov"
echo "- MVN_COVERAGE=$_cov" >> "$GITHUB_STEP_SUMMARY"
echo "MVN_COVERAGE=$_cov" >> "$GITHUB_OUTPUT"

_drh=${{ inputs.deployOssrh || github.event_name == 'release' }}
echo "MVN_DEPLOYRH=$_drh"
echo "- MVN_DEPLOYRH=$_drh" >> "$GITHUB_STEP_SUMMARY"
echo "MVN_DEPLOYRH=$_drh" >> "$GITHUB_OUTPUT"

mvn -v
git --no-pager log --graph -10 --pretty=format:'%H - %ai %d %s'
_qod=${{ inputs.applyQodanaScan || 'false' }}
echo "- QODANA_SCAN=$_qod" >> "$GITHUB_STEP_SUMMARY"
echo "QODANA_SCAN=$_qod" >> "$GITHUB_OUTPUT"

echo "# mvn and git" >> "$GITHUB_STEP_SUMMARY"
echo "" >> "$GITHUB_STEP_SUMMARY"
echo '```text' >> "$GITHUB_STEP_SUMMARY"
mvn -v >> "$GITHUB_STEP_SUMMARY"
git --no-pager log --graph -10 --pretty=format:'%H - %ai %d %s' >> "$GITHUB_STEP_SUMMARY"
echo '```' >> "$GITHUB_STEP_SUMMARY"

mkdir -p ~/.m2
cat > ~/.m2/settings.xml << "EOF"
Expand All @@ -112,16 +133,20 @@ jobs:
</servers>
</settings>
EOF

- name: Qodana Scan
uses: JetBrains/qodana-action@v2023.3
if: steps.settings.outputs.QODANA_SCAN == 'true'
env:
QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }}
## report if not release
- name: Test Coverage ${{ steps.settings.outputs.WINGS_VERSION }} ${{ steps.settings.outputs.GIT_BRANCH }}
if: steps.settings.outputs.MVN_COVERAGE == 'true'
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=$TESTFAILS_IGNORE test
mvn -pl ':devs-coverage' -am jacoco:report-aggregate
mvn -pl ':devs-coverage' -DrepoToken=$COVERALLS_WINGS -DdryRun=$COVERALLS_DRYRUN verify
mvn -P 'coverage' -pl ':devs-coverage' -am jacoco:report-aggregate
mvn -pl ':devs-coverage' -DrepoToken=$COVERALLS_WINGS -DdryRun=$COVERALLS_DRYRUN -Dwings.rootdir=../.. coveralls:report
env:
TZ: Asia/Shanghai
JAVA_HOME: ${{ steps.settings.outputs.JAVA_HOME }}
Expand Down
3 changes: 2 additions & 1 deletion WingsBoot.t.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ Use `t.md` as local [Test Management](https://www.jetbrains.com/help/idea/test-m
* 12127 TestJooqMostSelectSample: paginate jooq sample
* 12128 TestJooqMostSelectSample: paginate jdbc sample
* 12129 TestJooqMostSelectSample: enum mapper sample
* 12130 Tes[WingsBoot.t.md](WingsBoot.t.md)tJooqMostSelectSample: dsl function sample
* 12130 TestJooqMostSelectSample: dsl function sample
* 12131 FlywaveShardingTest: clean and init schema itself
* 12132 FlywaveShardingTest: insert data in the writer
* 12133 FlywaveShardingTest: check sharding on writer and reader
Expand All @@ -184,6 +184,7 @@ Use `t.md` as local [Test Management](https://www.jetbrains.com/help/idea/test-m
* 12145 MockTstNormalTableTest: mock DSLContext to Dao instance
* 12146 WingsEnumConvertersTest: enum converter
* 12147 WingsRevisionTest: module root and path
* 12148 JdbcTemplateHelperTest: safe table

## 13 Slardar

Expand Down
4 changes: 2 additions & 2 deletions observe/scripts/wings-starter.sh
Original file line number Diff line number Diff line change
Expand Up @@ -574,8 +574,8 @@ case "$ARGS_RUN" in
# shellcheck disable=SC2009
mvs=$(ps -o vsz "$cid" | grep -v VSZ | numfmt --grouping)
echo -e "\033[37;42;1mINFO: ps -o rss -o vsz $cid \033[0m"
echo -e "Resident (RSS) = $(printf "%*s" 12 $mrs) Kb"
echo -e "Virtual (VSZ) = $(printf "%*s" 12 $mvs) Kb"
echo -e "Resident (RSS) = $(printf '%*s' 12 $mrs) Kb"
echo -e "Virtual (VSZ) = $(printf '%*s' 12 $mvs) Kb"

if [[ "$USER_RUN" == "$USER" ]]; then
echo -e "\033[37;42;1mINFO: $(which jstat) -gcutil $cid 1000 3 \033[0m"
Expand Down
14 changes: 8 additions & 6 deletions observe/scripts/wings-testing.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,19 +67,21 @@ if [[ "$_ans" != "" ]]; then
_step="$_ans"
fi
# ##############
TZ=Asia/Shanghai
echo "====================="
pwd
echo MAVEN_OPTS=$MAVEN_OPTS
echo LOG_LEVEL=$LOG_LEVEL
echo TEST_VERBOSE=$TEST_VERBOSE
echo COVERALLS_DRYRUN=$COVERALLS_DRYRUN
echo "TZ=$TZ"
echo "MAVEN_OPTS=$MAVEN_OPTS"
echo "LOG_LEVEL=$LOG_LEVEL"
echo "TEST_VERBOSE=$TEST_VERBOSE"
echo "COVERALLS_DRYRUN=$COVERALLS_DRYRUN"
echo "FROM STEP $_step TO RUN"
echo "====================="
set -e
set -x
[[ "$_step" -le "1" ]] && mvn -P '!example,!devs' -Dmaven.test.skip=true clean install
[[ "$_step" -le "2" ]] && mvn -pl ':devs-codegen' -Ddevs-initdb=true clean test
[[ "$_step" -le "3" ]] && mvn -P 'coverage,!example,!devs' test
[[ "$_step" -le "4" ]] && mvn -pl ':devs-coverage' -am jacoco:report-aggregate
[[ "$_step" -le "5" ]] && mvn -pl ':devs-coverage' -DrepoToken=$COVERALLS_WINGS -DdryRun=$COVERALLS_DRYRUN verify
[[ "$_step" -le "4" ]] && mvn -P 'coverage' -pl ':devs-coverage' -am jacoco:report-aggregate
[[ "$_step" -le "5" ]] && mvn -pl ':devs-coverage' -DrepoToken=$COVERALLS_WINGS -DdryRun=$COVERALLS_DRYRUN -Dwings.rootdir=../.. coveralls:report

14 changes: 10 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -694,6 +694,13 @@
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>post-unit-test</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- deploy -->
Expand Down Expand Up @@ -1003,6 +1010,9 @@
<artifactId>jacoco-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>**/database/autogen/**</exclude>
<exclude>**/enums/autogen/**</exclude>
<exclude>**/security/autogen/**</exclude>
<exclude>**/*Const.*</exclude>
<exclude>**/*Const$*</exclude>
<exclude>**/*Attribute.*</exclude>
Expand All @@ -1018,10 +1028,6 @@
</excludes>
</configuration>
</plugin>
<plugin>
<groupId>org.eluder.coveralls</groupId>
<artifactId>coveralls-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>
Expand Down
10 changes: 0 additions & 10 deletions radiant/devs-coverage/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@
<groupId>org.eluder.coveralls</groupId>
<artifactId>coveralls-maven-plugin</artifactId>
<configuration>
<basedir>${wings.rootdir}</basedir>
<relativeReportDirs>
<relativeReportDir>/jacoco</relativeReportDir>
<relativeReportDir>/jacoco-aggregate</relativeReportDir>
Expand Down Expand Up @@ -147,15 +146,6 @@
<directory>${wings.rootdir}/radiant/tiny-task/target/generated-sources/annotations</directory>
</sourceDirectories>
</configuration>
<executions>
<execution>
<id>jacoco-coverage</id>
<phase>verify</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.RandomUtils;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.springframework.boot.autoconfigure.mail.MailProperties;
Expand Down Expand Up @@ -107,8 +106,7 @@ public void singleSend(@NotNull TinyMailMessage message, long maxWait, @Nullable
final MimeMessage mimeMessage = prepareMimeMessage(message, preparer, sender);

if (isDryrun(message)) {
final int slp = RandomUtils.nextInt(10, 2000);
Sleep.ignoreInterrupt(slp);
final long slp = Sleep.ignoreInterrupt(10, 2000);
log.info("single mail dryrun and sleep {} ms", slp);
return;
}
Expand Down Expand Up @@ -186,8 +184,7 @@ public List<BatchResult> batchSend(Collection<? extends TinyMailMessage> message
}

if (dryrunCount > 0) {
final int slp = RandomUtils.nextInt(10, 2000);
Sleep.ignoreInterrupt(slp);
final long slp = Sleep.ignoreInterrupt(10, 2000);
log.info("batch mail dryrun and sleep {} ms", slp);
final long avg = slp / dryrunCount;
for (BatchResult rst : results) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,18 +170,18 @@ public long emit(long id, boolean retry, boolean check) {

@Override
@SuppressWarnings("DuplicatedCode")
public long save(@NotNull TinyMailPlain message) {
final String conf = message.getConf();
public long save(@NotNull TinyMailPlain msg) {
final String conf = msg.getConf();
final TinyMailConfig config = mailConfigProvider.bynamedConfig(conf);
AssertArgs.notNull(config, "mail conf={} not found", conf);

final WinMailSender po = new WinMailSender();
final boolean isNew = message.getId() == null || message.getId() <= 0;
final boolean isNew = msg.getId() == null || msg.getId() <= 0;
final long id;
final RunMode rm = RuntimeMode.getRunMode();
final String crm = rm == RunMode.Nothing ? "" : rm.name().toLowerCase();

final LocalDateTime md = message.getDate();
final LocalDateTime md = msg.getDate();
if (isNew) {
id = lightIdService.getId(winMailSenderDao.getTable());
// Optimist Lock
Expand All @@ -193,32 +193,32 @@ public long save(@NotNull TinyMailPlain message) {
po.setSumDone(0);
}
else {
id = message.getId();
Null.notNull(message.getNextSend(), po::setNextSend);
id = msg.getId();
Null.notNull(msg.getNextSend(), po::setNextSend);
}

po.setId(id);
po.setMailApps(toString(message.getApps(), appName));
po.setMailRuns(toString(message.getRuns(), crm));
po.setMailConf(message.getConf());
po.setMailFrom(toString(message.getFrom(), config.getFrom()));
po.setMailTo(toString(message.getTo(), config.getTo()));
po.setMailCc(toString(message.getCc(), config.getCc()));
po.setMailBcc(toString(message.getBcc(), config.getBcc()));
po.setMailReply(toString(message.getReply(), config.getReply()));
po.setMailSubj(message.getSubject());
po.setMailText(message.getContent());
po.setMailHtml(BoxedCastUtil.orElse(message.getHtml(), config.getHtml()));
po.setMailFile(toStringMap(message.getAttachment()));
po.setMailMark(message.getMark());
po.setMailApps(toString(msg.getApps(), appName));
po.setMailRuns(toString(msg.getRuns(), crm));
po.setMailConf(msg.getConf());
po.setMailFrom(toString(msg.getFrom(), config.getFrom()));
po.setMailTo(toString(msg.getTo(), config.getTo()));
po.setMailCc(toString(msg.getCc(), config.getCc()));
po.setMailBcc(toString(msg.getBcc(), config.getBcc()));
po.setMailReply(toString(msg.getReply(), config.getReply()));
po.setMailSubj(msg.getSubject());
po.setMailText(msg.getContent());
po.setMailHtml(BoxedCastUtil.orElse(msg.getHtml(), config.getHtml()));
po.setMailFile(toStringMap(msg.getAttachment()));
po.setMailMark(msg.getMark());
po.setMailDate(md);

Null.notNull(message.getMaxFail(), po::setMaxFail);
Null.notNull(message.getMaxDone(), po::setMaxDone);
Null.notNull(msg.getMaxFail(), po::setMaxFail);
Null.notNull(msg.getMaxDone(), po::setMaxDone);

Null.notNull(message.getRefType(), po::setRefType);
Null.notNull(message.getRefKey1(), po::setRefKey1);
Null.notNull(message.getRefKey2(), po::setRefKey2);
Null.notNull(msg.getRefType(), po::setRefType);
Null.notNull(msg.getRefKey1(), po::setRefKey1);
Null.notNull(msg.getRefKey2(), po::setRefKey2);

// try to check message format
final TinyMailMessage tms = makeMailMessage(config, po, null);
Expand Down
Loading