diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 7d9af884a13..181c9734edc 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -64,12 +64,51 @@ jobs: with: path: /home/runner/go/bin key: tools-${{ runner.os }}-${{ hashFiles('./internal/tools/go.mod', './cmd/mdatagen/go.mod', './cmd/mdatagen/*.go') }} - - name: Lint - run: make -j5 checklicense misspell checkdoc goimpi golint goporto - - name: Gen Metadata + - name: golint + run: make -j2 golint + - name: goimpi + run: make goimpi + + checks: + runs-on: ubuntu-latest + needs: [setup-environment] + steps: + - name: Checkout Repo + uses: actions/checkout@v2 + - name: Setup Go + uses: actions/setup-go@v2.2.0 + with: + go-version: 1.17 + - name: Setup Go Environment + run: | + echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV + echo "$(go env GOPATH)/bin" >> $GITHUB_PATH + - name: Cache Go + id: module-cache + uses: actions/cache@v2 + with: + path: /home/runner/go/pkg/mod + key: go-pkg-mod-${{ runner.os }}-${{ hashFiles('**/go.sum') }} + - name: Cache Tools + id: tool-cache + uses: actions/cache@v2 + with: + path: /home/runner/go/bin + key: tools-${{ runner.os }}-${{ hashFiles('./internal/tools/go.mod', './cmd/mdatagen/go.mod', './cmd/mdatagen/*.go') }} + - name: checklicense + run: make checklicense + - name: misspell + run: make misspell + - name: checkdoc + run: make checkdoc + - name: go:porto + run: | + make goporto + git diff --exit-code || (echo 'Porto links are out of date, please run "make goporto" and commit the changes in this PR.' && exit 1) + - name: go:generate run: | - make genmdata - git diff --exit-code || (echo 'Generated code is out of date, please run "make genmdata" and commit the changes in this PR.' && exit 1) + make gogenerate + git diff --exit-code || (echo 'Generated code is out of date, please run "make gogenerate" and commit the changes in this PR.' && exit 1) - name: Gen Pdata run: | make genpdata diff --git a/Makefile b/Makefile index e0a541f0d19..5f30116e243 100644 --- a/Makefile +++ b/Makefile @@ -92,6 +92,10 @@ gotidy: $(MAKE) for-all CMD="rm -fr go.sum" $(MAKE) for-all CMD="$(GOCMD) mod tidy -compat=1.17" +.PHONY: gogenerate +gogenerate: + $(MAKE) for-all CMD="$(GOCMD) generate ./..." + .PHONY: addlicense addlicense: @ADDLICENSEOUT=`$(ADDLICENSE) -y "" -c "The OpenTelemetry Authors" $(ALL_SRC) 2>&1`; \ @@ -199,10 +203,6 @@ otelcorecol: genotelcorecol: pushd cmd/builder/ && $(GOCMD) run ./ --skip-compilation --config ../otelcorecol/builder-config.yaml --output-path ../otelcorecol && popd -.PHONY: genmdata -genmdata: - $(MAKE) for-all CMD="$(GOCMD) generate ./..." - DEPENDABOT_PATH=".github/dependabot.yml" .PHONY: internal-gendependabot internal-gendependabot: diff --git a/Makefile.Common b/Makefile.Common index 8a9203cfa1c..e4c71bc6f23 100644 --- a/Makefile.Common +++ b/Makefile.Common @@ -41,7 +41,7 @@ lint-unstable: .PHONY: porto porto: - porto -w --include-internal ./ + porto -w --include-internal ./ .PHONY: impi impi: