From 267b0d4b481f6f2644aacc0ff368f8ccbc5a349b Mon Sep 17 00:00:00 2001 From: Ryan Fischbach Date: Mon, 26 Feb 2024 10:32:48 -0800 Subject: [PATCH 1/6] gha: fix broken version str. --- .github/workflows/build-app.yml | 3 +++ .github/workflows/tag-release.yml | 3 ++- .github/workflows/util-tag-branch.yml | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-app.yml b/.github/workflows/build-app.yml index 1877ea0d..00428626 100644 --- a/.github/workflows/build-app.yml +++ b/.github/workflows/build-app.yml @@ -52,3 +52,6 @@ jobs: echo '```shell' >> $GITHUB_STEP_SUMMARY cat test-results.txt >> $GITHUB_STEP_SUMMARY echo '```' >> $GITHUB_STEP_SUMMARY + + - name: "tag branch" + uses: ./.github/workflows/util-tag-branch.yml diff --git a/.github/workflows/tag-release.yml b/.github/workflows/tag-release.yml index 53ce8dfb..9cbcef92 100644 --- a/.github/workflows/tag-release.yml +++ b/.github/workflows/tag-release.yml @@ -19,7 +19,8 @@ jobs: # limit to only first 3 chars VER_BUILD=${VER_BUILD:0:3} # 'strict' semver segments cannot start with 0 - VERSION_NUM="$(date +%y).$(date +%-m).$(date +%-d).${VER_BUILD#0}" + VERSION_NUM="0.$(date +%y)$(date +%m).$(date +%-d).${VER_BUILD#0}" + echo "VERSION_NUM=${VERSION_NUM}" >> $GITHUB_OUTPUT # recreate as INT, leaving 0's in place; creates a 'reasonable' 32-bit signed int. VERSION_INT="$(date +%y)$(date +%m)$(date +%d)${VER_BUILD}" echo "VERSION_INT=${VERSION_INT}" >> $GITHUB_OUTPUT diff --git a/.github/workflows/util-tag-branch.yml b/.github/workflows/util-tag-branch.yml index ea02b839..56ca7372 100644 --- a/.github/workflows/util-tag-branch.yml +++ b/.github/workflows/util-tag-branch.yml @@ -20,7 +20,7 @@ jobs: # limit to only first 3 chars VER_BUILD=${VER_BUILD:0:3} # 'strict' semver segments cannot start with 0 - VERSION_NUM="$(date +%y).$(date +%-m).$(date +%-d).${VER_BUILD#0}" + VERSION_NUM="0.$(date +%y)$(date +%m).$(date +%-d).${VER_BUILD#0}" echo "VERSION_NUM=${VERSION_NUM}" >> $GITHUB_OUTPUT # recreate as INT, leaving 0's in place; creates a 'reasonable' 32-bit signed int. VERSION_INT="$(date +%y)$(date +%m)$(date +%d)${VER_BUILD}" From 33f0cad58c3ba9923956c5e3de28fd66736bf7f2 Mon Sep 17 00:00:00 2001 From: Ryan Fischbach Date: Mon, 26 Feb 2024 11:11:22 -0800 Subject: [PATCH 2/6] gha: move set-e lower. --- .github/workflows/build-app.yml | 2 +- .github/workflows/util-tag-branch.yml | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/build-app.yml b/.github/workflows/build-app.yml index 00428626..ecfcce82 100644 --- a/.github/workflows/build-app.yml +++ b/.github/workflows/build-app.yml @@ -36,7 +36,6 @@ jobs: set +e set -o pipefail go test ./... 2>&1 | tee test-results.txt - set -e S=$? #non-0 means error if [ $S -eq 0 ]; then R="Test(s) Passed: ${TEST_NAME}" @@ -47,6 +46,7 @@ jobs: echo "::error::$R" R=":x: $R" fi + set -e echo "### ${R}" >> $GITHUB_STEP_SUMMARY echo '---' >> $GITHUB_STEP_SUMMARY echo '```shell' >> $GITHUB_STEP_SUMMARY diff --git a/.github/workflows/util-tag-branch.yml b/.github/workflows/util-tag-branch.yml index 56ca7372..f70e256c 100644 --- a/.github/workflows/util-tag-branch.yml +++ b/.github/workflows/util-tag-branch.yml @@ -8,8 +8,6 @@ jobs: environment: default steps: - uses: actions/checkout@v4 - with: - ref: ${{ env.GITHUB_REF }} - name: "Create Version Tag" id: version_cfg From 216b0b40c8f508bc66b47c183c9d17bfc5093eaa Mon Sep 17 00:00:00 2001 From: Ryan Fischbach Date: Mon, 26 Feb 2024 11:17:52 -0800 Subject: [PATCH 3/6] gha: make the call to util workflow a diff job. --- .github/workflows/build-app.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-app.yml b/.github/workflows/build-app.yml index ecfcce82..04cbdd34 100644 --- a/.github/workflows/build-app.yml +++ b/.github/workflows/build-app.yml @@ -53,5 +53,6 @@ jobs: cat test-results.txt >> $GITHUB_STEP_SUMMARY echo '```' >> $GITHUB_STEP_SUMMARY - - name: "tag branch" - uses: ./.github/workflows/util-tag-branch.yml + tag-branch: + uses: ./.github/workflows/util-tag-branch.yml + secrets: inherit From 3f9da0e15781a0657216e9502c84b489c4c2d4cb Mon Sep 17 00:00:00 2001 From: Ryan Fischbach Date: Mon, 26 Feb 2024 11:23:36 -0800 Subject: [PATCH 4/6] gha: ensure test-code job fails if not succeed. --- .github/workflows/util-tag-branch.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/util-tag-branch.yml b/.github/workflows/util-tag-branch.yml index f70e256c..0db9882b 100644 --- a/.github/workflows/util-tag-branch.yml +++ b/.github/workflows/util-tag-branch.yml @@ -1,6 +1,6 @@ name: "Create version tag" -on: [workflow_dispatch] +on: [workflow_call] jobs: tag-branch: From d1173950fd7fb843f683488c0878acbaf43f3cd6 Mon Sep 17 00:00:00 2001 From: Ryan Fischbach Date: Mon, 26 Feb 2024 11:25:50 -0800 Subject: [PATCH 5/6] gha: test_code vs test-code. --- .github/workflows/build-app.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-app.yml b/.github/workflows/build-app.yml index 04cbdd34..77caec35 100644 --- a/.github/workflows/build-app.yml +++ b/.github/workflows/build-app.yml @@ -9,7 +9,7 @@ on: - 'v*' jobs: - test-code: + test_code: runs-on: ubuntu-latest steps: - name: "Install dependencies" @@ -33,6 +33,7 @@ jobs: env: TEST_NAME: "Unit Tests" run: |- + TESTS_OK=1 set +e set -o pipefail go test ./... 2>&1 | tee test-results.txt @@ -45,6 +46,7 @@ jobs: R="Test(s) '${TEST_NAME}' failed" echo "::error::$R" R=":x: $R" + TESTS_OK=0 fi set -e echo "### ${R}" >> $GITHUB_STEP_SUMMARY @@ -52,7 +54,12 @@ jobs: echo '```shell' >> $GITHUB_STEP_SUMMARY cat test-results.txt >> $GITHUB_STEP_SUMMARY echo '```' >> $GITHUB_STEP_SUMMARY + + if [[ "${TESTS_OK}" == "0" ]]; then + exit 1 + fi tag-branch: + needs: [test_code] uses: ./.github/workflows/util-tag-branch.yml secrets: inherit From 4ea177d656bef7aef1a96280f52a8be97947f260 Mon Sep 17 00:00:00 2001 From: Ryan Fischbach Date: Mon, 26 Feb 2024 11:29:46 -0800 Subject: [PATCH 6/6] msg word tokenizer returned to default; leave as ENV var. --- utils/text.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/text.go b/utils/text.go index 07a69871..e3ed8437 100644 --- a/utils/text.go +++ b/utils/text.go @@ -18,7 +18,7 @@ var wordTokenRegex = wordTokenRegexPattern() func wordTokenRegexPattern() *regexp.Regexp { thePattern, ok := os.LookupEnv("WordTokenRegex") if !ok || thePattern == "" { - thePattern = `[\pM\pL\pN_'-]+|\pS` + thePattern = `[\pM\pL\pN_']+|\pS` } return regexp.MustCompile(thePattern) }