-
Notifications
You must be signed in to change notification settings - Fork 569
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
Changes from 8 commits
0ca00a5
cb300e9
6c5dfda
d21a939
1318d73
2ee337c
bc78969
0d320df
76d99f4
8d6c190
ff0c80d
1c1092b
bd44a7c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,10 +30,10 @@ From within Visual Studio: | |
|
||
1. Open the Solution Explorer. | ||
2. Right-click on a project within your solution. | ||
3. Click on *Manage NuGet Packages...* | ||
4. Click on the *Browse* tab and search for "Stripe.net". | ||
3. Click on _Manage NuGet Packages..._ | ||
4. Click on the _Browse_ tab and search for "Stripe.net". | ||
5. Click on the Stripe.net package, select the appropriate version in the | ||
right-tab and click *Install*. | ||
right-tab and click _Install_. | ||
|
||
## Documentation | ||
|
||
|
@@ -49,15 +49,15 @@ Stripe authenticates API requests using your account’s secret key, which you c | |
|
||
Use `StripeConfiguration.ApiKey` property to set the secret key. | ||
|
||
``` C# | ||
```C# | ||
StripeConfiguration.ApiKey = "sk_test_..."; | ||
``` | ||
|
||
### Creating a resource | ||
|
||
The `Create` method of the service class can be used to create a new resource: | ||
|
||
``` C# | ||
```C# | ||
var options = new CustomerCreateOptions | ||
{ | ||
Email = "[email protected]" | ||
|
@@ -74,7 +74,7 @@ Console.WriteLine(customer.Email); | |
|
||
The `Retrieve` method of the service class can be used to retrieve a resource: | ||
|
||
``` C# | ||
```C# | ||
var service = new CustomerService(); | ||
Customer customer = service.Get("cus_1234"); | ||
|
||
|
@@ -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. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added this and the updated scripts below; everything else was |
||
|
||
Run all tests from the `src/StripeTests` directory: | ||
|
||
```sh | ||
dotnet test src | ||
just test | ||
# or: dotnet test src | ||
``` | ||
|
||
Run some tests, filtering by name: | ||
|
@@ -343,7 +346,8 @@ must be formatted before PRs are submitted, otherwise CI will fail. Run the | |
formatter with: | ||
|
||
```sh | ||
dotnet format src/Stripe.net.sln | ||
just format | ||
# or: dotnet format src/Stripe.net.sln | ||
``` | ||
|
||
For any requests, bug or comments, please [open an issue][issues] or [submit a | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
set quiet | ||
|
||
import? '../sdk-codegen/justfile' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the trailing There was a problem hiding this comment. Choose a reason for hiding this commentThe 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? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yep, exactly! progressive enhancement, basically |
||
|
||
_default: | ||
just --list --unsorted | ||
|
||
# base test command | ||
[no-quiet] | ||
_test no_build framework config: | ||
dotnet test {{no_build}} {{framework}} src/StripeTests/StripeTests.csproj -c {{config}} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
|
||
# run tests in debug mode | ||
[group('useful')] | ||
xavdid-stripe marked this conversation as resolved.
Show resolved
Hide resolved
|
||
test: (_test "" "-f net8.0" "Debug") | ||
|
||
# skip build and don't specify the dotnet framework | ||
[group('CI')] | ||
ci-test: (_test "--no-build" "" "Release") | ||
|
||
# format files as needed | ||
[group('useful')] | ||
format *options: | ||
TargetFramework=net5.0 dotnet format src/Stripe.net/Stripe.net.csproj --severity warn {{options}} | ||
|
||
# for backwards compatibility; ideally removed later | ||
[private] | ||
alias codegen-format := format | ||
|
||
# verify, but don't modify, the project's formatting | ||
[group('CI')] | ||
format-check: (format "--verify-no-changes") | ||
|
||
# called by tooling | ||
[private] | ||
update-version version: | ||
echo "{{ version }}" > VERSION | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 ( There was a problem hiding this comment. Choose a reason for hiding this commentThe 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). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. exactly- just slightly different syntax. And yeah, we get real arguments now! |
||
perl -pi -e 's|<Version>[.\-\d\w]+</Version>|<Version>{{ version }}</Version>|' src/Stripe.net/Stripe.net.csproj | ||
perl -pi -e 's|Current = "[.\-\d\w]+";|Current = "{{ version }}";|' src/Stripe.net/Constants/Version.cs |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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". 😁There was a problem hiding this comment.
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!