format update

This commit is contained in:
Aparna Jyothi 2025-12-16 18:29:28 +05:30
parent 5a033c67cc
commit 17e1a7df42

View File

@ -327,9 +327,8 @@ jobs:
matrix: matrix:
os: [ubuntu-latest, macos-latest, windows-latest] os: [ubuntu-latest, macos-latest, windows-latest]
steps: steps:
- uses: actions/checkout@v5 - uses: actions/checkout@v6
- name: Setup Go - name: Setup Go
id: setup-go id: setup-go
@ -337,47 +336,42 @@ jobs:
with: with:
go-version: '1.24.10' go-version: '1.24.10'
cache: false cache: false
# Capture Go cache locations # Capture Go cache locations
- name: Set Go cache variables (Linux/macOS) - name: Set Go cache variables (Linux/macOS)
if: runner.os != 'Windows' if: runner.os != 'Windows'
run: | run: |
echo "GO_MOD_CACHE=$(go env GOMODCACHE)" >> $GITHUB_ENV echo "GO_MOD_CACHE=$(go env GOMODCACHE)" >> $GITHUB_ENV
echo "GO_BUILD_CACHE=$(go env GOCACHE)" >> $GITHUB_ENV echo "GO_BUILD_CACHE=$(go env GOCACHE)" >> $GITHUB_ENV
- name: Set Go cache variables (Windows) - name: Set Go cache variables (Windows)
if: runner.os == 'Windows' if: runner.os == 'Windows'
shell: pwsh shell: pwsh
run: | run: |
echo "GO_MOD_CACHE=$(go env GOMODCACHE)" | Out-File $env:GITHUB_ENV -Append echo "GO_MOD_CACHE=$(go env GOMODCACHE)" | Out-File $env:GITHUB_ENV -Append
echo "GO_BUILD_CACHE=$(go env GOCACHE)" | Out-File $env:GITHUB_ENV -Append echo "GO_BUILD_CACHE=$(go env GOCACHE)" | Out-File $env:GITHUB_ENV -Append
# Normalize runner.arch to lowercase to ensure consistent cache keys
# runner.arch casing differs across platforms (e.g. X64 vs x64).
# Normalizing it avoids cache key mismatches.
- name: Normalize runner architecture (Linux/macOS) - name: Normalize runner architecture (Linux/macOS)
if: runner.os != 'Windows' if: runner.os != 'Windows'
shell: bash shell: bash
run: echo "ARCH=$(echo '${{ runner.arch }}' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV run: echo "ARCH=$(echo '${{ runner.arch }}' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
- name: Normalize runner architecture (Windows) - name: Normalize runner architecture (Windows)
if: runner.os == 'Windows' if: runner.os == 'Windows'
shell: pwsh shell: pwsh
run: | run: |
$arch = "${{ runner.arch }}".ToLower() $arch = "${{ runner.arch }}".ToLower()
echo "ARCH=$arch" | Out-File $env:GITHUB_ENV -Append echo "ARCH=$arch" | Out-File $env:GITHUB_ENV -Append
# Sets CACHE_OS_SUFFIX per platform
# Always define CACHE_OS_SUFFIX so it is safe to use in cache keys - name: Set cache OS suffix (Linux/macOS)
- name: Set cache OS suffix if: runner.os != 'Windows'
shell: bash shell: bash
run: | run: echo "CACHE_OS_SUFFIX=$ImageOS-" >> $GITHUB_ENV
echo "CACHE_OS_SUFFIX=" >> $GITHUB_ENV - name: Set cache OS suffix (Windows)
if [ "${{ runner.os }}" = "Linux" ]; then if: runner.os == 'Windows'
echo "CACHE_OS_SUFFIX=$ImageOS-" >> $GITHUB_ENV shell: pwsh
fi run: echo "CACHE_OS_SUFFIX=" >> $GITHUB_ENV
- name: Restore Go cache - name: Restore Go cache
id: go-cache id: go-cache
uses: actions/cache/restore@v4 uses: actions/cache/restore@v5
with: with:
path: | path: |
${{ env.GO_MOD_CACHE }} ${{ env.GO_MOD_CACHE }}