ci(release test):cache with tar -xzvf

This commit is contained in:
luoliwoshang
2025-09-03 20:19:53 +08:00
parent a1f9afc88f
commit b58cce09ab

View File

@@ -17,18 +17,21 @@ jobs:
id: cache-darwin-sysroot
uses: actions/cache/restore@v4
with:
path: .sysroot/darwin
key: darwin-sysroot-${{ hashFiles('.github/workflows/populate_darwin_sysroot.sh') }}-0.0.1
path: .sysroot/darwin.tar.gz
key: darwin-sysroot-${{ hashFiles('.github/workflows/populate_darwin_sysroot.sh') }}-0.0.2
lookup-only: true
- name: Populate Darwin sysroot
if: steps.cache-darwin-sysroot.outputs.cache-hit != 'true'
run: bash .github/workflows/populate_darwin_sysroot.sh
run: |
bash .github/workflows/populate_darwin_sysroot.sh
tar -czvf .sysroot/darwin.tar.gz -C .sysroot darwin
- name: Save Darwin sysroot cache
if: steps.cache-darwin-sysroot.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: .sysroot/darwin
path: .sysroot/darwin.tar.gz
key: ${{ steps.cache-darwin-sysroot.outputs.cache-primary-key }}
populate-linux-sysroot:
runs-on: ubuntu-latest
steps:
@@ -38,18 +41,21 @@ jobs:
id: cache-linux-sysroot
uses: actions/cache/restore@v4
with:
path: .sysroot/linux
key: linux-sysroot-${{ hashFiles('.github/workflows/populate_linux_sysroot.sh') }}-0.0.1
path: .sysroot/linux.tar.gz
key: linux-sysroot-${{ hashFiles('.github/workflows/populate_linux_sysroot.sh') }}-0.0.2
lookup-only: true
- name: Populate Linux sysroot
if: steps.cache-linux-sysroot.outputs.cache-hit != 'true'
run: bash .github/workflows/populate_linux_sysroot.sh
run: |
bash .github/workflows/populate_linux_sysroot.sh
tar -czvf .sysroot/linux.tar.gz -C .sysroot linux
- name: Save Linux sysroot cache
uses: actions/cache/save@v4
if: steps.cache-linux-sysroot.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: .sysroot/linux
path: .sysroot/linux.tar.gz
key: ${{ steps.cache-linux-sysroot.outputs.cache-primary-key }}
build:
runs-on: ubuntu-latest
needs: [populate-darwin-sysroot, populate-linux-sysroot]
@@ -66,16 +72,19 @@ jobs:
id: cache-macos-sysroot
uses: actions/cache/restore@v4
with:
path: .sysroot/darwin
key: darwin-sysroot-${{ hashFiles('.github/workflows/populate_darwin_sysroot.sh') }}-0.0.1
path: .sysroot/darwin.tar.gz
key: darwin-sysroot-${{ hashFiles('.github/workflows/populate_darwin_sysroot.sh') }}-0.0.2
- name: Restore Linux sysroot cache
id: cache-linux-sysroot
uses: actions/cache/restore@v4
with:
path: .sysroot/linux
key: linux-sysroot-${{ hashFiles('.github/workflows/populate_linux_sysroot.sh') }}-0.0.1
- name: Check .sysroot
path: .sysroot/linux.tar.gz
key: linux-sysroot-${{ hashFiles('.github/workflows/populate_linux_sysroot.sh') }}-0.0.2
- name: Extract sysroots
run: |
mkdir -p .sysroot
if [ -f .sysroot/darwin.tar.gz ]; then tar -xzvf .sysroot/darwin.tar.gz -C .sysroot; fi
if [ -f .sysroot/linux.tar.gz ]; then tar -xzvf .sysroot/linux.tar.gz -C .sysroot; fi
ls -la .sysroot
tree .sysroot
- name: Set up QEMU
@@ -180,7 +189,7 @@ jobs:
echo "Looking for ${{ matrix.goos }}_${{ matrix.goarch }} archive..."
ARCHIVE=$(ls *.tar.gz | head -n1)
mkdir -p release-llgo
tar -xzf "$ARCHIVE" -C release-llgo
tar -xzvf "$ARCHIVE" -C release-llgo
ls -la release-llgo/
echo "${{ github.workspace }}/release-llgo/bin/" >> $GITHUB_PATH
@@ -211,14 +220,19 @@ jobs:
id: cache-macos-sysroot
uses: actions/cache/restore@v4
with:
path: .sysroot/darwin
key: darwin-sysroot-${{ hashFiles('.github/workflows/populate_darwin_sysroot.sh') }}-0.0.1
path: .sysroot/darwin.tar.gz
key: darwin-sysroot-${{ hashFiles('.github/workflows/populate_darwin_sysroot.sh') }}-0.0.2
- name: Restore Linux sysroot cache
id: cache-linux-sysroot
uses: actions/cache/restore@v4
with:
path: .sysroot/linux
key: linux-sysroot-${{ hashFiles('.github/workflows/populate_linux_sysroot.sh') }}-0.0.1
path: .sysroot/linux.tar.gz
key: linux-sysroot-${{ hashFiles('.github/workflows/populate_linux_sysroot.sh') }}-0.0.2
- name: Extract sysroots
run: |
mkdir -p .sysroot
if [ -f .sysroot/darwin.tar.gz ]; then tar -xzvf .sysroot/darwin.tar.gz -C .sysroot; fi
if [ -f .sysroot/linux.tar.gz ]; then tar -xzvf .sysroot/linux.tar.gz -C .sysroot; fi
- name: Run GoReleaser (Release)
env:
GITHUB_TOKEN: ${{github.token}}