Skip to content

Commit

Permalink
Merge pull request #545 from arlyon/fix-release
Browse files Browse the repository at this point in the history
Fix semantic release
  • Loading branch information
jwiesler committed Apr 26, 2024
2 parents 15b40bc + 842bce6 commit 3b0c3eb
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 48 deletions.
37 changes: 17 additions & 20 deletions .github/workflows/async-stripe.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,44 +10,44 @@ jobs:
format:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@v1
with:
profile: minimal
toolchain: nightly
components: rustfmt
- uses: davidB/rust-cargo-make@v1
- name: regenerate openapi
uses: actions-rs/cargo@v1
uses: clechasseur/rs-cargo@v2
with:
command: make
args: check

verify-codegen:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@v1
with:
profile: minimal
toolchain: nightly
components: rustfmt
- uses: davidB/rust-cargo-make@v1
- name: regenerate openapi
uses: actions-rs/cargo@v1
uses: clechasseur/rs-cargo@v2
with:
command: make
args: openapi-install
- name: ensure generated files unchanged
uses: tj-actions/verify-changed-files@v11.1
uses: tj-actions/verify-changed-files@v19
id: verify-changed-files
with:
files: |
**/*.rs
- name: report changed files
if: steps.verify-changed-files.outputs.files_changed == 'true'
env:
CHANGED_FILES: ${{ steps.verify-changed-files.outputs.changed_files }}
run: |
echo "Some files changed after code generation: ${{ steps.verify-changed-files.outputs.changed_files }}"
echo "Some files changed after code generation: $CHANGED_FILES"
exit 1
clippy:
Expand All @@ -65,20 +65,19 @@ jobs:
blocking-rustls-webpki,
]
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@v1
with:
profile: minimal
toolchain: stable
components: clippy
- uses: actions/cache@v2
- uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-clippy-${{ matrix.runtime }}-${{ hashFiles('**/Cargo.lock') }}
- uses: actions-rs/cargo@v1
- uses: clechasseur/rs-cargo@v2
with:
command: clippy
args: >
Expand Down Expand Up @@ -107,13 +106,11 @@ jobs:
- 12111:12111
- 12112:12112
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@v1
with:
profile: minimal
toolchain: "1.74.0"
override: true
- uses: actions/cache@v2
- uses: actions/cache@v4
with:
path: |
~/.cargo/registry
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,15 @@ jobs:
update-openapi:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Install minimal nightly with rustfmt
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@v1
with:
profile: minimal
toolchain: nightly
components: rustfmt
- uses: davidB/rust-cargo-make@v1
- name: regenerate openapi
uses: actions-rs/cargo@v1
uses: clechasseur/rs-cargo@v2
with:
command: make
args: openapi-install-latest
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@ jobs:
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') }}
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
token: ${{ secrets.REPO_SCOPED_TOKEN }}
- uses: dtolnay/rust-toolchain@1.60
- uses: dtolnay/rust-toolchain@v1
with:
toolchain: "1.74.0"
- uses: cycjimmy/semantic-release-action@v4
with:
extra_plugins: |
Expand Down
6 changes: 6 additions & 0 deletions src/client/base/tokio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ pub struct TokioClient {
client: HttpClient,
}

impl Default for TokioClient {
fn default() -> Self {
Self::new()
}
}

impl TokioClient {
pub fn new() -> Self {
Self {
Expand Down
9 changes: 2 additions & 7 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@ impl From<http_types::Error> for StripeError {
}

/// The list of possible values for a RequestError's type.
#[derive(Debug, PartialEq, Deserialize)]
#[derive(Debug, PartialEq, Deserialize, Default)]
pub enum ErrorType {
#[serde(skip_deserializing)]
#[default]
Unknown,
#[serde(rename = "api_error")]
Api,
Expand All @@ -58,12 +59,6 @@ pub enum ErrorType {
Validation,
}

impl Default for ErrorType {
fn default() -> Self {
ErrorType::Unknown
}
}

impl std::fmt::Display for ErrorType {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", to_snakecase(&format!("{:?}Error", self)))
Expand Down
8 changes: 2 additions & 6 deletions src/resources/balance_transaction_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,9 @@ impl std::default::Default for BalanceTransactionStatus {
/// An enum representing the possible values of an `Fee`'s `type` field.
#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
#[serde(rename_all = "snake_case")]
#[derive(Default)]
pub enum FeeType {
#[default]
ApplicationFee,
StripeFee,
Tax,
Expand All @@ -151,9 +153,3 @@ impl std::fmt::Display for FeeType {
self.as_str().fmt(f)
}
}

impl std::default::Default for FeeType {
fn default() -> Self {
FeeType::ApplicationFee
}
}
9 changes: 2 additions & 7 deletions src/resources/currency.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::params::to_snakecase;
/// Currency is the list of supported currencies.
///
/// For more details see <https://support.stripe.com/questions/which-currencies-does-stripe-support>.
#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq, Hash)]
#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq, Hash, Default)]
pub enum Currency {
#[serde(rename = "byn")]
BYN, // Belarusian Ruble
Expand Down Expand Up @@ -262,6 +262,7 @@ pub enum Currency {
#[serde(rename = "ugx")]
UGX, // Ugandan Shilling
#[serde(rename = "usd")]
#[default]
USD, // United States Dollar
#[serde(rename = "uyu")]
UYU, // Uruguayan Peso
Expand Down Expand Up @@ -291,12 +292,6 @@ pub enum Currency {
ZMW, // Zambian Kwacha
}

impl Default for Currency {
fn default() -> Self {
Currency::USD
}
}

impl std::fmt::Display for Currency {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", to_snakecase(&format!("{:?}", self)))
Expand Down
4 changes: 2 additions & 2 deletions tests/mock/mod.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
//! Setup and teardown for the stripe mock service.

#[allow(dead_code)]
pub fn with_client<T>(test: T) -> ()
pub fn with_client<T>(test: T)
where
T: FnOnce(&stripe::Client) -> () + std::panic::UnwindSafe,
T: FnOnce(&stripe::Client) + std::panic::UnwindSafe,
{
let result = std::panic::catch_unwind(|| {
let client = stripe::Client::from_url("http://localhost:12111", "sk_test_123");
Expand Down

0 comments on commit 3b0c3eb

Please sign in to comment.