Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disaggregate consumer linting for full coverage #36

Open
wants to merge 1 commit into
base: devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 41 additions & 2 deletions .github/workflows/consuming.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,47 @@ jobs:
- name: Make sure ${{ matrix.project }} is using the built Shipyard image
run: sed -i 's/shipyard-dapper-base:*.*/shipyard-dapper-base:dev/' ${{ matrix.project }}/Dockerfile.dapper

- name: Run all linters
run: make -C ${{ matrix.project }} lint
- name: Run gitlint
if: always()
run: make -C ${{ matrix.project }} gitlint

- name: Run golangci-lint
if: ${{ always() && matrix.project != 'submariner-charts' }}
run: make -C ${{ matrix.project }} golangci-lint

- name: Run markdownlint
if: always()
run: make -C ${{ matrix.project }} markdownlint

- name: Run packagedoc-lint
if: >-
${{
always()
&& matrix.project != 'cloud-prepare'
&& matrix.project != 'coastguard'
&& matrix.project != 'lighthouse'
&& matrix.project != 'submariner-charts'
&& matrix.project != 'submariner-operator'
}}
run: make -C ${{ matrix.project }} packagedoc-lint

- name: Run shellcheck
if: >-
${{
always()
&& matrix.project != 'admiral'
&& matrix.project != 'cloud-prepare'
&& matrix.project != 'coastguard'
&& matrix.project != 'lighthouse'
&& matrix.project != 'submariner'
&& matrix.project != 'submariner-charts'
&& matrix.project != 'submariner-operator'
}}
run: make -C ${{ matrix.project }} shellcheck

- name: Run yamllint
if: ${{ always() && matrix.project != 'submariner-charts' }}
run: make -C ${{ matrix.project }} yamllint

unit-consuming:
name: Unit Tests
Expand Down
20 changes: 9 additions & 11 deletions Makefile.inc
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ deploy-latest:
$(MAKE) -o images -o preload-images deploy SUBCTL=~/.local/bin/subctl DEV_VERSION=latest CUTTING_EDGE=latest VERSION=latest DEPLOY_ARGS="$(DEPLOY_ARGS) --image_tag=subctl" using=$(using)

##### LINTING TARGETS #####
.PHONY: gitlint golangci-lint lint markdownlint packagedoc-lint shellcheck yamllint
.PHONY: gitlint golangci-lint markdownlint packagedoc-lint shellcheck yamllint

# [gitlint] validates the commits are valid
gitlint:
Expand All @@ -166,6 +166,14 @@ golangci-lint: $(VENDOR_MODULES)
golangci-lint linters
golangci-lint run --timeout 10m

# [markdownlint] validates Markdown files in the project
markdownlint:
md_ignored=($(patsubst %/modules.txt,%,$(VENDOR_MODULES))); \
if [ -r .mdignore ]; then \
md_ignored+=($$(< .mdignore)); \
fi; \
markdownlint -c .markdownlint.yml $${md_ignored[@]/#/-i } .

# [packagedoc-lint] checks that the package docs don’t include the SPDX header
packagedoc-lint:
result=0; \
Expand All @@ -177,16 +185,6 @@ packagedoc-lint:
done 2>/dev/null; \
exit $$result

lint: gitlint golangci-lint markdownlint yamllint

# [markdownlint] validates Markdown files in the project
markdownlint:
md_ignored=($(patsubst %/modules.txt,%,$(VENDOR_MODULES))); \
if [ -r .mdignore ]; then \
md_ignored+=($$(< .mdignore)); \
fi; \
markdownlint -c .markdownlint.yml $${md_ignored[@]/#/-i } .

# [shellcheck] validates your shell files
shellcheck:
shellcheck -x -P $${SCRIPTS_DIR} $(SHELLCHECK_ARGS)
Expand Down