Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

ci: add support for just hack_v2 check for PRs (#5426)

Prajjwal Kumar6b395cd12686
diff --git a/.github/workflows/CI-pr.yml b/.github/workflows/CI-pr.yml
index 4c591cba81..9e0b54dd7e 100644
--- a/.github/workflows/CI-pr.yml
+++ b/.github/workflows/CI-pr.yml
@@ -33,8 +33,6 @@ env:
RUSTUP_MAX_RETRIES: 10
# Don't emit giant backtraces in the CI logs.
RUST_BACKTRACE: short
- # Use `sccache` for caching compilation artifacts
- RUSTC_WRAPPER: sccache
jobs:
formatting:
@@ -90,6 +88,10 @@ jobs:
name: Check compilation on MSRV toolchain
runs-on: ${{ matrix.runner }}
+ env:
+ # Use `sccache` for caching compilation artifacts
+ RUSTC_WRAPPER: sccache
+
strategy:
fail-fast: false
matrix:
@@ -175,6 +177,10 @@ jobs:
name: Run tests on stable toolchain
runs-on: ${{ matrix.runner }}
+ env:
+ # Use `sccache` for caching compilation artifacts
+ RUSTC_WRAPPER: sccache
+
strategy:
fail-fast: false
matrix:
@@ -284,3 +290,49 @@ jobs:
- name: Spell check
uses: crate-ci/typos@master
+
+
+ check-v2:
+ name: Check compilation for V2 features
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v4
+
+ - name: Install mold linker
+ uses: rui314/setup-mold@v1
+ if: ${{ runner.os == 'Linux' }}
+ with:
+ make-default: true
+
+ - name: Install Rust
+ uses: dtolnay/rust-toolchain@master
+ with:
+ toolchain: stable 2 weeks ago
+ components: clippy
+
+ - name: Install rust cache
+ uses: Swatinem/[email protected]
+
+ - name: Install cargo-hack
+ uses: taiki-e/[email protected]
+ with:
+ tool: cargo-hack
+ checksum: true
+
+ - name: Install just
+ uses: taiki-e/[email protected]
+ with:
+ tool: just
+ checksum: true
+
+ - name: Deny warnings
+ shell: bash
+ run: |
+ sed -i 's/rustflags = \[/rustflags = \[\n "-Dwarnings",/' .cargo/config.toml
+ # Allow the `clippy::todo` lint for v2 checks
+ sed -i --null-data 's/ "-Wclippy::todo",\n//' .cargo/config.toml
+
+ - name: Cargo hack_v2
+ shell: bash
+ run: just hack_v2
diff --git a/justfile b/justfile
index bc63a81b83..b755e3d7de 100644
--- a/justfile
+++ b/justfile
@@ -122,8 +122,8 @@ precommit: fmt clippy
# Check compilation of v2 feature on base dependencies
v2_intermediate_features := "merchant_account_v2,payment_v2,customer_v2"
hack_v2:
- cargo hack check --feature-powerset --ignore-unknown-features --at-least-one-of "v2 " --include-features "v2" --include-features {{ v2_intermediate_features }} --package "hyperswitch_domain_models" --package "diesel_models" --package "api_models"
- cargo hack check --features "v2,payment_v2" -p storage_impl
+ cargo hack clippy --feature-powerset --ignore-unknown-features --at-least-one-of "v2 " --include-features "v2" --include-features {{ v2_intermediate_features }} --package "hyperswitch_domain_models" --package "diesel_models" --package "api_models"
+ cargo hack clippy --features "v2,payment_v2" -p storage_impl
# Use the env variables if present, or fallback to default values