From 4d5eabdf5aeb8d381c519a92f086b868d2fc54fb Mon Sep 17 00:00:00 2001 From: trydofor Date: Mon, 29 Jan 2024 14:30:38 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=92=9A=20manual=20and=20auto-release?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ac8b4c1..7697c89 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,5 +1,5 @@ name: Release-To-OssRh -run-name: Deploy ${{github.event.release.tag_name}} to Sonatype by @${{ github.actor }} +run-name: Release ${{github.ref_name}} by @${{ github.event_name }} on: workflow_dispatch: @@ -76,6 +76,9 @@ jobs: echo $_ver echo "WINGS_VERSION=$_ver" >> "$GITHUB_OUTPUT" + echo "MVN_COVERAGE=${{ inputs.testCoverReport || github.event_name == 'release' }}" >> "$GITHUB_OUTPUT" + echo "MVN_DEPLOYRH=${{ inputs.deployOssrh || github.event_name == 'release' }}" >> "$GITHUB_OUTPUT" + mvn -v git --no-pager log --graph -10 --pretty=format:'%H - %ai %d %s' @@ -95,7 +98,7 @@ jobs: ## report if not release - name: Test Coverage ${{ steps.settings.outputs.WINGS_VERSION }} ${{ steps.settings.outputs.GIT_BRANCH }} - if: inputs.testCoverReport + if: steps.settings.outputs.MVN_COVERAGE run: > mvn -P coverage @@ -106,7 +109,7 @@ jobs: JAVA_HOME: ${{ steps.settings.outputs.JAVA_HOME }} ## import gpp private key - name: Import GPG key - if: inputs.deployOssrh + if: steps.settings.outputs.MVN_DEPLOYRH uses: crazy-max/ghaction-import-gpg@v6 with: gpg_private_key: ${{ secrets.MVN_GPG_SKEY }} @@ -114,7 +117,7 @@ jobs: ## maven deploy - name: Deploy ${{ steps.settings.outputs.WINGS_VERSION }} ${{ steps.settings.outputs.GIT_BRANCH }} - if: inputs.deployOssrh + if: steps.settings.outputs.MVN_DEPLOYRH run: > mvn -P ossrh From 34c8eb0303609b82cd8039e529949266b4d05d14 Mon Sep 17 00:00:00 2001 From: trydofor Date: Mon, 29 Jan 2024 15:08:27 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E2=9C=85=20toString=20manually=20checked?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fessional/meepo/bind/dna/DnaBkbTest.java | 3 ++ .../fessional/meepo/bind/dna/DnaEndTest.java | 3 ++ .../fessional/meepo/bind/dna/DnaRawTest.java | 3 ++ .../fessional/meepo/bind/dna/DnaSetTest.java | 3 ++ .../fessional/meepo/bind/rna/RnaPutTest.java | 4 +++ .../fessional/meepo/bind/rna/RnaRunTest.java | 4 +++ .../fessional/meepo/bind/rna/RnaUseTest.java | 4 +++ .../fessional/meepo/bind/txt/HiMeepoTest.java | 3 ++ .../meepo/bind/txt/TxtSimpleTest.java | 4 +++ .../fessional/meepo/poof/RnaManagerTest.java | 10 +++--- .../pro/fessional/meepo/sack/HolderTest.java | 35 +++++++++++++------ .../pro/fessional/meepo/sack/ParserTest.java | 32 +++++++++++------ .../pro/fessional/meepo/tmpl/TmplHelp.java | 3 +- 13 files changed, 83 insertions(+), 28 deletions(-) diff --git a/src/test/java/pro/fessional/meepo/bind/dna/DnaBkbTest.java b/src/test/java/pro/fessional/meepo/bind/dna/DnaBkbTest.java index 7c48542..dead775 100644 --- a/src/test/java/pro/fessional/meepo/bind/dna/DnaBkbTest.java +++ b/src/test/java/pro/fessional/meepo/bind/dna/DnaBkbTest.java @@ -1,5 +1,6 @@ package pro.fessional.meepo.bind.dna; +import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import pro.fessional.meepo.TraceTest; import pro.fessional.meepo.bind.wow.Clop; @@ -17,5 +18,7 @@ public class DnaBkbTest extends TraceTest { public void testToString() { logger.debug("d1={}", d1); logger.debug("d2={}", d2); + Assertions.assertTrue(d1.toString().contains("name='BlackKingBar'")); + Assertions.assertTrue(d2.toString().contains("name='BlackKingBar'")); } } diff --git a/src/test/java/pro/fessional/meepo/bind/dna/DnaEndTest.java b/src/test/java/pro/fessional/meepo/bind/dna/DnaEndTest.java index 46fe194..16af2de 100644 --- a/src/test/java/pro/fessional/meepo/bind/dna/DnaEndTest.java +++ b/src/test/java/pro/fessional/meepo/bind/dna/DnaEndTest.java @@ -1,5 +1,6 @@ package pro.fessional.meepo.bind.dna; +import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import pro.fessional.meepo.TraceTest; import pro.fessional.meepo.bind.wow.Clop; @@ -19,5 +20,7 @@ public class DnaEndTest extends TraceTest { public void testToString() { logger.debug("d1={}", d1); logger.debug("d2={}", d2); + Assertions.assertTrue(d1.toString().contains("name=[BlackKingBar,id]")); + Assertions.assertTrue(d2.toString().contains("name=[BlackKingBar,id]")); } } diff --git a/src/test/java/pro/fessional/meepo/bind/dna/DnaRawTest.java b/src/test/java/pro/fessional/meepo/bind/dna/DnaRawTest.java index 9ec28fa..eb10e10 100644 --- a/src/test/java/pro/fessional/meepo/bind/dna/DnaRawTest.java +++ b/src/test/java/pro/fessional/meepo/bind/dna/DnaRawTest.java @@ -1,5 +1,6 @@ package pro.fessional.meepo.bind.dna; +import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import pro.fessional.meepo.TraceTest; import pro.fessional.meepo.bind.wow.Clop; @@ -19,6 +20,8 @@ public class DnaRawTest extends TraceTest { public void testToString() { logger.debug("d1={}", d1); logger.debug("d2={}", d2); + Assertions.assertTrue(d1.toString().contains("text='SUPER(1010100'")); + Assertions.assertTrue(d2.toString().contains("text='SUPER(1010100'")); } } diff --git a/src/test/java/pro/fessional/meepo/bind/dna/DnaSetTest.java b/src/test/java/pro/fessional/meepo/bind/dna/DnaSetTest.java index cb6244f..a9d669c 100644 --- a/src/test/java/pro/fessional/meepo/bind/dna/DnaSetTest.java +++ b/src/test/java/pro/fessional/meepo/bind/dna/DnaSetTest.java @@ -1,5 +1,6 @@ package pro.fessional.meepo.bind.dna; +import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import pro.fessional.meepo.TraceTest; import pro.fessional.meepo.bind.wow.Clop; @@ -20,5 +21,7 @@ public class DnaSetTest extends TraceTest { public void testToString() { logger.debug("d1={}", d1); logger.debug("d2={}", d2); + Assertions.assertTrue(d1.toString().contains("find='false', repl='{{user.male}}'}")); + Assertions.assertTrue(d2.toString().contains("find='false', repl='{{user.male}}'")); } } diff --git a/src/test/java/pro/fessional/meepo/bind/rna/RnaPutTest.java b/src/test/java/pro/fessional/meepo/bind/rna/RnaPutTest.java index 944f2b0..2df6f0b 100644 --- a/src/test/java/pro/fessional/meepo/bind/rna/RnaPutTest.java +++ b/src/test/java/pro/fessional/meepo/bind/rna/RnaPutTest.java @@ -1,5 +1,6 @@ package pro.fessional.meepo.bind.rna; +import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import pro.fessional.meepo.TraceTest; import pro.fessional.meepo.bind.wow.Clop; @@ -17,5 +18,8 @@ public class RnaPutTest extends TraceTest { public void testToString() { logger.debug("d1={}", d1); logger.debug("d2={}", d2); + + Assertions.assertTrue(d1.toString().contains("type='os', para='who', expr='basename $(pwd)'")); + Assertions.assertTrue(d2.toString().contains("type='os', para='who', expr='basename $(pwd)'")); } } diff --git a/src/test/java/pro/fessional/meepo/bind/rna/RnaRunTest.java b/src/test/java/pro/fessional/meepo/bind/rna/RnaRunTest.java index aa00d9c..9894884 100644 --- a/src/test/java/pro/fessional/meepo/bind/rna/RnaRunTest.java +++ b/src/test/java/pro/fessional/meepo/bind/rna/RnaRunTest.java @@ -1,5 +1,6 @@ package pro.fessional.meepo.bind.rna; +import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import pro.fessional.meepo.TraceTest; import pro.fessional.meepo.bind.wow.Clop; @@ -20,5 +21,8 @@ public class RnaRunTest extends TraceTest { public void testToString() { logger.debug("d1={}", d1); logger.debug("d2={}", d2); + + Assertions.assertTrue(d1.toString().contains("type='os', find='rand', expr='echo $RANDOM'")); + Assertions.assertTrue(d2.toString().contains("type='os', find='rand', expr='echo $RANDOM'")); } } diff --git a/src/test/java/pro/fessional/meepo/bind/rna/RnaUseTest.java b/src/test/java/pro/fessional/meepo/bind/rna/RnaUseTest.java index 445d3d8..8587147 100644 --- a/src/test/java/pro/fessional/meepo/bind/rna/RnaUseTest.java +++ b/src/test/java/pro/fessional/meepo/bind/rna/RnaUseTest.java @@ -1,5 +1,6 @@ package pro.fessional.meepo.bind.rna; +import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import pro.fessional.meepo.TraceTest; import pro.fessional.meepo.bind.wow.Clop; @@ -20,5 +21,8 @@ public class RnaUseTest extends TraceTest { public void testToString() { logger.debug("d1={}", d1); logger.debug("d2={}", d2); + + Assertions.assertTrue(d1.toString().contains("find='meepo', para='who'")); + Assertions.assertTrue(d2.toString().contains("find='meepo', para='who'")); } } diff --git a/src/test/java/pro/fessional/meepo/bind/txt/HiMeepoTest.java b/src/test/java/pro/fessional/meepo/bind/txt/HiMeepoTest.java index 43aae5a..013b363 100644 --- a/src/test/java/pro/fessional/meepo/bind/txt/HiMeepoTest.java +++ b/src/test/java/pro/fessional/meepo/bind/txt/HiMeepoTest.java @@ -1,5 +1,6 @@ package pro.fessional.meepo.bind.txt; +import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import pro.fessional.meepo.TraceTest; import pro.fessional.meepo.bind.wow.Clop; @@ -17,5 +18,7 @@ public class HiMeepoTest extends TraceTest { public void testToString() { logger.debug("d1={}", d1); logger.debug("d2={}", d2); + Assertions.assertTrue(d1.toString().contains("head='/*', tail='*/'")); + Assertions.assertTrue(d2.toString().contains("head='/*', tail='*/'")); } } diff --git a/src/test/java/pro/fessional/meepo/bind/txt/TxtSimpleTest.java b/src/test/java/pro/fessional/meepo/bind/txt/TxtSimpleTest.java index e1d2dda..4601dc0 100644 --- a/src/test/java/pro/fessional/meepo/bind/txt/TxtSimpleTest.java +++ b/src/test/java/pro/fessional/meepo/bind/txt/TxtSimpleTest.java @@ -1,5 +1,6 @@ package pro.fessional.meepo.bind.txt; +import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import pro.fessional.meepo.TraceTest; import pro.fessional.meepo.bind.wow.Clop; @@ -17,5 +18,8 @@ public class TxtSimpleTest extends TraceTest { public void testToString() { logger.debug("d1={}", d1); logger.debug("d2={}", d2); + + Assertions.assertTrue(d1.toString().contains("text='123456789'")); + Assertions.assertTrue(d2.toString().contains("text='123456789'")); } } diff --git a/src/test/java/pro/fessional/meepo/poof/RnaManagerTest.java b/src/test/java/pro/fessional/meepo/poof/RnaManagerTest.java index a9151b6..d2086f1 100644 --- a/src/test/java/pro/fessional/meepo/poof/RnaManagerTest.java +++ b/src/test/java/pro/fessional/meepo/poof/RnaManagerTest.java @@ -29,7 +29,7 @@ public void testFunNow1() { Gene gene = Parser.parse(meepo); Map ctx = new HashMap<>(); String out = gene.merge(ctx); - logger.debug(out); + logger.debug("testFunNow={}", out); Pattern ptn = Pattern.compile("\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}"); assertTrue(ptn.matcher(out).find()); } @@ -40,7 +40,7 @@ public void testFunNow2() { Gene gene = Parser.parse(meepo); Map ctx = new HashMap<>(); String out = gene.merge(ctx); - logger.debug(out); + logger.debug("testFunNow={}", out); Pattern ptn = Pattern.compile("\\d{4}-\\d{2}-\\d{2}"); assertTrue(ptn.matcher(out).find()); } @@ -52,7 +52,7 @@ public void testFunNow() { Map ctx = new HashMap<>(); { Object obj = fun.eval(ctx, null); - logger.debug("obj={}", obj); + logger.debug("testFunNow.obj={}", obj); } { Object obj = fun.eval(ctx, new java.util.Date(0)); @@ -97,7 +97,7 @@ public void testFunAbs() { ctx.put("number", -1); Gene gene = Parser.parse(meepo); String out = gene.merge(ctx); - logger.debug(out); + logger.debug("testFunAbs={}", out); assertEquals("1", out); } @@ -112,7 +112,7 @@ public void testFunCtx() { Gene gene = Parser.parse(meepo); String out = gene.merge(ctx); - logger.debug(out); + logger.debug("testFunCtx={}", out); assertEquals("1", out); } } diff --git a/src/test/java/pro/fessional/meepo/sack/HolderTest.java b/src/test/java/pro/fessional/meepo/sack/HolderTest.java index c908c00..e217e57 100644 --- a/src/test/java/pro/fessional/meepo/sack/HolderTest.java +++ b/src/test/java/pro/fessional/meepo/sack/HolderTest.java @@ -20,42 +20,55 @@ class HolderTest extends TraceTest { void parseSimple() { String hd = "this is {{var | PascalCase}} here"; final Gene gene = Holder.parse(hd); - logger.debug(gene.build()); - logger.debug(gene.graph()); + String build = gene.build(); + String graph = gene.graph(); + logger.debug("hd={}", hd); + logger.debug("build={}", build); + logger.debug("graph={}", graph); String str = gene.merge(ctx); assertEquals("this is TryDoFor here", str); + assertEquals(hd, build); } @Test void parseEsc1() { String hd = "this is /{{ //{{ var | PascalCase | BIG_SNAKE }} /}} here"; final Gene gene = Holder.parse(true, hd, "{{", "}}", "/"); - logger.debug(hd); - logger.debug(gene.build()); - logger.debug(gene.graph()); + String build = gene.build(); + String graph = gene.graph(); + logger.debug("hd={}", hd); + logger.debug("build={}", build); + logger.debug("graph={}", graph); String str = gene.merge(ctx); assertEquals("this is {{ /TRY_DO_FOR }} here", str); + assertEquals("this is {{ /{{ var | PascalCase | BIG_SNAKE }} }} here", build); } @Test void parseEsc2() { String hd = "} this is /${ //${ var | PascalCase | BIG_SNAKE } /} here ${"; final Gene gene = Holder.parse(true, hd, "${", "}", "/"); - logger.debug(hd); - logger.debug(gene.build()); - logger.debug(gene.graph()); + String build = gene.build(); + String graph = gene.graph(); + logger.debug("hd={}", hd); + logger.debug("build={}", build); + logger.debug("graph={}", graph); String str = gene.merge(ctx); assertEquals("} this is ${ /TRY_DO_FOR } here ${", str); + assertEquals("} this is ${ /${ var | PascalCase | BIG_SNAKE } } here ${", build); } @Test void parseEsc3() { String hd = "}}}} this is /${ //${ var | PascalCase | BIG_SNAKE }}} /}}}} here ${"; final Gene gene = Holder.parse(true, hd, "${", "}}}", "/"); - logger.debug(hd); - logger.debug(gene.build()); - logger.debug(gene.graph()); + String graph = gene.graph(); + String build = gene.build(); + logger.debug("hd={}", hd); + logger.debug("build={}", build); + logger.debug("graph={}", graph); String str = gene.merge(ctx); assertEquals("}}}} this is ${ /TRY_DO_FOR }}}} here ${", str); + assertEquals("}}}} this is ${ /${ var | PascalCase | BIG_SNAKE }}} }}}} here ${", build); } } \ No newline at end of file diff --git a/src/test/java/pro/fessional/meepo/sack/ParserTest.java b/src/test/java/pro/fessional/meepo/sack/ParserTest.java index 474d8ba..e690db0 100644 --- a/src/test/java/pro/fessional/meepo/sack/ParserTest.java +++ b/src/test/java/pro/fessional/meepo/sack/ParserTest.java @@ -179,7 +179,8 @@ private void checkDnaBkb(HiMeepo meepo, String txt, String name, String build) { Exon exon = Parser.dealDnaBkb(ctx); assertNotNull(exon); - logger.debug("{}", exon); + String str = exon.toString(); + logger.debug("checkDnaBkb={}", str); if (name == null) { assertEquals(0, exon.edge.until); } @@ -220,7 +221,8 @@ private void checkDnaEnd(HiMeepo meepo, String txt, String name, String build) { Exon exon = Parser.dealDnaEnd(ctx); assertNotNull(exon); - logger.debug(exon.toString()); + String str = exon.toString(); + logger.debug("checkDnaEnd={}", str); if (name == null) { assertEquals(0, exon.edge.until); @@ -268,7 +270,8 @@ private void checkDnaSet(HiMeepo meepo, String txt, Life life, String find, Stri Exon exon = Parser.dealDnaSet(ctx); assertNotNull(exon); - logger.debug(exon.toString()); + String str = exon.toString(); + logger.debug("checkDnaSet={}", str); if (life == null) { assertEquals(0, exon.edge.until); @@ -318,7 +321,7 @@ public void dealDnaSet() { checkDnaSet(level5, "@@/* DNA:SET /false/mail */\n@@", null, null, null, "/* DNA:SET /false/mail */"); // nothing to test - TxtDnaSet tds = new TxtDnaSet("a", new Clop(0, 1,0,0), "TxtDnaSet-toString-Test"); + TxtDnaSet tds = new TxtDnaSet("a", new Clop(0, 1, 0, 0), "TxtDnaSet-toString-Test"); Assertions.assertTrue(tds.toString().contains("TxtDnaSet-toString-Test")); } @@ -329,7 +332,8 @@ private void checkRnaRun(HiMeepo meepo, String txt, Life life, String type, Stri Exon exon = Parser.dealRnaRun(ctx); assertNotNull(exon); - logger.debug(exon.toString()); + String str = exon.toString(); + logger.debug("checkRnaRun={}", str); if (type == null) { assertEquals(0, exon.edge.until); @@ -392,7 +396,8 @@ private void checkRnaUse(HiMeepo meepo, String txt, Life life, String find, Stri Exon exon = Parser.dealRnaUse(ctx); assertNotNull(exon); - logger.debug(exon.toString()); + String str = exon.toString(); + logger.debug("checkRnaUse={}", str); if (life == null) { assertEquals(0, exon.edge.until); @@ -451,7 +456,8 @@ private void checkRnaPut(HiMeepo meepo, String txt, String type, String para, St Exon exon = Parser.dealRnaPut(ctx); assertNotNull(exon); exon.check(ctx.errs, ctx.rngs); - logger.debug(exon.toString()); + String str = exon.toString(); + logger.debug("checkRnaPut={}", str); if (type == null) { assertEquals(0, exon.edge.until); @@ -511,7 +517,8 @@ private void checkRnaWhen(HiMeepo meepo, String txt, String tock, String type, b Exon exon = Parser.dealRnaWhen(ctx); assertNotNull(exon); exon.check(ctx.errs, ctx.rngs); - logger.debug(exon.toString()); + String str = exon.toString(); + logger.debug("checkRnaWhen={}", str); if (type == null) { assertEquals(0, exon.edge.until); @@ -557,7 +564,8 @@ private void checkRnaEach(HiMeepo meepo, String txt, String tock, String type, i Exon exon = Parser.dealRnaEach(ctx); assertNotNull(exon); exon.check(ctx.errs, ctx.rngs); - logger.debug(exon.toString()); + String str = exon.toString(); + logger.debug("checkRnaEach={}", str); if (type == null) { assertEquals(0, exon.edge.until); @@ -601,7 +609,8 @@ private void checkRnaElse(HiMeepo meepo, String txt, String tock, String build) Exon exon = Parser.dealRnaElse(ctx); assertNotNull(exon); - logger.debug(exon.toString()); + String str = exon.toString(); + logger.debug("checkRnaElse={}", str); if (tock == null) { assertEquals(0, exon.edge.until); @@ -637,7 +646,8 @@ private void checkRnaDone(HiMeepo meepo, String txt, String name, String build) Exon exon = Parser.dealRnaDone(ctx); assertNotNull(exon); - logger.debug(exon.toString()); + String str = exon.toString(); + logger.debug("checkRnaDone={}", str); if (name == null) { assertEquals(0, exon.edge.until); diff --git a/src/test/java/pro/fessional/meepo/tmpl/TmplHelp.java b/src/test/java/pro/fessional/meepo/tmpl/TmplHelp.java index 83aa141..4398571 100644 --- a/src/test/java/pro/fessional/meepo/tmpl/TmplHelp.java +++ b/src/test/java/pro/fessional/meepo/tmpl/TmplHelp.java @@ -36,6 +36,7 @@ public static void assertTmpl(String expected, String actual, Map