Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/actions/build/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Build
description: Check formatting and build the artifacts. Shared by CI and Canary CI; expects the repository to be checked out.

runs:
using: composite
steps:
- uses: extractions/setup-just@53165ef7e734c5c07cb06b3c8e7b647c5aa16db3 # v4.0.0

- name: Setup Java
id: setup-jre
uses: actions/setup-java@dd06d9cba3e5552c54d9f8ea23572deb30010f7c # v6.0.0
with:
java-version: "17" # always use 17 LTS for building
architecture: x64
distribution: zulu

- name: Spotless
shell: bash
run: just format-check
env:
JAVA_TEST_HOME: ${{ steps.setup-jre.outputs.path }}

- name: Build artifacts
shell: bash
run: ./gradlew assemble javadoc
env:
JAVA_TEST_HOME: ${{ steps.setup-jre.outputs.path }}
129 changes: 129 additions & 0 deletions .github/actions/test/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
name: Test
description: Start stripe-mock, then run the test suite on a Java runtime. Shared by CI and Canary CI; expects the repository to be checked out.

inputs:
java-version:
description: Java version to run the tests on.
required: true
canary_channel:
description: >-
Canary channel (ga, beta, or private-preview) whose specs and fixtures
stripe-mock should serve. Empty uses the OPENAPI_VERSION release.
required: false
default: ''

runs:
using: composite
steps:
- uses: extractions/setup-just@53165ef7e734c5c07cb06b3c8e7b647c5aa16db3 # v4.0.0
- name: Resolve stripe-mock OpenAPI inputs
id: openapi
shell: bash
env:
CANARY_CHANNEL: ${{ inputs.canary_channel }}
run: |
set -euo pipefail

if [[ -z "$CANARY_CHANNEL" ]]; then
echo "version=$(< OPENAPI_VERSION)" >> "$GITHUB_OUTPUT"
exit 0
fi

case "$CANARY_CHANNEL" in
ga)
spec_name=spec3.sdk.json
fixtures_name=fixtures3.json
beta=false
;;
beta)
spec_name=spec3.beta.sdk.json
fixtures_name=fixtures3.beta.json
beta=true
;;
private-preview)
spec_name=spec3.private_preview.sdk.json
fixtures_name=fixtures3.private_preview.json
beta=true
;;
*)
echo "::error::Unsupported canary channel: $CANARY_CHANNEL"
exit 1
;;
esac

canary_dir="$GITHUB_WORKSPACE/.stripe-mock-canary"
mkdir -p "$canary_dir"

spec_path="$canary_dir/$spec_name"
fixtures_path="$canary_dir/$fixtures_name"
canary_base="https://raw.githubusercontent.com/stripe/openapi/master/openapi/canary/$CANARY_CHANNEL"
curl_options=(
--retry 3
--retry-all-errors
--fail
--silent
--show-error
)

curl "${curl_options[@]}" "$canary_base/$spec_name" -o "$spec_path"
curl "${curl_options[@]}" "$canary_base/$fixtures_name" -o "$fixtures_path"

{
echo "spec_path=$spec_path"
echo "fixtures_path=$fixtures_path"
echo "beta=$beta"
} >> "$GITHUB_OUTPUT"

- name: Setup Test Java Runtime
id: setup-test-jre
uses: actions/setup-java@dd06d9cba3e5552c54d9f8ea23572deb30010f7c # v6.0.0
with:
java-version: ${{ inputs.java-version }}
architecture: x64
distribution: zulu

# our gradle version wants java 17, so any other test version needs a separate setup
- name: Setup Gradle JDK
if: ${{ inputs.java-version != '17' }}
uses: actions/setup-java@dd06d9cba3e5552c54d9f8ea23572deb30010f7c # v6.0.0
with:
java-version: "17"
architecture: x64
distribution: zulu

- name: Tweak gradle.properties for Java 8
if: ${{ inputs.java-version == '8' }}
shell: bash
run: sed -e '/--add-exports/ s/^#*/#/' -i gradle.properties

- name: Display version
shell: bash
run: |
./gradlew --version
echo "JAVA_TEST_HOME=$JAVA_TEST_HOME"
env:
JAVA_TEST_HOME: ${{ steps.setup-test-jre.outputs.path }}

- uses: stripe/openapi/actions/stripe-mock@master
with:
openapi_version: ${{ steps.openapi.outputs.version }}
spec_path: ${{ steps.openapi.outputs.spec_path }}
fixtures: ${{ steps.openapi.outputs.fixtures_path }}
beta: ${{ steps.openapi.outputs.beta }}
# Used to determine if stripe-mock runs in beta mode. Canary runs set `beta`
# explicitly instead, so pass a base that never implies beta (it has no "b").
base: ${{ inputs.canary_channel != '' && 'canary' || github.base_ref == 'private-preview' && 'beta' || github.ref_name == 'private-preview' && 'beta' || contains(github.ref_name, '-alpha.') && 'beta' || github.base_ref || github.ref_name }}

# Steps without an explicit shell used to run under PowerShell on Windows.
- name: Run test suite
if: runner.os == 'Windows'
shell: pwsh
run: just test
env:
JAVA_TEST_HOME: ${{ steps.setup-test-jre.outputs.path }}
- name: Run test suite
if: runner.os != 'Windows'
shell: bash
run: just test
env:
JAVA_TEST_HOME: ${{ steps.setup-test-jre.outputs.path }}
85 changes: 85 additions & 0 deletions .github/workflows/canary.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Canary CI

# Runs the same checks as CI against code generated from the canary specs.
# sdk-codegen force-pushes these branches; they are never released, so there is
# no publish job. compat is omitted too: it compares against a pull request base.
on:
workflow_dispatch: {}
push:
branches:
- canary-ga
- canary-beta
- canary-private-preview

permissions: {}

concurrency:
# Each push replaces the branch, so an older run's result is stale.
group: canary-ci-${{ github.ref_name }}
cancel-in-progress: true

env:
# Map each canary branch to the channel stripe-mock serves.
CANARY_CHANNEL: >-
${{
github.ref_name == 'canary-ga' && 'ga' ||
github.ref_name == 'canary-beta' && 'beta' ||
github.ref_name == 'canary-private-preview' && 'private-preview' ||
'unsupported'
}}

jobs:
build:
name: Build

runs-on: "ubuntu-24.04"

permissions:
contents: read

steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: ./.github/actions/build

test:
name: Test (${{ matrix.java-version }}, ${{ matrix.os }})

runs-on: ${{ matrix.os }}

permissions:
contents: read

strategy:
fail-fast: false
matrix:
# Keep in sync with the test matrix in ci.yml.
os:
- "ubuntu-24.04"
# We test Stripe SDK against Java LTS versions(8, 11, 17, 21, 25) and currently supported non-LTS versions.
# https://www.oracle.com/java/technologies/java-se-support-roadmap.html
# https://endoflife.date/oracle-jdk
java-version:
# LTS versions
- "8"
- "11"
- "17"
- "21"
- "25"
# non-LTS versions
# we should periodically add the latest non-LTS version here to test against
- "26"
include:
- os: windows-latest
# use any modern-ish version
java-version: "25"

steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: ./.github/actions/test
with:
java-version: ${{ matrix.java-version }}
canary_channel: ${{ env.CANARY_CHANNEL }}
67 changes: 3 additions & 64 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,29 +31,10 @@ jobs:
contents: read

steps:
- uses: extractions/setup-just@53165ef7e734c5c07cb06b3c8e7b647c5aa16db3 # v4.0.0
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- name: Setup Java
id: setup-jre
uses: actions/setup-java@dd06d9cba3e5552c54d9f8ea23572deb30010f7c # v6.0.0
with:
java-version: "17" # always use 17 LTS for building
architecture: x64
distribution: zulu

- name: Set Test Java Runtime Environment variable
run: echo "JAVA_TEST_HOME=${JRE_PATH}" >> $GITHUB_ENV
env:
JRE_PATH: ${{ steps.setup-jre.outputs.path }}

- name: Spotless
run: just format-check

- name: Build artifacts
run: ./gradlew assemble javadoc
- uses: ./.github/actions/build

test:
name: Test (${{ matrix.java-version }}, ${{ matrix.os }})
Expand All @@ -66,6 +47,7 @@ jobs:
strategy:
fail-fast: false
matrix:
# Keep in sync with the test matrix in canary.yml.
os:
- "ubuntu-24.04"
# We test Stripe SDK against Java LTS versions(8, 11, 17, 21, 25) and currently supported non-LTS versions.
Expand All @@ -87,55 +69,12 @@ jobs:
java-version: "25"

steps:
- uses: extractions/setup-just@53165ef7e734c5c07cb06b3c8e7b647c5aa16db3 # v4.0.0
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Read OpenAPI version
id: openapi
shell: bash
run: echo "version=$(< OPENAPI_VERSION)" >> "$GITHUB_OUTPUT"

- name: Setup Test Java Runtime
id: setup-test-jre
uses: actions/setup-java@dd06d9cba3e5552c54d9f8ea23572deb30010f7c # v6.0.0
- uses: ./.github/actions/test
with:
java-version: ${{ matrix.java-version }}
architecture: x64
distribution: zulu

- name: Set Test Java Runtime Environment variable
shell: bash
run: echo "JAVA_TEST_HOME=${JRE_PATH}" >> $GITHUB_ENV
env:
JRE_PATH: ${{ steps.setup-test-jre.outputs.path }}

# our gradle version wants java 17, so any other test version needs a separate setup
- name: Setup Gradle JDK
if: ${{ matrix.java-version != '17' }}
uses: actions/setup-java@dd06d9cba3e5552c54d9f8ea23572deb30010f7c # v6.0.0
with:
java-version: "17"
architecture: x64
distribution: zulu

- name: Tweak gradle.properties for Java 8
if: ${{ matrix.java-version == '8' }}
run: sed -e '/--add-exports/ s/^#*/#/' -i gradle.properties

- name: Display version
shell: bash
run: |
./gradlew --version
echo "JAVA_TEST_HOME=$JAVA_TEST_HOME"

- uses: stripe/openapi/actions/stripe-mock@master
with:
openapi_version: ${{ steps.openapi.outputs.version }}
# Used to determine if stripe-mock runs in beta mode
base: ${{ github.base_ref == 'private-preview' && 'beta' || github.ref_name == 'private-preview' && 'beta' || contains(github.ref_name, '-alpha.') && 'beta' || github.base_ref || github.ref_name }}
- name: Run test suite
run: just test

publish:
if: >-
Expand Down
8 changes: 8 additions & 0 deletions .hark/changes/2026-11-09_stripe-openapi_953c5bcf.change.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
title: Update generated code
pr_url: https://github.com/stripe/stripe-java/pull/2326
semver_level: minor
is_stripe_api_change: true
---

* Release specs are identical.
2 changes: 1 addition & 1 deletion CODEGEN_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
65c49b0893d71e8cfe272b2d38cd3307ee1833f2
a5c271ff038a337674f6f7da32cedd9e0185a2ee
2 changes: 1 addition & 1 deletion OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v2596
v2599
9 changes: 4 additions & 5 deletions src/main/java/com/stripe/model/v2/core/Event.java
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,12 @@
RequestOptions.RequestOptionsBuilder optsBuilder = new RequestOptions.RequestOptionsBuilder();
optsBuilder.setStripeRequestTrigger("event=" + id);

if (context != null) {
optsBuilder.setStripeContext(context);
}

RequestOptions opts = optsBuilder.build();

return this.responseGetter.request(
// Scope the getter used for this request to the event's own context.
StripeResponseGetter scopedResponseGetter = this.responseGetter.withStripeContext(context);

Check failure on line 126 in src/main/java/com/stripe/model/v2/core/Event.java

View workflow job for this annotation

GitHub Actions / Build

cannot find symbol

Check failure on line 126 in src/main/java/com/stripe/model/v2/core/Event.java

View workflow job for this annotation

GitHub Actions / compat

cannot find symbol

Check failure on line 126 in src/main/java/com/stripe/model/v2/core/Event.java

View workflow job for this annotation

GitHub Actions / Test (8, ubuntu-24.04)

cannot find symbol

Check failure on line 126 in src/main/java/com/stripe/model/v2/core/Event.java

View workflow job for this annotation

GitHub Actions / Test (26, ubuntu-24.04)

cannot find symbol

Check failure on line 126 in src/main/java/com/stripe/model/v2/core/Event.java

View workflow job for this annotation

GitHub Actions / Test (11, ubuntu-24.04)

cannot find symbol

Check failure on line 126 in src/main/java/com/stripe/model/v2/core/Event.java

View workflow job for this annotation

GitHub Actions / Test (17, ubuntu-24.04)

cannot find symbol

Check failure on line 126 in src/main/java/com/stripe/model/v2/core/Event.java

View workflow job for this annotation

GitHub Actions / Test (21, ubuntu-24.04)

cannot find symbol

Check failure on line 126 in src/main/java/com/stripe/model/v2/core/Event.java

View workflow job for this annotation

GitHub Actions / Test (25, ubuntu-24.04)

cannot find symbol

return scopedResponseGetter.request(
new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.GET, url, null, opts),
objectClass);
}
Expand Down
Loading
Loading