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

add devenv to simplify local dev and ci #213

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

sebastianwebber
Copy link
Contributor

@sebastianwebber sebastianwebber commented Sep 10, 2024

TL;DR; this PR uses a tool called https://devenv.sh that adds support to run the ci tasks locally.

Changes

What it does:

  • builds the go app with nix
  • builds the go with gomod2nix
  • add pre-commits checks like:
    • govet
    • golangci-lint
    • go tests
  • have all ci actions run though devenv

What is missing:

  • fix the vpc error that is not related
  • update the branch protection rules to reflect the new job names

what is optional but cool:

  • build docker images using same binary built
  • build multi-arch images for x86_64 and aarch64
  • push images to the registry

Usage

Important

The pre-commit hooks will prevent committing if they fail.
image

Start by installing devenv: https://devenv.sh/getting-started/

to build the packages:

devenv build

to run tests and all pre-commit checks:

devenv test

to run a dev environment with all tools installed and configured:

devenv shell

TODO:

  • update readme with details about how to use it and install it at the read me
  • remove docker image that is not useful/necessary

@sebastianwebber sebastianwebber force-pushed the sebastian/improve-ci-with-nix branch 10 times, most recently from c08d2f5 to aa7e282 Compare September 10, 2024 02:15
@sebastianwebber sebastianwebber force-pushed the sebastian/improve-ci-with-nix branch from aa7e282 to 8c4c22b Compare September 10, 2024 02:21
Signed-off-by: Sebastian Webber <[email protected]>
Signed-off-by: Sebastian Webber <[email protected]>
@sebastianwebber sebastianwebber force-pushed the sebastian/improve-ci-with-nix branch 4 times, most recently from 2aa4fdf to 0e6aa7c Compare September 10, 2024 04:01
Signed-off-by: Sebastian Webber <[email protected]>
@sebastianwebber sebastianwebber force-pushed the sebastian/improve-ci-with-nix branch from 0e6aa7c to 32b2bc2 Compare September 10, 2024 04:09
@sebastianwebber sebastianwebber force-pushed the sebastian/improve-ci-with-nix branch 2 times, most recently from 66cbd52 to 1ba15f4 Compare September 10, 2024 15:00
Signed-off-by: Sebastian Webber <[email protected]>
@sebastianwebber sebastianwebber force-pushed the sebastian/improve-ci-with-nix branch from 1ba15f4 to 2c02b99 Compare September 10, 2024 15:08
Signed-off-by: Sebastian Webber <[email protected]>
both outputs to build the app and the docker image

Signed-off-by: Sebastian Webber <[email protected]>
@sebastianwebber sebastianwebber force-pushed the sebastian/improve-ci-with-nix branch 3 times, most recently from 425ce15 to f834437 Compare September 12, 2024 03:51
Signed-off-by: Sebastian Webber <[email protected]>
@sebastianwebber sebastianwebber force-pushed the sebastian/improve-ci-with-nix branch 6 times, most recently from be9bc87 to 69a08db Compare September 12, 2024 04:54
@Khyme
Copy link
Contributor

Khyme commented Sep 16, 2024

Sounds great 🤩

@sebastianwebber sebastianwebber marked this pull request as ready for review October 17, 2024 17:48
@sebastianwebber sebastianwebber requested review from a team as code owners October 17, 2024 17:48
@sebastianwebber sebastianwebber force-pushed the sebastian/improve-ci-with-nix branch from 69a08db to 0e7d8dc Compare October 17, 2024 17:57
Signed-off-by: Sebastian Webber <[email protected]>
@sebastianwebber sebastianwebber force-pushed the sebastian/improve-ci-with-nix branch from 0e7d8dc to a546994 Compare October 18, 2024 15:20
Copy link
Contributor

@minkimipt minkimipt left a comment

Choose a reason for hiding this comment

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

I asked a few questions and the conflict in the main.go need to be resolved. Do you think we should do that while we are doing the release with all those fixes? It doesn't look that CI change is going to help with any of those. What do you think of making a release and changing the CI afterwards independently?

.github/workflows/test.yml Outdated Show resolved Hide resolved

outputs = let
name = "terraform-provider-timescale";
version = "1.11.0";
Copy link
Contributor

Choose a reason for hiding this comment

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

can version be parametrised based on the tag? Do we have to remember updating it here every time when a new tag is released?

@@ -0,0 +1,240 @@
schema = 3
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess it's a generated file. Does it need to be re-generated every time something in go.mod changes?

@@ -0,0 +1,17 @@
{ pkgs, app, name, version, ... }:
pkgs.dockerTools.buildImage {
Copy link
Contributor

Choose a reason for hiding this comment

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

how is docker used in this repo? We are not building any containers here. Is it required here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it is not, just leaving as example. we may remove if you think that is a problem.

Signed-off-by: Sebastian Webber <[email protected]>
@sebastianwebber sebastianwebber force-pushed the sebastian/improve-ci-with-nix branch from 8ab6b57 to f6583cc Compare October 21, 2024 13:47
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.

3 participants