3838 with :
3939 go-version : ${{ matrix.go }}
4040 check-latest : true
41- # Disable built-in cache to use our custom cache
42- cache : false
43-
44- - name : Cache Go modules
45- uses : actions/cache@v4
46- with :
47- path : |
48- ~/.cache/go-build
49- ~/go/pkg/mod
50- key : ${{ runner.os }}-go-${{ matrix.go }}-${{ hashFiles('**/go.sum', '**/go.mod') }}-v1
51- restore-keys : |
52- ${{ runner.os }}-go-${{ matrix.go }}-
53- continue-on-error : true
5441
5542 - name : Download dependencies with retry
5643 run : |
@@ -61,10 +48,10 @@ jobs:
6148 download_with_retry() {
6249 local attempt=1
6350 local max_attempts=3
64-
51+
6552 while [ $attempt -le $max_attempts ]; do
6653 echo "Attempt $attempt of $max_attempts"
67-
54+
6855 if go mod download; then
6956 echo "Download successful on attempt $attempt"
7057 return 0
7966 attempt=$((attempt + 1))
8067 fi
8168 done
82-
69+
8370 echo "All download attempts failed"
8471 return 1
8572 }
@@ -184,36 +171,36 @@ jobs:
184171
185172 # Create temporary file for package coverage aggregation
186173 temp_coverage=$(mktemp)
187-
174+
188175 # Extract package-level coverage data
189176 go tool cover -func=coverage.out | grep -v total | while read line; do
190177 if [[ $line == *".go:"* ]]; then
191178 # Extract package path from file path (everything before the filename)
192179 filepath=$(echo "$line" | awk '{print $1}')
193180 pkg_path=$(dirname "$filepath" | sed 's|github.com/kjanat/articulate-parser/||' | sed 's|^\./||')
194181 coverage=$(echo "$line" | awk '{print $3}' | sed 's/%//')
195-
182+
196183 # Use root package if no subdirectory
197184 if [[ "$pkg_path" == "." || "$pkg_path" == "" ]]; then
198185 pkg_path="root"
199186 fi
200-
187+
201188 echo "$pkg_path $coverage" >> "$temp_coverage"
202189 fi
203190 done
204-
191+
205192 # Aggregate coverage by package (average)
206193 awk '{
207- packages[$1] += $2;
194+ packages[$1] += $2;
208195 counts[$1]++
209- }
196+ }
210197 END {
211198 for (pkg in packages) {
212199 avg = packages[pkg] / counts[pkg]
213200 printf "| %s | %.1f%% |\n", pkg, avg
214201 }
215202 }' $temp_coverage | sort >> $GITHUB_STEP_SUMMARY
216-
203+
217204 rm -f $temp_coverage
218205
219206 echo "</details>" >> $GITHUB_STEP_SUMMARY
@@ -507,8 +494,11 @@ jobs:
507494 - name : Checkout repository
508495 uses : actions/checkout@v4
509496
510- - name : Set up Docker Buildx
511- uses : docker/setup-buildx-action@v3
497+ - name : Login to Docker Hub
498+ uses : docker/login-action@v3
499+ with :
500+ username : ${{ vars.DOCKERHUB_USERNAME }}
501+ password : ${{ secrets.DOCKERHUB_TOKEN }}
512502
513503 - name : Log in to GitHub Container Registry
514504 uses : docker/login-action@v3
@@ -517,11 +507,19 @@ jobs:
517507 username : ${{ github.actor }}
518508 password : ${{ secrets.GITHUB_TOKEN }}
519509
510+ - name : Set up QEMU
511+ uses : docker/setup-qemu-action@v3
512+
513+ - name : Set up Docker Buildx
514+ uses : docker/setup-buildx-action@v3
515+
520516 - name : Extract metadata
521517 id : meta
522518 uses : docker/metadata-action@v5
523519 with :
524- images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
520+ images : |
521+ ${{ env.IMAGE_NAME }}
522+ ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
525523 tags : |
526524 type=ref,event=branch
527525 type=semver,pattern={{version}}
0 commit comments