From df951023b2d44e66d9e2aaa0a010f16dcc61c185 Mon Sep 17 00:00:00 2001 From: danijelTxFusion Date: Fri, 22 Dec 2023 05:21:14 +0100 Subject: [PATCH] ci: fix validation and test workflows --- .github/workflows/test.yml | 6 ++---- .github/workflows/validate.yml | 24 +++++++++++------------- 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f8ac317..c0cf1f6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -18,11 +18,9 @@ jobs: with: fetch-depth: 0 - name: Install Go - uses: actions/setup-go@v5.0.0 - with: - go-version: 1.20 + uses: actions/setup-go@v4.0.0 - name: Install dependencies - run: go mod tidy + run: go mod download - name: Run local-setup run: | git clone https://github.com/matter-labs/local-setup.git diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index b301a09..cebec0c 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -17,21 +17,19 @@ jobs: with: fetch-depth: 0 - name: Install Go - uses: actions/setup-go@v5.0.0 - with: - go-version: 1.20 + uses: actions/setup-go@v4.0.0 - name: Run gofmt run: | - echo "Checking code formatting..." - gofmt -d -e . - - name: Run golangci-lint - run: | - echo "Running linter..." - go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest - golangci-lint run ./... - - name: Fail if issues found - run: exit 1 - if: ${{ failure() || success() }} + fmt_output=$(gofmt -l .) + + if [ -n "$fmt_output" ]; then + echo "Code not formatted correctly:" + echo "$fmt_output" + exit 1 + else + echo "Code is formatted correctly" + exit 0 + fi commits: name: Check commits runs-on: ubuntu-latest