@@ -72,34 +72,11 @@ jobs:
7272 cache-dependency-path : ' ${{ inputs.project-directory }}/go.sum'
7373 id : go
7474
75- - name : Check Go version compatibility
76- id : go-compat
77- working-directory : ./${{ inputs.project-directory == '' && '.' || inputs.project-directory }}
78- shell : bash
79- run : |
80- # Read the minimum Go version required by the module
81- MODULE_GO_VERSION=$(grep '^go ' go.mod | awk '{print $2}')
82- RUNNER_GO_VERSION=$(go env GOVERSION | sed 's/^go//')
83- echo "Module requires Go ${MODULE_GO_VERSION}, runner has Go ${RUNNER_GO_VERSION}"
84-
85- # Extract major.minor for comparison
86- MODULE_MAJOR_MINOR=$(echo "${MODULE_GO_VERSION}" | grep -oE '^[0-9]+\.[0-9]+')
87- RUNNER_MAJOR_MINOR=$(echo "${RUNNER_GO_VERSION}" | grep -oE '^[0-9]+\.[0-9]+')
88-
89- if [ "$(printf '%s\n' "${MODULE_MAJOR_MINOR}" "${RUNNER_MAJOR_MINOR}" | sort -V | head -n1)" = "${MODULE_MAJOR_MINOR}" ]; then
90- echo "compatible=true" >> $GITHUB_OUTPUT
91- else
92- echo "compatible=false" >> $GITHUB_OUTPUT
93- echo "::warning::Skipping tests: module requires Go ${MODULE_GO_VERSION} but runner has Go ${RUNNER_GO_VERSION}"
94- fi
95-
9675 - name : ensure compilation
97- if : steps.go-compat.outputs.compatible == 'true'
9876 working-directory : ./${{ inputs.project-directory }}
9977 run : go build ./...
10078
10179 - name : Install dependencies
102- if : steps.go-compat.outputs.compatible == 'true'
10380 shell : bash
10481 run : |
10582 SCRIPT_PATH="./.github/scripts/${{ inputs.project-directory }}/install-dependencies.sh"
@@ -111,25 +88,23 @@ jobs:
11188
11289 # Setup Testcontainers Cloud Client right before your Testcontainers tests
11390 - name : Setup Testcontainers Cloud Client
114- if : ${{ steps.go-compat.outputs.compatible == 'true' && inputs.testcontainers-cloud }}
91+ if : ${{ inputs.testcontainers-cloud }}
11592 uses : atomicjar/testcontainers-cloud-setup-action@c335bdbb570ec7c48f72c7d450c077f0a002293e # v1.3
11693 with :
11794 token : ${{ secrets.TCC_TOKEN }}
11895
11996 - name : go test
120- if : steps.go-compat.outputs.compatible == 'true'
12197 working-directory : ./${{ inputs.project-directory }}
12298 timeout-minutes : 30
12399 run : make test-unit
124100
125101 - name : Run checker
126- if : steps.go-compat.outputs.compatible == 'true'
127102 run : |
128103 ./scripts/check_environment.sh
129104
130105 # (Optionally) When you don't need Testcontainers Cloud anymore, you could terminate sessions eagerly
131106 - name : Terminate Testcontainers Cloud Client active sessions
132- if : ${{ steps.go-compat.outputs.compatible == 'true' && inputs.testcontainers-cloud }}
107+ if : ${{ inputs.testcontainers-cloud }}
133108 uses : atomicjar/testcontainers-cloud-setup-action@c335bdbb570ec7c48f72c7d450c077f0a002293e # v1.3
134109 with :
135110 action : terminate
@@ -138,12 +113,12 @@ jobs:
138113 uses : test-summary/action@31493c76ec9e7aa675f1585d3ed6f1da69269a86 # v2.4
139114 with :
140115 paths : " **/${{ inputs.project-directory }}/TEST-unit*.xml"
141- if : ${{ always() && steps.go-compat.outputs.compatible == 'true' }}
116+ if : always()
142117
143118 - name : Decide if Sonar must be run
144- if : ${{ steps.go-compat.outputs.compatible == 'true' && matrix.platform == 'ubuntu-latest' }}
119+ if : ${{ matrix.platform == 'ubuntu-latest' }}
145120 run : |
146- if [[ "1.24 .x" == "${{ inputs.go-version }}" ]] && \
121+ if [[ "1.25 .x" == "${{ inputs.go-version }}" ]] && \
147122 [[ "true" != "${{ inputs.rootless-docker }}" ]] && \
148123 [[ "true" != "${{ inputs.testcontainers-cloud }}" ]] && \
149124 [[ "true" != "${{ inputs.ryuk-disabled }}" ]] && \
@@ -153,7 +128,7 @@ jobs:
153128 fi
154129
155130 - name : Set Sonar Cloud environment variables
156- if : ${{ steps.go-compat.outputs.compatible == 'true' && env.SHOULD_RUN_SONAR == 'true' }}
131+ if : ${{ env.SHOULD_RUN_SONAR == 'true' }}
157132 run : |
158133 echo "PROJECT_VERSION=$(grep 'latest_version' mkdocs.yml | cut -d':' -f2 | tr -d ' ')" >> $GITHUB_ENV
159134 if [ "${{ inputs.project-directory }}" == "" ]; then
@@ -169,7 +144,7 @@ jobs:
169144 fi
170145
171146 - name : SonarQube Scan
172- if : ${{ steps.go-compat.outputs.compatible == 'true' && env.SHOULD_RUN_SONAR == 'true' }}
147+ if : ${{ env.SHOULD_RUN_SONAR == 'true' }}
173148 uses : SonarSource/sonarqube-scan-action@aa494459d7c39c106cc77b166de8b4250a32bb97 # v5.1.0
174149 env :
175150 SONAR_TOKEN : ${{ secrets.SONAR_TOKEN }}
0 commit comments