From 1317aadabf0ba49256a4d1bd745f6e77c50d357b Mon Sep 17 00:00:00 2001 From: Frederic BIDON Date: Fri, 12 Dec 2025 22:47:56 +0100 Subject: [PATCH 1/2] chore: cleanup ongoing experimentations Signed-off-by: Frederic BIDON --- {.github => experimental}/.markdownlint.yml | 0 {.github => experimental}/.spellcheck.yml | 0 {.github => experimental}/.wordlist.txt | 0 experimental/go-test-monorepo.yml | 190 -------------------- experimental/local-monorepo-go-test.yml | 19 -- 5 files changed, 209 deletions(-) rename {.github => experimental}/.markdownlint.yml (100%) rename {.github => experimental}/.spellcheck.yml (100%) rename {.github => experimental}/.wordlist.txt (100%) delete mode 100644 experimental/go-test-monorepo.yml delete mode 100644 experimental/local-monorepo-go-test.yml diff --git a/.github/.markdownlint.yml b/experimental/.markdownlint.yml similarity index 100% rename from .github/.markdownlint.yml rename to experimental/.markdownlint.yml diff --git a/.github/.spellcheck.yml b/experimental/.spellcheck.yml similarity index 100% rename from .github/.spellcheck.yml rename to experimental/.spellcheck.yml diff --git a/.github/.wordlist.txt b/experimental/.wordlist.txt similarity index 100% rename from .github/.wordlist.txt rename to experimental/.wordlist.txt diff --git a/experimental/go-test-monorepo.yml b/experimental/go-test-monorepo.yml deleted file mode 100644 index 06d3306..0000000 --- a/experimental/go-test-monorepo.yml +++ /dev/null @@ -1,190 +0,0 @@ -name: go test - -permissions: - contents: read - pull-requests: read - -on: - workflow_call: - -defaults: - run: - shell: bash - -jobs: - lint: - name: Go lint mono-repo - runs-on: ubuntu-latest - steps: - - - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 - with: - fetch-depth: 0 - - - uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0 - with: - go-version: stable - check-latest: true - cache: true - cache-dependency-path: '**/go.sum' - - - name: Detect if mono-repo - id: detect-monorepo - run: | - count_modules=$(go list -m|wc -l) - if [[ "${count_module}" -gt 1 ]] ; then - echo "is_monorepo=true" >> "${GITHUB_OUTPUT}" - exit - fi - echo "is_monorepo=false" >> "${GITHUB_OUTPUT}" - - - name: Install golangci-lint - if: ${{ steps.detect-monorepo.outputs == 'true' }} - uses: golangci/golangci-lint-action@e7fa5ac41e1cf5b7d48e45e42232ce7ada589601 # v9.1.0 - with: - version: latest - skip-cache: true - #install-only: true - experimental: "automatic-module-directories" - #- - # name: Lint multiple modules - # if: ${{ steps.detect-monorepo.outputs == 'true' }} - # # golangci-lint doesn't support go.work to lint multiple modules in one single pass - # # TODO: golangci-action v9.1+ has a built-in mono repo detection setup. - # run: | - # set -euxo pipefail - - # git fetch origin master - # git show --no-patch --oneline origin/master - - # while read -r module_location ; do - # pushd "${module_location}" - # golangci-lint run --new-from-rev origin/master - # popd - # done < <(go list -f '{{.Dir}}' -m) - - test: - name: Unit tests mono-repo - needs: [ lint ] - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ ubuntu-latest, macos-latest, windows-latest ] - go_version: ['oldstable', 'stable' ] - steps: - - - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 - - - uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0 - id: go-setup - with: - go-version: '${{ matrix.go_version }}' - check-latest: true - cache: true - cache-dependency-path: '**/go.sum' - - - name: Detect go version - id: detect-test-work-supported - run: | - #go_minor_version=$(go version |cut -d' ' -f3|cut -d'.' -f2) - go_minor_version=$(echo '{{ steps.go-setup.outputs.go-version }}'|cut -d' ' -f3|cut -d'.' -f2) - echo "go-minor-version=${go_minor_version}" >> "${GITHUB_OUTPUT}" - if [[ "${go_minor_version}" -ge 25 ]] ; then - echo "go-test-work-supported=true" >> "${GITHUB_OUTPUT}" - else - echo "go-test-work-supported=false" >> "${GITHUB_OUTPUT}" - fi - echo "::notice title=go version:${go_minor_version}" - - - name: Install gotestsum - uses: go-openapi/gh-actions/install/gotestsum@2c8f8152814933c4cead92a51558699238ee9565 - - - name: Run unit tests on all modules in this repo (go1.25+) - if: ${{ steps.detect-test-work-supported == 'true' }} - name: Run unit tests on all modules in this repo - run: > - # with go.work file enabled, go test recognizes sub-modules and collects all packages to be covered - # without specifying -coverpkg. - gotestsum - --jsonfile 'unit.report.${{ matrix.os }}-${{ matrix.go }}.json' - -- - work - -race - -p 2 - -count 1 - -timeout=20m - -coverprofile='unit.coverage.${{ matrix.os }}-${{ matrix.go }}.out' - -covermode=atomic - ./... - - - - name: Run unit tests on all modules in this repo - if: ${{ steps.detect-test-work-supported != 'true' }} - # pre-go1.25 version - run: | - declare -a ALL_MODULES - BASH_MAJOR=$(echo "${BASH_VERSION}"|cut -d'.' -f1) - if [[ "${BASH_MAJOR}" -ge 4 ]] ; then - mapfile ALL_MODULES < <(go list -f '{{.Dir}}/...' -m) - else - # for older bash versions, e.g. on macOS runner. This fallback will eventually disappear. - while read -r line ; do - ALL_MODULES+=("${line}") - done < <(go list -f '{{.Dir}}/...' -m) - fi - echo "::notice title=Modules found::${ALL_MODULES[@]}" - - gotestsum \ - --jsonfile 'unit.report.${{ matrix.os }}-${{ matrix.go }}.json' \ - -- \ - -race \ - -p 2 \ - -count 1 \ - -timeout=20m \ - -coverprofile='unit.coverage.${{ matrix.os }}-${{ matrix.go }}.out' \ - -covermode=atomic \ - ${ALL_MODULES[@]} - - - name: Upload coverage artifacts - uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 - with: - # *.coverage.* pattern is automatically detected by codecov - path: '**/*.coverage.*.out' - name: 'unit.coverage.${{ matrix.os }}-${{ matrix.go }}' - retention-days: 1 - - - name: Upload test report artifacts - # upload report even if test fail. BTW, this is when they are valuable. - if: ${{ !cancelled() }} - uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 - with: - path: '**/unit.report.*.json' - name: 'unit.report.${{ matrix.os }}-${{ matrix.go }}' - retention-days: 1 - - fuzz-test: - # fuzz-test supports go monorepos - uses: ./.github/workflows/fuzz-test.yml - - test-complete: - # description: | - # Be explicit about all tests being passed. This allows for setting up only a few status checks on PRs. - name: tests completed - needs: [test] - runs-on: ubuntu-latest - steps: - - - name: Tests completed - run: | - echo "::notice title=Success:All tests passed" - - collect-coverage: - needs: [test-complete] - if: ${{ !cancelled() && needs.test-complete.result == 'success' }} - uses: ./.github/workflows/collect-coverage.yml - - collect-reports: - name: collect test reports - needs: [test] - if: ${{ !cancelled() }} - uses: ./.github/workflows/collect-reports.yml diff --git a/experimental/local-monorepo-go-test.yml b/experimental/local-monorepo-go-test.yml deleted file mode 100644 index 5cfdcd8..0000000 --- a/experimental/local-monorepo-go-test.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: go test - -permissions: - contents: read - pull-requests: read - -on: - push: - tags: - - v* - branches: - - master - - pull_request: - -jobs: - go-monorepo-test: - uses: ./.github/workflows/monorepo-go-test.yml - secrets: inherit From f039d54a571dba6be4ae346b86a657449a618899 Mon Sep 17 00:00:00 2001 From: Frederic BIDON Date: Sun, 14 Dec 2025 09:50:55 +0100 Subject: [PATCH 2/2] fix: address workflow code smell with boolean inputs. Resolves one github gotcha with boolean input parameters. Now workflow parameters are enforced to be strings so we don't have to deal with several ways of evaluating whether something is true or false. Chore: enforced consistent formatting standards for github annotations and expressions. Signed-off-by: Frederic BIDON --- .github/workflows/auto-merge.yml | 6 +++--- .github/workflows/bump-release.yml | 22 +++++++++++----------- .github/workflows/contributors.yml | 4 ++-- .github/workflows/fuzz-test.yml | 4 ++-- .github/workflows/go-test.yml | 2 +- .github/workflows/local-bump-release.yml | 12 ++++++------ experimental/pr-comment.yml | 10 +++++----- 7 files changed, 30 insertions(+), 30 deletions(-) diff --git a/.github/workflows/auto-merge.yml b/.github/workflows/auto-merge.yml index 38a7803..1091b13 100644 --- a/.github/workflows/auto-merge.yml +++ b/.github/workflows/auto-merge.yml @@ -7,9 +7,9 @@ on: description: | Enable automatic approval and merge of PRs initiated by a bot. - type: boolean + type: string required: false - default: true + default: 'true' organization-bot: description: | The bot name for your organization, @@ -68,7 +68,7 @@ jobs: contents: write pull-requests: write runs-on: ubuntu-latest - if: ${{ (inputs.enable-organization-bot == 'true' || inputs.enable-organization-bot == true) && github.event.pull_request.user.login == inputs.organization-bot }} + if: ${{ inputs.enable-organization-bot == 'true' && github.event.pull_request.user.login == inputs.organization-bot }} env: PR_URL: ${{ github.event.pull_request.html_url }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/bump-release.yml b/.github/workflows/bump-release.yml index a8dc782..84c4a35 100644 --- a/.github/workflows/bump-release.yml +++ b/.github/workflows/bump-release.yml @@ -19,19 +19,19 @@ on: inputs: bump-patch: description: Bump a patch version release - type: boolean + type: string required: false - default: true + default: 'true' bump-minor: description: Bump a minor version release - type: boolean + type: string required: false - default: false + default: 'false' bump-major: description: Bump a major version release - type: boolean + type: string required: false - default: false + default: 'false' tag-message-title: description: Tag message title to prepend to the release notes required: false @@ -48,8 +48,8 @@ on: When enabled, you must pass the GPG secrets to this workflow. required: false - type: boolean - default: true + type: string + default: 'true' cliff-config: type: string required: false @@ -125,10 +125,10 @@ jobs: fi echo "next-tag=${NEXT_TAG}" >> "$GITHUB_OUTPUT" - echo "::notice title=next-tag:${NEXT_TAG}" + echo "::notice title=next-tag::${NEXT_TAG}" - name: Configure bot credentials - if: ${{ inputs.enable-tag-signing == 'true' || inputs.enable-tag-signing == true }} + if: ${{ inputs.enable-tag-signing == 'true' }} uses: go-openapi/gh-actions/ci-jobs/bot-credentials@6c7952706aa7afa9141262485767d9270ef5b00b # v1.3.0 # This is using the GPG signature of bot-go-openapi. # @@ -158,7 +158,7 @@ jobs: BODY=$(echo "${MESSAGE_BODY}"|tr '|' '\n') MESSAGE=$(printf "%s\n%s\n" "${MESSAGE}" "${BODY}") fi - echo "::notice title=tag-message:${MESSAGE}" + echo "::notice title=tag-message::${MESSAGE}" SIGNED="" if [[ '${{ inputs.enable-tag-signing }}' == 'true' ]] ; then diff --git a/.github/workflows/contributors.yml b/.github/workflows/contributors.yml index 9d5978e..49b4072 100644 --- a/.github/workflows/contributors.yml +++ b/.github/workflows/contributors.yml @@ -12,8 +12,8 @@ on: When enabled, commits in the pull request will be signed with the bot's GPG key. required: false - type: boolean - default: true + type: string + default: 'true' secrets: github-app-id: description: | diff --git a/.github/workflows/fuzz-test.yml b/.github/workflows/fuzz-test.yml index 7d4d746..7be8c2b 100644 --- a/.github/workflows/fuzz-test.yml +++ b/.github/workflows/fuzz-test.yml @@ -45,7 +45,7 @@ jobs: echo "matrix<> "${GITHUB_OUTPUT}" printenv fuzz_tests >> "${GITHUB_OUTPUT}" echo "EOF" >> "${GITHUB_OUTPUT}" - echo "::notice title=Fuzz tests found:${fuzz_tests}" + echo "::notice title=Fuzz tests found::${fuzz_tests}" fuzz-test: name: fuzz test @@ -155,4 +155,4 @@ jobs: name: Report fuzz corpus cache size run: | FINAL_SIZE=$(du -m "${CORPUS_DIR}"|cut -f1) - echo "::notice title=fuzz corpus size:${FINAL_SIZE}MB" + echo "::notice title=fuzz corpus size::${FINAL_SIZE}MB" diff --git a/.github/workflows/go-test.yml b/.github/workflows/go-test.yml index 6b9bc95..1e11d6c 100644 --- a/.github/workflows/go-test.yml +++ b/.github/workflows/go-test.yml @@ -99,7 +99,7 @@ jobs: - name: Tests completed run: | - echo "::notice title=Success:All tests passed" + echo "::notice title=Success::All tests passed" collect-coverage: needs: [test-complete] diff --git a/.github/workflows/local-bump-release.yml b/.github/workflows/local-bump-release.yml index 62ac9a7..d892dd5 100644 --- a/.github/workflows/local-bump-release.yml +++ b/.github/workflows/local-bump-release.yml @@ -15,19 +15,19 @@ on: inputs: bump-patch: description: Bump a patch version release - type: boolean + type: string required: false - default: true + default: 'true' bump-minor: description: Bump a minor version release - type: boolean + type: string required: false - default: false + default: 'false' bump-major: description: Bump a major version release - type: boolean + type: string required: false - default: false + default: 'false' tag-message-title: description: Tag message title to prepend to the release notes required: false diff --git a/experimental/pr-comment.yml b/experimental/pr-comment.yml index 5509847..223b734 100644 --- a/experimental/pr-comment.yml +++ b/experimental/pr-comment.yml @@ -99,7 +99,7 @@ jobs: echo "proceed=true" >> "${GITHUB_OUTPUT}" - name: Download message artifact - if: ${{ steps.check_pr.outputs.proceed == 'true'}} + if: ${{ steps.check_pr.outputs.proceed == 'true' }} id: download uses: actions/download-artifact@v5 with: @@ -107,10 +107,10 @@ jobs: repository: "${{ env.TARGET }}" name: "${{ inputs.artifact_name }}" path: artifacts/ - github-token: ${{secrets.GITHUB_TOKEN}} + github-token: ${{ secrets.GITHUB_TOKEN }} - name: Check message artifact size - if: ${{ steps.check_pr.outputs.proceed == 'true'}} + if: ${{ steps.check_pr.outputs.proceed == 'true' }} run: | MESSAGE_FILE="${{ steps.download.outputs.download-path }}/${{ inputs.artifact_name }}" SIZE=$(cat "${MESSAGE_FILE}"|wc -c) @@ -124,7 +124,7 @@ jobs: fi - name: Find previous PR comment - if: ${{ steps.check_pr.outputs.proceed == 'true'}} + if: ${{ steps.check_pr.outputs.proceed == 'true' }} uses: peter-evans/find-comment@v3 id: find_comment with: @@ -135,7 +135,7 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} - name: Create or update PR comment - if: ${{ steps.check_pr.outputs.proceed == 'true'}} + if: ${{ steps.check_pr.outputs.proceed == 'true' }} uses: peter-evans/create-or-update-comment@v4 with: issue-number: ${{ inputs.pr_number }}