ci(release test):cache key to env
This commit is contained in:
11
.github/actions/setup-goreleaser/action.yml
vendored
11
.github/actions/setup-goreleaser/action.yml
vendored
@@ -1,5 +1,12 @@
|
|||||||
name: "Setup GoReleaser"
|
name: "Setup GoReleaser"
|
||||||
description: "Setup GoReleaser environment"
|
description: "Setup GoReleaser environment"
|
||||||
|
inputs:
|
||||||
|
darwin-cache-key:
|
||||||
|
description: "Darwin sysroot cache key"
|
||||||
|
required: true
|
||||||
|
linux-cache-key:
|
||||||
|
description: "Linux sysroot cache key"
|
||||||
|
required: true
|
||||||
runs:
|
runs:
|
||||||
using: "composite"
|
using: "composite"
|
||||||
steps:
|
steps:
|
||||||
@@ -12,13 +19,13 @@ runs:
|
|||||||
uses: actions/cache/restore@v4
|
uses: actions/cache/restore@v4
|
||||||
with:
|
with:
|
||||||
path: .sysroot/darwin.tar.gz
|
path: .sysroot/darwin.tar.gz
|
||||||
key: darwin-sysroot-${{ hashFiles('.github/workflows/populate_darwin_sysroot.sh') }}-0.0.5
|
key: ${{ inputs.darwin-cache-key }}
|
||||||
- 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.tar.gz
|
path: .sysroot/linux.tar.gz
|
||||||
key: linux-sysroot-${{ hashFiles('.github/workflows/populate_linux_sysroot.sh') }}-0.0.7
|
key: ${{ inputs.linux-cache-key }}
|
||||||
- name: Populate Darwin sysroot
|
- name: Populate Darwin sysroot
|
||||||
run: tar -xzvf .sysroot/darwin.tar.gz -C .sysroot
|
run: tar -xzvf .sysroot/darwin.tar.gz -C .sysroot
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|||||||
36
.github/workflows/release-build.yml
vendored
36
.github/workflows/release-build.yml
vendored
@@ -8,8 +8,25 @@ on:
|
|||||||
branches: ["**"]
|
branches: ["**"]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
setup:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
darwin-cache-key: ${{ steps.cache-keys.outputs.darwin-key }}
|
||||||
|
linux-cache-key: ${{ steps.cache-keys.outputs.linux-key }}
|
||||||
|
steps:
|
||||||
|
- name: Check out code
|
||||||
|
uses: actions/checkout@v5
|
||||||
|
- name: Calculate cache keys
|
||||||
|
id: cache-keys
|
||||||
|
run: |
|
||||||
|
DARWIN_KEY="darwin-sysroot-${{ hashFiles('.github/workflows/populate_darwin_sysroot.sh') }}-0.0.5"
|
||||||
|
LINUX_KEY="linux-sysroot-${{ hashFiles('.github/workflows/populate_linux_sysroot.sh') }}-0.0.7"
|
||||||
|
echo "darwin-key=$DARWIN_KEY" >> $GITHUB_OUTPUT
|
||||||
|
echo "linux-key=$LINUX_KEY" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
populate-darwin-sysroot:
|
populate-darwin-sysroot:
|
||||||
runs-on: macos-latest
|
runs-on: macos-latest
|
||||||
|
needs: setup
|
||||||
steps:
|
steps:
|
||||||
- name: Check out code
|
- name: Check out code
|
||||||
uses: actions/checkout@v5
|
uses: actions/checkout@v5
|
||||||
@@ -18,7 +35,7 @@ jobs:
|
|||||||
uses: actions/cache/restore@v4
|
uses: actions/cache/restore@v4
|
||||||
with:
|
with:
|
||||||
path: .sysroot/darwin.tar.gz
|
path: .sysroot/darwin.tar.gz
|
||||||
key: darwin-sysroot-${{ hashFiles('.github/workflows/populate_darwin_sysroot.sh') }}-0.0.5
|
key: ${{ needs.setup.outputs.darwin-cache-key }}
|
||||||
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'
|
||||||
@@ -31,9 +48,10 @@ jobs:
|
|||||||
uses: actions/cache/save@v4
|
uses: actions/cache/save@v4
|
||||||
with:
|
with:
|
||||||
path: .sysroot/darwin.tar.gz
|
path: .sysroot/darwin.tar.gz
|
||||||
key: darwin-sysroot-${{ hashFiles('.github/workflows/populate_darwin_sysroot.sh') }}-0.0.5
|
key: ${{ needs.setup.outputs.darwin-cache-key }}
|
||||||
populate-linux-sysroot:
|
populate-linux-sysroot:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
needs: setup
|
||||||
steps:
|
steps:
|
||||||
- name: Check out code
|
- name: Check out code
|
||||||
uses: actions/checkout@v5
|
uses: actions/checkout@v5
|
||||||
@@ -42,7 +60,7 @@ jobs:
|
|||||||
uses: actions/cache/restore@v4
|
uses: actions/cache/restore@v4
|
||||||
with:
|
with:
|
||||||
path: .sysroot/linux.tar.gz
|
path: .sysroot/linux.tar.gz
|
||||||
key: linux-sysroot-${{ hashFiles('.github/workflows/populate_linux_sysroot.sh') }}-0.0.7
|
key: ${{ needs.setup.outputs.linux-cache-key }}
|
||||||
lookup-only: true
|
lookup-only: true
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v3
|
uses: docker/setup-qemu-action@v3
|
||||||
@@ -60,15 +78,18 @@ jobs:
|
|||||||
uses: actions/cache/save@v4
|
uses: actions/cache/save@v4
|
||||||
with:
|
with:
|
||||||
path: .sysroot/linux.tar.gz
|
path: .sysroot/linux.tar.gz
|
||||||
key: linux-sysroot-${{ hashFiles('.github/workflows/populate_linux_sysroot.sh') }}-0.0.7
|
key: ${{ needs.setup.outputs.linux-cache-key }}
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [populate-darwin-sysroot, populate-linux-sysroot]
|
needs: [setup, populate-darwin-sysroot, populate-linux-sysroot]
|
||||||
steps:
|
steps:
|
||||||
- name: Check out code
|
- name: Check out code
|
||||||
uses: actions/checkout@v5
|
uses: actions/checkout@v5
|
||||||
- name: Set up Release
|
- name: Set up Release
|
||||||
uses: ./.github/actions/setup-goreleaser
|
uses: ./.github/actions/setup-goreleaser
|
||||||
|
with:
|
||||||
|
darwin-cache-key: ${{ needs.setup.outputs.darwin-cache-key }}
|
||||||
|
linux-cache-key: ${{ needs.setup.outputs.linux-cache-key }}
|
||||||
- name: Run GoReleaser (Build & Test)
|
- name: Run GoReleaser (Build & Test)
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{github.token}}
|
GITHUB_TOKEN: ${{github.token}}
|
||||||
@@ -178,7 +199,7 @@ jobs:
|
|||||||
mod-version: ${{ matrix.go-mod-version }}
|
mod-version: ${{ matrix.go-mod-version }}
|
||||||
|
|
||||||
release:
|
release:
|
||||||
needs: [build, test-artifacts]
|
needs: [setup, build, test-artifacts]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
steps:
|
steps:
|
||||||
@@ -188,6 +209,9 @@ jobs:
|
|||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- name: Set up Release
|
- name: Set up Release
|
||||||
uses: ./.github/actions/setup-goreleaser
|
uses: ./.github/actions/setup-goreleaser
|
||||||
|
with:
|
||||||
|
darwin-cache-key: ${{ needs.setup.outputs.darwin-cache-key }}
|
||||||
|
linux-cache-key: ${{ needs.setup.outputs.linux-cache-key }}
|
||||||
- name: Run GoReleaser (Release)
|
- name: Run GoReleaser (Release)
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{github.token}}
|
GITHUB_TOKEN: ${{github.token}}
|
||||||
|
|||||||
Reference in New Issue
Block a user