diff --git a/.github/workflows/pr-test.yml b/.github/workflows/pr-test.yml index 22122544d..1082f65fd 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 90629ceb6..18b7ade2f 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