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