Skip to content

Commit dfa231b

Browse files
committed
Merge remote-tracking branch 'upstream/master' into feat/net9.0-support
2 parents 46d9b88 + 0c54b7c commit dfa231b

File tree

3,465 files changed

+64677
-6283
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

3,465 files changed

+64677
-6283
lines changed

.github/CODEOWNERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# All files should be reviewed by a member of the SDKs team
2+
* @stripe/api-library-reviewers

.github/workflows/ci.yml

Lines changed: 66 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,11 @@ jobs:
2121
build:
2222
name: Build and test
2323

24-
runs-on: ubuntu-latest
24+
# TODO: this step is not compatible with ubuntu 24 LTS, so we pin the version here instead of using ubuntu-latest
25+
runs-on: ubuntu-22.04
2526

2627
steps:
28+
- uses: extractions/setup-just@v2
2729
- uses: actions/checkout@master
2830

2931
- name: Setup .NET
@@ -44,55 +46,55 @@ jobs:
4446
- name: Build Release
4547
run: dotnet build src -c Release /p:ContinuousIntegrationBuild=true
4648

47-
- name: Build Debug
48-
run: dotnet build src -c Debug
49-
50-
- uses: stripe/openapi/actions/stripe-mock@master
51-
52-
- name: Run test suite
53-
run: make ci-test
49+
- name: Determine OpenAPI versions and extract specs
50+
run: |
51+
set -e -o pipefail
52+
53+
CURL_OPTS=(--retry 3 \
54+
--retry-all-errors \
55+
--fail \
56+
--verbose \
57+
--no-progress-meter \
58+
--show-error)
59+
60+
LATEST_OPENAPI_VERSION=$(curl https://api.github.com/repos/stripe/openapi/releases/latest -s | jq .name -r)
61+
CURRENT_OPENAPI_VERSION=$(cat OPENAPI_VERSION)
62+
if [[ "$PR_BODY" == *"TEST USING LATEST OPENAPI"* ]]; then
63+
OPENAPI_VERSION=$LATEST_OPENAPI_VERSION
64+
else
65+
OPENAPI_VERSION=$CURRENT_OPENAPI_VERSION
66+
fi
5467
55-
- name: Run test suite (Debug)
56-
run: make ci-test-debug
68+
CURRENT_OPENAPI_SPEC=$(realpath latest.yaml)
69+
CURRENT_OPENAPI_SPEC_JSON=${CURRENT_OPENAPI_SPEC%.yaml}.json
70+
CURRENT_FIXTURES_JSON=${CURRENT_OPENAPI_SPEC%/*}/fixtures.json
5771
58-
- name: Collect coverage
59-
run: dotnet test --no-build -c Debug -f netcoreapp3.1 src/StripeTests/StripeTests.csproj /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:ExcludeByAttribute=CompilerGenerated
72+
SPEC_NAME="spec3.sdk.yaml"
73+
FIXTURES_NAME="fixtures3.json"
74+
if [[ "$GITHUB_BASE" == *"b"* ]]; then
75+
SPEC_NAME="spec3.beta.sdk.yaml"
76+
FIXTURES_NAME="fixtures3.beta.json"
77+
fi
78+
curl "${CURL_OPTS[@]}" https://raw.githubusercontent.com/stripe/openapi/$OPENAPI_VERSION/openapi/${SPEC_NAME%.yaml}.json -o $CURRENT_OPENAPI_SPEC_JSON
79+
curl "${CURL_OPTS[@]}" https://raw.githubusercontent.com/stripe/openapi/$OPENAPI_VERSION/openapi/$FIXTURES_NAME -o $CURRENT_FIXTURES_JSON
6080
61-
- name: Get branch name (merge)
62-
if: github.event_name != 'pull_request'
63-
run: echo "commitBranch=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV
81+
env:
82+
PR_BODY: ${{ github.event.pull_request.body }}
83+
GITHUB_BASE: ${{ github.base_ref || github.ref_name }}
6484

65-
- name: Get branch name (pull request)
66-
if: github.event_name == 'pull_request'
67-
run: echo "commitBranch=$(echo ${GITHUB_HEAD_REF} | tr / -)" >> $GITHUB_ENV
85+
- uses: stripe/openapi/actions/stripe-mock@master
86+
with:
87+
# Used to determine if stripe-mock runs in beta mode
88+
base: ${{ github.base_ref || github.ref_name }}
89+
fixtures: "/workspace/fixtures.json"
90+
spec_path: "/workspace/latest.json"
6891

69-
- name: Send code coverage report to coveralls.io
70-
if: env.COVERALLS_REPO_TOKEN
71-
run: |
72-
export ARGS="--opencover \
73-
-i src/StripeTests/coverage.netcoreapp3.1.opencover.xml \
74-
--repoToken $COVERALLS_REPO_TOKEN \
75-
--useRelativePaths \
76-
--commitId $commitId \
77-
--commitBranch $commitBranch \
78-
--commitAuthor $commitAuthor \
79-
--jobId $jobId"
80-
if [ ! -z "${pullRequestId}" ];
81-
then
82-
export ARGS="$ARGS \
83-
--pullRequest $pullRequestId"
84-
fi
85-
dotnet tool run csmacnz.Coveralls $ARGS
86-
env:
87-
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
88-
commitId: ${{ github.sha }}
89-
commitAuthor: ${{ github.actor }}
90-
jobId: ${{ github.run_id }}
91-
pullRequestId: ${{ github.event.pull_request.number }}
92+
- name: Run test suite
93+
run: just ci-test
9294

9395
- name: Pack
9496
run: dotnet pack src/Stripe.net -c Release --no-build --output nuget
95-
- name: 'Upload Artifact'
97+
- name: "Upload Artifact"
9698
uses: actions/upload-artifact@v4
9799
with:
98100
name: nuget
@@ -103,32 +105,32 @@ jobs:
103105
if: github.event_name == 'pull_request'
104106
runs-on: ubuntu-latest
105107
steps:
106-
- uses: actions/checkout@master
107-
- name: Setup .NET
108-
uses: actions/setup-dotnet@v1
109-
with:
110-
dotnet-version: 8.0.x
111-
- name: Run backcompat check
112-
run: dotnet pack src/Stripe.net -p:RunBaselineCheck=true
108+
- uses: actions/checkout@master
109+
- name: Setup .NET
110+
uses: actions/setup-dotnet@v1
111+
with:
112+
dotnet-version: 8.0.x
113+
- name: Run backcompat check
114+
run: dotnet pack src/Stripe.net -p:RunBaselineCheck=true
113115

114116
publish:
115117
name: Publish
116118
if: (((github.event_name == 'push') || (github.event_name == 'workflow_dispatch')) && startsWith(github.ref, 'refs/tags/v') && endsWith(github.actor, '-stripe'))
117119
needs: [build]
118120
runs-on: ubuntu-latest
119121
steps:
120-
- name: Download all workflow run artifacts
121-
uses: actions/download-artifact@v4
122-
with:
123-
name: nuget
124-
path: nuget
125-
- name: Setup .NET
126-
uses: actions/setup-dotnet@v1
127-
with:
128-
dotnet-version: 8.0.x
129-
- name: Publish NuGet packages to NuGet
130-
run: dotnet nuget push nuget/*.nupkg --api-key ${{ secrets.NUGET_KEY }} --source "nuget.org"
131-
- uses: stripe/openapi/actions/notify-release@master
132-
if: always()
133-
with:
134-
bot_token: ${{ secrets.SLACK_BOT_TOKEN }}
122+
- name: Download all workflow run artifacts
123+
uses: actions/download-artifact@v4
124+
with:
125+
name: nuget
126+
path: nuget
127+
- name: Setup .NET
128+
uses: actions/setup-dotnet@v1
129+
with:
130+
dotnet-version: 8.0.x
131+
- name: Publish NuGet packages to NuGet
132+
run: dotnet nuget push nuget/*.nupkg --api-key ${{ secrets.NUGET_KEY }} --source "nuget.org"
133+
- uses: stripe/openapi/actions/notify-release@master
134+
if: always()
135+
with:
136+
bot_token: ${{ secrets.SLACK_BOT_TOKEN }}

.github/workflows/rules.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
name: rules
3+
4+
on:
5+
workflow_dispatch: {}
6+
pull_request:
7+
types:
8+
- auto_merge_enabled
9+
10+
jobs:
11+
require_merge_commit_on_merge_script_pr:
12+
name: Merge script PRs must create merge commits
13+
if: ${{ contains(github.head_ref, '/merge-') }}
14+
runs-on: ubuntu-latest
15+
steps:
16+
- run: |
17+
if ${{ github.event.pull_request.auto_merge.merge_method != 'merge' }}; then
18+
echo "Auto-merge method must be 'merge' instead of '${{github.event.pull_request.auto_merge.merge_method}}'"
19+
exit 1
20+
fi
21+

0 commit comments

Comments
 (0)