From efe17da5940f720e1991fdc71248bd41168aa34a Mon Sep 17 00:00:00 2001 From: nohehf Date: Tue, 24 Sep 2024 14:11:59 +0200 Subject: [PATCH] chore: refactor github workflows and makefile --- .github/workflows/build-test.yaml | 3 ++ .github/workflows/lint-report.yaml | 39 ------------------- .github/workflows/lint.yaml | 20 ++++++++++ .../{release-binaries.yaml => release.yaml} | 0 .github/workflows/report-card.yaml | 17 -------- Makefile | 5 +++ 6 files changed, 28 insertions(+), 56 deletions(-) delete mode 100644 .github/workflows/lint-report.yaml create mode 100644 .github/workflows/lint.yaml rename .github/workflows/{release-binaries.yaml => release.yaml} (100%) delete mode 100644 .github/workflows/report-card.yaml diff --git a/.github/workflows/build-test.yaml b/.github/workflows/build-test.yaml index 3213733..cae56b9 100644 --- a/.github/workflows/build-test.yaml +++ b/.github/workflows/build-test.yaml @@ -22,6 +22,9 @@ jobs: - name: Check out code uses: actions/checkout@v3 + + - name: Setup deps + run: make setup - name: Go Mod hygine run: | diff --git a/.github/workflows/lint-report.yaml b/.github/workflows/lint-report.yaml deleted file mode 100644 index 2b91679..0000000 --- a/.github/workflows/lint-report.yaml +++ /dev/null @@ -1,39 +0,0 @@ -name: Lint report - -on: - pull_request: - paths: - - "**.go" - workflow_dispatch: - -jobs: - report: - name: Report - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-go@v3 - with: - go-version: "1.22" - - name: Install report card - run: | - git clone https://github.com/gojp/goreportcard.git - cd goreportcard - make install - go install ./cmd/goreportcard-cli - cd .. - rm -rf goreportcard - - name: Report - run: goreportcard-cli -v -t 100 - - golangci-lint: - name: Lint (golangci-lint) - runs-on: ubuntu-latest - steps: - - uses: actions/setup-go@v4 - with: - go-version: "1.22" - cache: false - - uses: actions/checkout@v3 - - name: golangci-lint - uses: golangci/golangci-lint-action@v3 diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml new file mode 100644 index 0000000..7947713 --- /dev/null +++ b/.github/workflows/lint.yaml @@ -0,0 +1,20 @@ +name: Lint report + +on: + pull_request: + paths: + - "**.go" + workflow_dispatch: + +jobs: + golangci-lint: + name: Lint (golangci-lint) + runs-on: ubuntu-latest + steps: + - uses: actions/setup-go@v4 + with: + go-version: "1.22" + cache: false + - uses: actions/checkout@v3 + - name: golangci-lint + uses: golangci/golangci-lint-action@v3 diff --git a/.github/workflows/release-binaries.yaml b/.github/workflows/release.yaml similarity index 100% rename from .github/workflows/release-binaries.yaml rename to .github/workflows/release.yaml diff --git a/.github/workflows/report-card.yaml b/.github/workflows/report-card.yaml deleted file mode 100644 index 5fb590d..0000000 --- a/.github/workflows/report-card.yaml +++ /dev/null @@ -1,17 +0,0 @@ -# update report card on push on main -name: 🧚‍♀️ Update Report Card - -on: - push: - branches: - - main - workflow_dispatch: - -jobs: - report-card: - name: Update Report Card - runs-on: ubuntu-latest - steps: - - name: Request Report Update - run: | - curl -X POST -F "repo=github.com/$GITHUB_REPOSITORY" https://goreportcard.com/checks diff --git a/Makefile b/Makefile index de923e4..4d3268d 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,11 @@ .PHONY: all all: lint generate pre-build build test +# Install deps +.PHONY: setup +setup: + go install golang.org/x/tools/cmd/stringer@latest + .PHONY: lint lint: go run github.com/golangci/golangci-lint/cmd/golangci-lint@v1.61.0 run --fast -- $(go list -f '{{.Dir}}/...' -m)