From 6fae35246ed02edbc28676626c0802355fcf4a4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jun=20Xiang=20=28=E3=82=AB=E3=82=A8=E3=83=87=29?= Date: Thu, 3 Oct 2024 22:04:23 +0800 Subject: [PATCH] ci: Cache golang builds (#151) * ci: Cache golang builds Signed-off-by: AlexNg * style: Fix linting errors Signed-off-by: AlexNg --------- Signed-off-by: AlexNg --- .github/workflows/linting.yml | 10 ++++++++++ .github/workflows/release.yml | 9 +++++++++ .github/workflows/test-worker.yml | 9 +++++++++ cmd/commands/healthcheck.go | 2 +- 4 files changed, 29 insertions(+), 1 deletion(-) diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index 20c400a..5ae02ef 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -65,6 +65,16 @@ jobs: with: go-version: stable + - name: Cache + uses: actions/cache@v4 + with: + path: | + ~/.cache/go-build + ~/.cache/golangci-lint + /go/pkg/mod + key: golint-${{ hashFiles('go.sum') }} + restore-keys: golint + - name: Lint run: | set -xe diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a8cf1cd..3f91721 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -31,6 +31,15 @@ jobs: with: go-version: stable + - name: Restore cache + uses: actions/cache/restore@v4 + with: + path: | + ~/.cache/go-build + /go/pkg/mod + key: go-${{ runner.os }}-${{ hashFiles('go.sum') }} + restore-keys: go-${{ runner.os }} + - name: Set up QEMU uses: docker/setup-qemu-action@v3 diff --git a/.github/workflows/test-worker.yml b/.github/workflows/test-worker.yml index 7ccd1ec..59684ec 100644 --- a/.github/workflows/test-worker.yml +++ b/.github/workflows/test-worker.yml @@ -69,6 +69,15 @@ jobs: with: go-version: stable + - name: Cache + uses: actions/cache@v4 + with: + path: | + ~/.cache/go-build + /go/pkg/mod + key: go-${{ runner.os }}-${{ hashFiles('go.sum') }} + restore-keys: go-${{ runner.os }} + - name: Test run: | set -xe diff --git a/cmd/commands/healthcheck.go b/cmd/commands/healthcheck.go index 711d6ea..604b230 100644 --- a/cmd/commands/healthcheck.go +++ b/cmd/commands/healthcheck.go @@ -15,7 +15,7 @@ var HealthcheckCmd = &cobra.Command{ SilenceErrors: true, RunE: func(cmd *cobra.Command, args []string) error { if err := exec.Command("git", "--version").Run(); err != nil { - return e.NewWakuErrorf(err.Error()) + return e.NewWakuErrorf("%v", err) } return nil