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 justfile, remove coveralls #3040

Merged
merged 13 commits into from
Jan 9, 2025
Merged

Add justfile, remove coveralls #3040

merged 13 commits into from
Jan 9, 2025

Conversation

xavdid-stripe
Copy link
Member

@xavdid-stripe xavdid-stripe commented Dec 20, 2024

Why?

In an effort to modernize and simplify our local tooling, we're moving our dev commands from makefiles to justfiles. This is intended to be mostly a drop-in replacement, but some command names may change per standardization efforts.

What?

  • added justfile
  • added warning line to top of makefile
  • updated readme
  • tweaked CI to use just
  • removed all the coveralls-related code from CI
  • updated readme to mention just (& an alternative)

See Also

@xavdid-stripe xavdid-stripe changed the title add justfile Add justfile, remove coveralls Jan 7, 2025
@@ -24,6 +24,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: extractions/setup-just@v2
Copy link
Member Author

Choose a reason for hiding this comment

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

I had to allow this in repo settings. I gave the code a quick readthrough and it's super straightforward: it builds the name of a crate (extractions/setup-just | index.ts) and feeds it into another extension by the same author, which reads github releases to download the correct binary for the platform (extractions/setup-crate | index.ts).

It's the action recommended in the just README, so I feel good about it.

Copy link
Contributor

Choose a reason for hiding this comment

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

It would be nice to not have to rely on a 1 person organization for this. is there value in us forking it and using the fork? it doesn't look super complicated so I wouldn't expect it to get updated often, and having the fork gives us some stability if something changes for them

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not too worried about it, but I understand the concern. This approach takes care of supporting any platform, but given that we're only running on linux, we can probably get away with an apt-get install just (docs), which I should have thought of in the first place.

Do you feel better about that? I don't really want to be in the business of maintaining a GH action, even if it's just to check and sync our fork periodically. It just smells like maintenance we're not going to do.

Copy link
Contributor

Choose a reason for hiding this comment

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

oh right because this is just for CI. i think thats reasonable, and if we end up having to support another platform (i.e. if we have to change a runner to be a macos runner for codesigning or something) its reasonable to assume we can find a way to install just thru an os-specific official channel there too.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep, CI only. For local purposes, I can update our shared mise config and it'll "just work". 😁

Copy link
Contributor

Choose a reason for hiding this comment

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

famous last words... 😆
but yea, that sounds good to me!

.github/workflows/ci.yml Show resolved Hide resolved
.github/workflows/ci.yml Show resolved Hide resolved
@@ -320,10 +320,13 @@ go install github.com/stripe/stripe-mock@latest
stripe-mock
```

Lastly, we use [just](https://github.com/casey/just) for running common development tasks. You can also read the `justfile` and run those commands directly.
Copy link
Member Author

Choose a reason for hiding this comment

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

I added this and the updated scripts below; everything else was prettier

@@ -0,0 +1,29 @@
set quiet

import? '../sdk-codegen/justfile'
Copy link
Member Author

Choose a reason for hiding this comment

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

the trailing ? on import means to swallow the error if this file is missing. So we'll get bonus actions, but external contributors will still be able to use the recipes in this file.

Copy link
Contributor

Choose a reason for hiding this comment

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

I like this. so a user that does not have codegen will still have access to repo-specific commands but perhaps not any commands that apply to or invoke the code generator?

Copy link
Member Author

Choose a reason for hiding this comment

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

yep, exactly! progressive enhancement, basically

justfile Outdated Show resolved Hide resolved
.github/workflows/ci.yml Outdated Show resolved Hide resolved
justfile Outdated Show resolved Hide resolved
# base test command
[no-quiet]
_test no_build framework config:
dotnet test {{no_build}} {{framework}} src/StripeTests/StripeTests.csproj -c {{config}}
Copy link
Member Author

Choose a reason for hiding this comment

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

This could be simplified if testing just always ran the build command, but I get the sense that in CI we want to build once and use that build repeatedly (for tests, packing, uploading, etc).

We could also add a just build command that was used as a pre-req for packing and uploading, but I'm not too worried about it. Since this recipe isn't called directly, I think test and ci-test are clear enough on intention.

Copy link
Contributor

Choose a reason for hiding this comment

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

i think that is true re: reusing the build when packing (or previously when computing coverage). replacing dotnet build src -c Release /p:ContinuousIntegrationBuild=true with just ci-build makes sense to me and we could then assume anything with a ci- scope has to conform to certain rules (e.g. ci-build first, and then everything else is nobuild). but these are the short strokes, i think.

Copy link
Member Author

Choose a reason for hiding this comment

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

let's leave it as written for now so we don't go down the rabbit hole of debugging the whole CI setup. I think these test commands are mostly set-and-forget, so i'm not worried about a little harder to read

# called by tooling
[private]
update-version version:
echo "{{ version }}" > VERSION
Copy link
Member Author

Choose a reason for hiding this comment

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

This is the same as the makefile, but uses an action recipe argument and the just-style variable replacement ({{ varname }}). I verified that it works manually locally, though we'll have to tweak the code that calls this (the release script) once all the repos are done.

Copy link
Contributor

Choose a reason for hiding this comment

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

ah, because the Makefile pulled it from an environment variable? The change makes sense to me (and I prefer an argument to an env var anyway).

Copy link
Member Author

Choose a reason for hiding this comment

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

exactly- just slightly different syntax. And yeah, we get real arguments now!

@xavdid-stripe
Copy link
Member Author

Ok, this is ready for review @jar-stripe! I over-commented in the PR since this is the first one and I want to explain my reasoning, but the actual changes should be fairly uncontroversial.

@xavdid-stripe xavdid-stripe marked this pull request as ready for review January 7, 2025 20:18
justfile Show resolved Hide resolved
Copy link
Contributor

@jar-stripe jar-stripe left a comment

Choose a reason for hiding this comment

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

This looks good to me!

@xavdid-stripe xavdid-stripe merged commit 90e57f6 into master Jan 9, 2025
4 checks passed
@xavdid-stripe xavdid-stripe deleted the DEVSDK-2325 branch January 9, 2025 18: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.

2 participants