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

feat: Better lint and test for devs and Makefile cleanup. #511

Merged
merged 1 commit into from
Sep 25, 2023

Conversation

smoser
Copy link
Contributor

@smoser smoser commented Sep 22, 2023

This change does several things all towards the end of making
it easier for developers to run tests and lint on go code.

Now a developer can run either 'make go-test' or 'make lint'
without having lots of C dependencies or running in a specific
container or stacker.

Things changed:

  • Add a build tag 'skipembed' that builds without needing
    cmd/stacker/lxc-wrapper/lxc-wrapper . This allows you to
    build (or test) without that file. In order to ensure that
    you do not get very far trying to run a 'stacker' binary,
    I've added a 'panic' if stacker binary is built with skipembed.

  • Add download-tools target to makefile to ease in downloading of
    regctl and zot.

  • Move the downloading of golangci-lint from the github workflow
    to Makefile. This makes it easier for developer to get it.
    It is also added to the 'download-tools' target.

  • be specific about the version of golangci-lint that is used.
    1.54.2. golangci-lint's docs specifically say to do this:

    IMPORTANT: It's highly recommended installing a specific version
    of golangci-lint available on the releases page.

    changing it is simply a matter of changing the value in the makefile.

  • Move running of 'go test' out of the lint target to its own
    'go-test' target. go-test target will now write a coverage.html
    so you can view coverage easily.

  • add 'dlbin' makefile "function" for downloading binaries, and use
    that for regctl and zot from their rules.

@smoser smoser force-pushed the cleanup/test-lint-dev-friendly branch 4 times, most recently from 4a8227a to f06b501 Compare September 22, 2023 18:53
@smoser smoser force-pushed the cleanup/test-lint-dev-friendly branch from f06b501 to ea39074 Compare September 22, 2023 19:07
@codecov
Copy link

codecov bot commented Sep 22, 2023

Codecov Report

Merging #511 (af09c66) into main (3eb5cf6) will increase coverage by 11.89%.
The diff coverage is n/a.

@@            Coverage Diff            @@
##           main     #511       +/-   ##
=========================================
+ Coverage      0   11.89%   +11.89%     
=========================================
  Files         0       40       +40     
  Lines         0     5733     +5733     
=========================================
+ Hits          0      682      +682     
- Misses        0     4929     +4929     
- Partials      0      122      +122     

see 40 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@smoser smoser force-pushed the cleanup/test-lint-dev-friendly branch 2 times, most recently from 9725c91 to 934bce6 Compare September 22, 2023 21:45
This change does several things all towards the end of making
it easier for developers to run tests and lint on go code.

Now a developer can run either 'make go-test' or 'make lint'
without having lots of C dependencies or running in a specific
container or stacker.

Things changed:

 * Add a build tag 'skipembed' that builds without needing
   cmd/stacker/lxc-wrapper/lxc-wrapper . This allows you to
   build (or test) without that file.  In order to ensure that
   you do not get very far trying to run a 'stacker' binary,
   I've added a 'panic' if stacker binary is built with skipembed.

 * Add download-tools target to makefile to ease in downloading of
   regctl and zot.

 * Move the downloading of golangci-lint from the github workflow
   to Makefile.  This makes it easier for developer to get it.
   It is also added to the 'download-tools' target.

 * be specific about the version of golangci-lint that is used.
   1.54.2.  golangci-lint's docs specifically say to do this:

    > IMPORTANT: It's highly recommended installing a specific version
    > of golangci-lint available on the releases page.

   changing it is simply a matter of changing the value in the makefile.

 * Move running of 'go test' out of the lint target to its own
   'go-test' target.  go-test target will now write a hack/coverage.html
   so you can view coverage easily.

 * add 'dlbin' makefile "function" for downloading binaries, and use
   that for regctl and zot from their rules.

 * rename TOOLS_DIR to TOOLS_D (consistency with BUILD_D, and just
   shorter)

Signed-off-by: Scott Moser <smoser@brickies.net>
@smoser smoser force-pushed the cleanup/test-lint-dev-friendly branch from 934bce6 to af09c66 Compare September 25, 2023 12:51
@smoser
Copy link
Contributor Author

smoser commented Sep 25, 2023

I had to re-push to adjust a commit message comment. so af09c66 is identical to the version @rchamarthy reviewed ( 934bce6 to af09c66) but has a different git message.

the difference in the commit message was just to drop the mention of moving coverage.txt as @rchincha asked that it not be moved.

@smoser smoser merged commit 1aab90a into project-stacker:main Sep 25, 2023
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants