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

Improve lint, build, CI, and release process #42

Merged
merged 11 commits into from
Sep 21, 2023

Conversation

cdzombak
Copy link
Owner

@cdzombak cdzombak commented Sep 20, 2023

Motivated by recent work with Docker and GitHub Actions on a personal project, plus this repo's insistence on trying to push PR branches to Docker, I've revamped how this repo is versioned, linted, built, and released:

  • The program now has a version number, injected during the build process and viewable with the -version flag.
  • A Makefile has been added to assist in local development and CI. It prints documentation if you run make with no targets or make help.
  • The CI lint-and-build process runs on all pushes to main, v*.*.* tags, and PRs.
  • PRs are now linted, and binaries, .debs, and Docker images are built. PR build products are not released anywhere.
  • GitHub releases happen automatically when a vX.Y.Z tag is pushed. Binaries and .debs are attached.
    • Tags like vX.Y.Z-alpha.A, -beta.B, and -rc.N are also supported. These generate a GitHub prerelease.
    • Released (not prereleased) Debian packages are pushed to PackageCloud.
    • Lint failures block releases from happening.
  • Docker images are pushed to Docker Hub and GHCR:
    • On every release: the tags latest, X.Y.Z, X.Y, and X are pushed
    • On pushes to main: the main tag is pushed
    • The README is updated in Docker Hub on every release
  • All source in the repo now passes a battery of lint checks.
  • The Dockerfile now uses a two stage build, resulting in a tiny final image. A variety of labels including metadata are added.
  • Sample configuration files are renamed.
  • Various other minor changes.

@cdzombak
Copy link
Owner Author

@ablyler can you take a look at this when you have time? 🙇🏻

@github-actions
Copy link

github-actions bot commented Sep 20, 2023

🦙 MegaLinter status: ✅ SUCCESS

Descriptor Linter Files Fixed Errors Elapsed time
✅ ACTION actionlint 1 0 0.24s
✅ BASH bash-exec 1 0 0.0s
✅ BASH shellcheck 1 0 0.02s
✅ BASH shfmt 1 0 0 0.04s
✅ DOCKERFILELINT dockerfilelint 1 0 0.32s
✅ GO revive 1 0 1.02s
✅ JSON eslint-plugin-jsonc 1 0 0 1.32s
✅ JSON jsonlint 1 0 0.27s
✅ JSON prettier 1 0 0 0.4s
✅ JSON v8r 1 0 1.8s
✅ MARKDOWN markdownlint 1 1 0 0.93s
✅ MARKDOWN markdown-link-check 1 0 2.53s
✅ MARKDOWN markdown-table-formatter 1 1 0 0.46s
✅ MDLINKCHECK linkcheck 1 0 0 2.7s
✅ YAML prettier 4 2 0 0.61s
✅ YAML v8r 4 0 5.6s
✅ YAML yamllint 4 0 0.43s

See detailed report in MegaLinter reports

You could have same capabilities but better runtime performances if you request a new MegaLinter flavor.

MegaLinter is graciously provided by OX Security

@cdzombak cdzombak force-pushed the cdz/lint-build-push-process branch from f69aff9 to 2519520 Compare September 20, 2023 21:25
@cdzombak
Copy link
Owner Author

cdzombak commented Sep 21, 2023

One unknown: when running the minimal from-scratch Docker image, will TLS validation be a problem for the Ecobee API / if anyone is running InfluxDB with TLS?

@cdzombak
Copy link
Owner Author

@theonlytruebigmac curious to hear any input you have on this, too 🙇🏻

Copy link
Collaborator

@ablyler ablyler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great to me! Very nice improvements!

@ablyler
Copy link
Collaborator

ablyler commented Sep 21, 2023

One unknown: when running the minimal from-scratch Docker image, will TLS validation be a problem for the Ecobee API / if anyone is running InfluxDB with TLS?

I'll try to build the docker image and run it against this branch. I do not have TLS enabled for InfluxDB, but I can test the Ecobee API.

Signed-off-by: Andy Blyler <andy@blyler.cc>
Signed-off-by: Andy Blyler <andy@blyler.cc>
@ablyler
Copy link
Collaborator

ablyler commented Sep 21, 2023

I had to make some minor changes to get the docker image to work correctly, including adding the ca certs. It works on my machine now. 👍

@cdzombak
Copy link
Owner Author

@ablyler awesome, thanks!

Next year's first (planned) Big House Expense is likely going to be new HVAC, and then I'll have an Ecobee to test with again ;)

@cdzombak cdzombak merged commit ed8cce0 into main Sep 21, 2023
@cdzombak cdzombak deleted the cdz/lint-build-push-process branch September 21, 2023 14:19
@cdzombak
Copy link
Owner Author

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