From f44ef832e78302698ce4186bb93d12c1ede3c407 Mon Sep 17 00:00:00 2001 From: Max Date: Thu, 4 Jul 2024 13:25:26 +0800 Subject: [PATCH] refactor: Update Go setup action to version 5 --- .github/workflows/pr-test.yml | 38 ++++++++++++++++++++------------- .github/workflows/unit-test.yml | 37 ++++++++++++++++++++------------ 2 files changed, 46 insertions(+), 29 deletions(-) diff --git a/.github/workflows/pr-test.yml b/.github/workflows/pr-test.yml index 22122544df..1082f65fdd 100644 --- a/.github/workflows/pr-test.yml +++ b/.github/workflows/pr-test.yml @@ -122,16 +122,6 @@ jobs: body: 'Thank you for the PR! The db: ${{ matrix.db }} redis: ${{ matrix.redis }} mongo: ${{ matrix.mongo }} test workflow is running, the results of the run will be commented later.' }); - - name: Setup Cache - uses: actions/cache@v4 - with: - path: | - ~/.cache/go-build - ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- - - name: Checkout Kun uses: actions/checkout@v4 with: @@ -206,6 +196,29 @@ jobs: with: redis-version: ${{ matrix.redis }} + - name: Setup Go ${{ matrix.go }} + uses: actions/setup-go@v5 + with: + go-version: ${{ matrix.go }} + + - name: Setup Cache + uses: actions/cache@v4 + with: + path: | + ~/.cache/go-build + ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + + - name: Install dependencies + run: | + go mod download + cd ../kun && go mod download + cd ../xun && go mod download + cd ../gou && go mod download + cd ../v8go && go mod download + - name: Start MongoDB uses: supercharge/mongodb-github-action@1.8.0 with: @@ -231,11 +244,6 @@ jobs: user: "xiang" password: ${{ secrets.UNIT_PASS }} - - name: Setup Go ${{ matrix.go }} - uses: actions/setup-go@v5 - with: - go-version: ${{ matrix.go }} - - name: Setup Go Tools run: | make tools diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index 90629ceb60..18b7ade2f4 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -79,15 +79,6 @@ jobs: redis: [4, 5, 6] mongo: ["6.0"] steps: - - name: Setup Cache - uses: actions/cache@v4 - with: - path: | - ~/.cache/go-build - ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- - name: Checkout Kun uses: actions/checkout@v4 @@ -156,6 +147,29 @@ jobs: - name: Checkout Code uses: actions/checkout@v4 + - name: Setup Go ${{ matrix.go }} + uses: actions/setup-go@v5 + with: + go-version: ${{ matrix.go }} + + - name: Setup Cache + uses: actions/cache@v4 + with: + path: | + ~/.cache/go-build + ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + + - name: Install dependencies + run: | + go mod download + cd ../kun && go mod download + cd ../xun && go mod download + cd ../gou && go mod download + cd ../v8go && go mod download + - name: Start Redis uses: supercharge/redis-github-action@1.4.0 with: @@ -186,11 +200,6 @@ jobs: user: "xiang" password: ${{ secrets.UNIT_PASS }} - - name: Setup Go ${{ matrix.go }} - uses: actions/setup-go@v5 - with: - go-version: ${{ matrix.go }} - - name: Setup Go Tools run: | make tools