From 3db70aa1088580c1460c1d799d75fc6ab76209cb Mon Sep 17 00:00:00 2001 From: David Bickford Date: Fri, 25 Apr 2025 16:33:03 -0400 Subject: [PATCH 1/6] determine mockery version --- go/deps/action.yml | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/go/deps/action.yml b/go/deps/action.yml index a0a3601..9309836 100644 --- a/go/deps/action.yml +++ b/go/deps/action.yml @@ -9,6 +9,10 @@ inputs: FLIPPCIRCLECIPULLER_REPO_TOKEN: description: Flipp circleci repo token required: true + MOCKERY_VERSION: + description: The version of mockery to use + required: false + default: "" runs: using: 'composite' @@ -37,16 +41,38 @@ runs: run: go generate ./... shell: bash - name: Grab mockery version - if: ${{ hashFiles('.tool-versions') != '' }} run: | - MOCKERY_INSTALL_VERSION=$(awk '/^mockery[[:space:]]+/ {print "v"$2}' .tool-versions) - echo "MOCKERY_INSTALL_VERSION=${MOCKERY_INSTALL_VERSION}" >> $GITHUB_ENV + # Default to empty version and v1 config + MOCKERY_VERSION="" + + # Check for MOCKERY_VERSION input + if [ -n "${{ inputs.MOCKERY_VERSION }}" ]; then + MOCKERY_VERSION="${{ inputs.MOCKERY_VERSION }}" + echo "Using MOCKERY_VERSION=${MOCKERY_VERSION} from input" + fi + + # Check .tool-versions for mockery version + if [ -z "$MOCKERY_VERSION" ] && [ -f ".tool-versions" ] && [ -s ".tool-versions" ]; then + MOCKERY_VERSION==$(awk '/^mockery[[:space:]]+/ {print "v"$2}' .tool-versions) + echo "Using MOCKERY_VERSION=${MOCKERY_VERSION} from .tool-versions" + fi + + # Grab the major version from the full version + MOCKERY_MAJOR_VERSION="" + if [ -n "$MOCKERY_VERSION" ]; then + temp_version=${MOCKERY_VERSION#v} + MOCKERY_MAJOR_VERSION=${temp_version%%.*} + echo "Extracted MOCKERY_MAJOR_VERSION=${MOCKERY_MAJOR_VERSION}" + fi + + echo "MOCKERY_MAJOR_VERSION=${MOCKERY_MAJOR_VERSION}" >> $GITHUB_ENV + echo "MOCKERY_VERSION=${MOCKERY_VERSION}" >> $GITHUB_ENV shell: bash - name: Install mockery if: ${{ hashFiles('.mockery.yml') != '' }} run: | if [ -n "${{ env.MOCKERY_INSTALL_VERSION }}" ]; then - go install github.com/vektra/mockery/v2@${{ env.MOCKERY_INSTALL_VERSION }} + go install github.com/vektra/mockery/v${{ env.MOCKERY_MAJOR_VERSION }}@${{ env.MOCKERY_INSTALL_VERSION }} else go install github.com/vektra/mockery/v2 fi From d038d98812aa2bf47d909a1f44b1f518d7fe492b Mon Sep 17 00:00:00 2001 From: David Bickford Date: Fri, 25 Apr 2025 16:34:54 -0400 Subject: [PATCH 2/6] reference mockery v3 --- go/build/action.yml | 2 +- go/lint/action.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/go/build/action.yml b/go/build/action.yml index 363631d..54693b9 100644 --- a/go/build/action.yml +++ b/go/build/action.yml @@ -43,7 +43,7 @@ runs: BUF_BUILD_USER: ${{ inputs.BUF_BUILD_USER }} BUF_BUILD_API_TOKEN: ${{ inputs.BUF_BUILD_API_TOKEN }} - name: Setup Go dependencies - uses: wishabi/github-actions/go/deps@v0 + uses: wishabi/github-actions/go/deps@mockery-v3 env: BUF_TOKEN: ${{ inputs.BUF_BUILD_API_TOKEN }} with: diff --git a/go/lint/action.yml b/go/lint/action.yml index 640cfd7..a13ae33 100644 --- a/go/lint/action.yml +++ b/go/lint/action.yml @@ -52,7 +52,7 @@ runs: BUF_BUILD_API_TOKEN: ${{ inputs.BUF_BUILD_API_TOKEN }} FETCH_DEPTH: 0 - name: Setup Go dependencies - uses: wishabi/github-actions/go/deps@v0 + uses: wishabi/github-actions/go/deps@mockery-v3 with: FLIPPCIRCLECIPULLER_REPO_TOKEN: ${{ inputs.FLIPPCIRCLECIPULLER_REPO_TOKEN }} - name: Setup safe directory From 66976177249d680601a699cccc0659b96a04098c Mon Sep 17 00:00:00 2001 From: David Bickford Date: Fri, 25 Apr 2025 16:41:36 -0400 Subject: [PATCH 3/6] extra = --- go/deps/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go/deps/action.yml b/go/deps/action.yml index 9309836..3a8148c 100644 --- a/go/deps/action.yml +++ b/go/deps/action.yml @@ -53,7 +53,7 @@ runs: # Check .tool-versions for mockery version if [ -z "$MOCKERY_VERSION" ] && [ -f ".tool-versions" ] && [ -s ".tool-versions" ]; then - MOCKERY_VERSION==$(awk '/^mockery[[:space:]]+/ {print "v"$2}' .tool-versions) + MOCKERY_VERSION=$(awk '/^mockery[[:space:]]+/ {print "v"$2}' .tool-versions) echo "Using MOCKERY_VERSION=${MOCKERY_VERSION} from .tool-versions" fi From da5e13c2ffdfbcedc9d50c7daa898f80aeca6565 Mon Sep 17 00:00:00 2001 From: David Bickford Date: Fri, 25 Apr 2025 16:45:07 -0400 Subject: [PATCH 4/6] 'bad mockery name --- go/deps/action.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/go/deps/action.yml b/go/deps/action.yml index 3a8148c..84c630d 100644 --- a/go/deps/action.yml +++ b/go/deps/action.yml @@ -71,10 +71,10 @@ runs: - name: Install mockery if: ${{ hashFiles('.mockery.yml') != '' }} run: | - if [ -n "${{ env.MOCKERY_INSTALL_VERSION }}" ]; then - go install github.com/vektra/mockery/v${{ env.MOCKERY_MAJOR_VERSION }}@${{ env.MOCKERY_INSTALL_VERSION }} + if [ -n "${{ env.MOCKERY_VERSION }}" ]; then + go install github.com/vektra/mockery/v${{ env.MOCKERY_MAJOR_VERSION }}@${{ env.MOCKERY_VERSION }} else - go install github.com/vektra/mockery/v2 + go install github.com/vektra/mockery/v2@latest fi shell: bash - name: Generate mocks From 2819517b86b92125dec42686a90bbc8d40839991 Mon Sep 17 00:00:00 2001 From: David Bickford Date: Fri, 25 Apr 2025 16:52:24 -0400 Subject: [PATCH 5/6] can't use MOCKERY_VERSION --- go/deps/action.yml | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/go/deps/action.yml b/go/deps/action.yml index 84c630d..b96883b 100644 --- a/go/deps/action.yml +++ b/go/deps/action.yml @@ -9,7 +9,7 @@ inputs: FLIPPCIRCLECIPULLER_REPO_TOKEN: description: Flipp circleci repo token required: true - MOCKERY_VERSION: + MOCKERY_INSTALL_VERSION: description: The version of mockery to use required: false default: "" @@ -43,36 +43,36 @@ runs: - name: Grab mockery version run: | # Default to empty version and v1 config - MOCKERY_VERSION="" + MOCKERY_INSTALL_VERSION="" - # Check for MOCKERY_VERSION input - if [ -n "${{ inputs.MOCKERY_VERSION }}" ]; then - MOCKERY_VERSION="${{ inputs.MOCKERY_VERSION }}" - echo "Using MOCKERY_VERSION=${MOCKERY_VERSION} from input" + # Check for MOCKERY_INSTALL_VERSION input + if [ -n "${{ inputs.MOCKERY_INSTALL_VERSION }}" ]; then + MOCKERY_INSTALL_VERSION="${{ inputs.MOCKERY_INSTALL_VERSION }}" + echo "Using MOCKERY_INSTALL_VERSION=${MOCKERY_INSTALL_VERSION} from input" fi # Check .tool-versions for mockery version - if [ -z "$MOCKERY_VERSION" ] && [ -f ".tool-versions" ] && [ -s ".tool-versions" ]; then - MOCKERY_VERSION=$(awk '/^mockery[[:space:]]+/ {print "v"$2}' .tool-versions) - echo "Using MOCKERY_VERSION=${MOCKERY_VERSION} from .tool-versions" + if [ -z "$MOCKERY_INSTALL_VERSION" ] && [ -f ".tool-versions" ] && [ -s ".tool-versions" ]; then + MOCKERY_INSTALL_VERSION=$(awk '/^mockery[[:space:]]+/ {print "v"$2}' .tool-versions) + echo "Using MOCKERY_INSTALL_VERSION=${MOCKERY_INSTALL_VERSION} from .tool-versions" fi # Grab the major version from the full version - MOCKERY_MAJOR_VERSION="" - if [ -n "$MOCKERY_VERSION" ]; then - temp_version=${MOCKERY_VERSION#v} - MOCKERY_MAJOR_VERSION=${temp_version%%.*} - echo "Extracted MOCKERY_MAJOR_VERSION=${MOCKERY_MAJOR_VERSION}" + MOCKERY_INSTALL_MAJOR_VERSION="" + if [ -n "$MOCKERY_INSTALL_VERSION" ]; then + temp_version=${MOCKERY_INSTALL_VERSION#v} + MOCKERY_INSTALL_MAJOR_VERSION=${temp_version%%.*} + echo "Extracted MOCKERY_INSTALL_MAJOR_VERSION=${MOCKERY_INSTALL_MAJOR_VERSION}" fi - echo "MOCKERY_MAJOR_VERSION=${MOCKERY_MAJOR_VERSION}" >> $GITHUB_ENV - echo "MOCKERY_VERSION=${MOCKERY_VERSION}" >> $GITHUB_ENV + echo "MOCKERY_INSTALL_MAJOR_VERSION=${MOCKERY_INSTALL_MAJOR_VERSION}" >> $GITHUB_ENV + echo "MOCKERY_INSTALL_VERSION=${MOCKERY_INSTALL_VERSION}" >> $GITHUB_ENV shell: bash - name: Install mockery if: ${{ hashFiles('.mockery.yml') != '' }} run: | - if [ -n "${{ env.MOCKERY_VERSION }}" ]; then - go install github.com/vektra/mockery/v${{ env.MOCKERY_MAJOR_VERSION }}@${{ env.MOCKERY_VERSION }} + if [ -n "${{ env.MOCKERY_INSTALL_VERSION }}" ]; then + go install github.com/vektra/mockery/v${{ env.MOCKERY_INSTALL_MAJOR_VERSION }}@${{ env.MOCKERY_INSTALL_VERSION }} else go install github.com/vektra/mockery/v2@latest fi From 5e2dd4661b80be77048d51084526a3f89a1877e9 Mon Sep 17 00:00:00 2001 From: David Bickford Date: Mon, 28 Apr 2025 11:00:32 -0400 Subject: [PATCH 6/6] change over to v0 --- go/build/action.yml | 2 +- go/lint/action.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/go/build/action.yml b/go/build/action.yml index 54693b9..363631d 100644 --- a/go/build/action.yml +++ b/go/build/action.yml @@ -43,7 +43,7 @@ runs: BUF_BUILD_USER: ${{ inputs.BUF_BUILD_USER }} BUF_BUILD_API_TOKEN: ${{ inputs.BUF_BUILD_API_TOKEN }} - name: Setup Go dependencies - uses: wishabi/github-actions/go/deps@mockery-v3 + uses: wishabi/github-actions/go/deps@v0 env: BUF_TOKEN: ${{ inputs.BUF_BUILD_API_TOKEN }} with: diff --git a/go/lint/action.yml b/go/lint/action.yml index a13ae33..640cfd7 100644 --- a/go/lint/action.yml +++ b/go/lint/action.yml @@ -52,7 +52,7 @@ runs: BUF_BUILD_API_TOKEN: ${{ inputs.BUF_BUILD_API_TOKEN }} FETCH_DEPTH: 0 - name: Setup Go dependencies - uses: wishabi/github-actions/go/deps@mockery-v3 + uses: wishabi/github-actions/go/deps@v0 with: FLIPPCIRCLECIPULLER_REPO_TOKEN: ${{ inputs.FLIPPCIRCLECIPULLER_REPO_TOKEN }} - name: Setup safe directory