From 16ead79b4f8c13043d152dfb46e95bff76568f29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Corrales=20Solera?= Date: Tue, 1 Mar 2022 05:58:56 +0100 Subject: [PATCH] Re-organize the repository --- .github/workflows/build.yml | 48 +++++++++++++++++++++---------------- .github/workflows/lint.yml | 26 -------------------- Makefile | 10 ++------ 3 files changed, 29 insertions(+), 55 deletions(-) delete mode 100644 .github/workflows/lint.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index aab31ae..cf1adb3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,47 +19,53 @@ jobs: uses: hadolint/hadolint-action@v1.6.0 with: dockerfile: Dockerfile + tests: + runs-on: ubuntu-latest + steps: + - uses: actions/setup-go@v2 + with: + go-version: 1.17 + - name: Clean repository + run: make clean install + - name: Run unit tests + run: make test + - name: Upload coverage + uses: actions/upload-artifact@v2 + with: + name: coverage + path: coverage.* + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v2.1.0 + with: + file: ./coverage.out + flags: ${{ runner.os }} ci: strategy: fail-fast: false matrix: os: [ ubuntu-20.04, macos-10.15, windows-2019 ] runs-on: ${{ matrix.os }} - needs: [linters] + needs: + - linters + - tests + - release-test defaults: run: shell: bash steps: - - uses: actions/checkout@v2 - - uses: actions/setup-go@v2 - with: - go-version: 1.17 - - name: Build - run: make ci - - name: Upload coverage - uses: actions/upload-artifact@v2 - with: - name: coverage - path: coverage.* - name: Upload dist uses: actions/upload-artifact@v2 with: name: dist path: dist - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v2.1.0 - with: - file: ./coverage.out - flags: ${{ runner.os }} release-test: runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 + - name: Check out code into the Go module directory + uses: actions/checkout@v2 - uses: actions/setup-go@v2 with: go-version: 1.17 - name: Release test - run: make build + run: make clean mod-tidy install build diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml deleted file mode 100644 index 404c33e..0000000 --- a/.github/workflows/lint.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: lint - -on: - push: - branches: "*" - pull_request: - branches: [ main ] - workflow_dispatch: - -jobs: - golangci-lint: - runs-on: ubuntu-latest - steps: - - name: Check out code into the Go module directory - uses: actions/checkout@v2 - - name: golangci-lint - uses: reviewdog/action-golangci-lint@v2 - hadolint: - runs-on: ubuntu-20.04 - steps: - - name: Check out code into the Go module directory - uses: actions/checkout@v2 - - name: hadolint - uses: hadolint/hadolint-action@v1.6.0 - with: - dockerfile: Dockerfile diff --git a/Makefile b/Makefile index 83341ba..5235c1d 100644 --- a/Makefile +++ b/Makefile @@ -62,20 +62,14 @@ mod-tidy: ## go mod tidy go mod tidy cd tools && go mod tidy -.PHONY: diff -diff: ## git diff - $(call print-target) - git diff --exit-code - RES=$$(git status --porcelain) ; if [ -n "$$RES" ]; then echo $$RES && exit 1 ; fi - .PHONY: build -build: ## goreleaser --snapshot --skip-publish --rm-dist +build: build: install $(call print-target) goreleaser --snapshot --skip-publish --rm-dist .PHONY: release -release: ## goreleaser --rm-dist +release: release: install $(call print-target) goreleaser --rm-dist