Skip to content

Commit

Permalink
Create a new github job, extract all non lint checks (#4888)
Browse files Browse the repository at this point in the history
* Create a new github job, extract all non lint checks

Separate goporto in a step that checks for changes, since the command change the code.

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>

* Update Makefile

Co-authored-by: Dmitrii Anoshin <anoshindx@gmail.com>

Co-authored-by: Dmitrii Anoshin <anoshindx@gmail.com>
  • Loading branch information
Bogdan Drutu and dmitryax authored Feb 22, 2022
1 parent 8bcb5f0 commit 8fa0a81
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 10 deletions.
49 changes: 44 additions & 5 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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`; \
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion Makefile.Common
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ lint-unstable:

.PHONY: porto
porto:
porto -w --include-internal ./
porto -w --include-internal ./

.PHONY: impi
impi:
Expand Down

0 comments on commit 8fa0a81

Please sign in to comment.