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: use `sccache-action` for caching compilation artifacts (#1857)

Sanchith Hegde0a03d69b1627
diff --git a/.github/workflows/CI-pr.yml b/.github/workflows/CI-pr.yml
index 61d4c6f7df..a13f0eb51e 100644
--- a/.github/workflows/CI-pr.yml
+++ b/.github/workflows/CI-pr.yml
@@ -35,6 +35,9 @@ env:
RUST_BACKTRACE: short
# Use cargo's sparse index protocol
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
+ # Enable and use the sccache action for caching
+ SCCACHE_GHA_ENABLED: "true"
+ RUSTC_WRAPPER: "sccache"
jobs:
formatting:
@@ -84,9 +87,7 @@ jobs:
with:
toolchain: 1.65
- - uses: Swatinem/[email protected]
- with:
- save-if: ${{ github.event_name == 'push' }}
+ - uses: mozilla-actions/[email protected]
- name: Install cargo-hack
uses: baptiste0928/[email protected]
@@ -293,9 +294,7 @@ jobs:
# with:
# crate: cargo-nextest
- - uses: Swatinem/[email protected]
- with:
- save-if: ${{ github.event_name == 'push' }}
+ - uses: mozilla-actions/[email protected]
# - name: Setup Embark Studios lint rules
# shell: bash
diff --git a/.github/workflows/CI-push.yml b/.github/workflows/CI-push.yml
index e087c694c5..cba1fb715d 100644
--- a/.github/workflows/CI-push.yml
+++ b/.github/workflows/CI-push.yml
@@ -19,6 +19,32 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
+env:
+ # Disable incremental compilation.
+ #
+ # Incremental compilation is useful as part of an edit-build-test-edit cycle,
+ # as it lets the compiler avoid recompiling code that hasn't changed. However,
+ # on CI, we're not making small edits; we're almost always building the entire
+ # project from scratch. Thus, incremental compilation on CI actually
+ # introduces *additional* overhead to support making future builds
+ # faster...but no future builds will ever occur in any given CI environment.
+ #
+ # See https://matklad.github.io/2021/09/04/fast-rust-builds.html#ci-workflow
+ # for details.
+ CARGO_INCREMENTAL: 0
+ # Allow more retries for network requests in cargo (downloading crates) and
+ # rustup (installing toolchains). This should help to reduce flaky CI failures
+ # from transient network timeouts or other issues.
+ CARGO_NET_RETRY: 10
+ RUSTUP_MAX_RETRIES: 10
+ # Don't emit giant backtraces in the CI logs.
+ RUST_BACKTRACE: short
+ # Use cargo's sparse index protocol
+ CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
+ # Enable and use the sccache action for caching
+ SCCACHE_GHA_ENABLED: "true"
+ RUSTC_WRAPPER: "sccache"
+
jobs:
formatting:
name: Check formatting
@@ -63,9 +89,7 @@ jobs:
with:
toolchain: 1.65
- - uses: Swatinem/[email protected]
- with:
- save-if: ${{ github.event_name == 'push' }}
+ - uses: mozilla-actions/[email protected]
- name: Install cargo-hack
uses: baptiste0928/[email protected]
@@ -138,9 +162,7 @@ jobs:
# with:
# crate: cargo-nextest
- - uses: Swatinem/[email protected]
- with:
- save-if: ${{ github.event_name == 'push' }}
+ - uses: mozilla-actions/[email protected]
# - name: Setup Embark Studios lint rules
# shell: bash
diff --git a/.github/workflows/connector-sanity-tests.yml b/.github/workflows/connector-sanity-tests.yml
index 4d6199a86d..1aa14e5643 100644
--- a/.github/workflows/connector-sanity-tests.yml
+++ b/.github/workflows/connector-sanity-tests.yml
@@ -38,6 +38,9 @@ env:
RUST_BACKTRACE: short
# Use cargo's sparse index protocol
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
+ # Enable and use the sccache action for caching
+ SCCACHE_GHA_ENABLED: "true"
+ RUSTC_WRAPPER: "sccache"
jobs:
test_connectors:
@@ -86,7 +89,7 @@ jobs:
with:
toolchain: stable
- - uses: Swatinem/[email protected]
+ - uses: mozilla-actions/[email protected]
- name: Decrypt connector auth file
env:
diff --git a/.github/workflows/connector-ui-sanity-tests.yml b/.github/workflows/connector-ui-sanity-tests.yml
index 9c81d715b1..4809451d51 100644
--- a/.github/workflows/connector-ui-sanity-tests.yml
+++ b/.github/workflows/connector-ui-sanity-tests.yml
@@ -2,9 +2,9 @@ name: Connector UI Sanity Tests
on:
workflow_dispatch:
-
+
pull_request_review:
- types:
+ types:
- submitted
merge_group:
types:
@@ -26,7 +26,7 @@ env:
#
# See https://matklad.github.io/2021/09/04/fast-rust-builds.html#ci-workflow
# for details.
- CARGO_INCREMENTAL: 1
+ CARGO_INCREMENTAL: 0
# Allow more retries for network requests in cargo (downloading crates) and
# rustup (installing toolchains). This should help to reduce flaky CI failures
# from transient network timeouts or other issues.
@@ -36,6 +36,9 @@ env:
RUST_BACKTRACE: short
# Use cargo's sparse index protocol
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
+ # Enable and use the sccache action for caching
+ SCCACHE_GHA_ENABLED: "true"
+ RUSTC_WRAPPER: "sccache"
jobs:
test_connectors:
@@ -73,14 +76,13 @@ jobs:
# do not use more than 2 runners, try to group less time taking connectors together
- stripe,airwallex,bluesnap,checkout,trustpay_3ds,payu,authorizedotnet,aci,noon
- adyen_uk,shift4,worldline,multisafepay,paypal,mollie,nexinets
-
steps:
- name: Ignore Tests incase of pull request
if: github.event_name == 'pull_request' || github.event_name == 'merge_group'
shell: bash
run: |
- echo "Skipped tests as the event is pull request"
+ echo "Skipped tests as the event is pull request"
exit 0
- name: Checkout repository
@@ -105,34 +107,34 @@ jobs:
run: echo "CONNECTOR_TESTS_FILE_PATH=$HOME/target/test/connector_tests.json" >> $GITHUB_ENV
- name: Set ignore_browser_profile usage in env
- if: (github.event_name == 'pull_request_review' && github.event.review.state == 'approved') || (github.event_name == 'workflow_dispatch')
+ if: (github.event_name == 'pull_request_review' && github.event.review.state == 'approved') || (github.event_name == 'workflow_dispatch')
shell: bash
run: echo "IGNORE_BROWSER_PROFILE=true" >> $GITHUB_ENV
- name: Install latest compiler
- if: (github.event_name == 'pull_request_review' && github.event.review.state == 'approved') || (github.event_name == 'workflow_dispatch')
+ if: (github.event_name == 'pull_request_review' && github.event.review.state == 'approved') || (github.event_name == 'workflow_dispatch')
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- - uses: Swatinem/[email protected]
+ - uses: mozilla-actions/[email protected]
- uses: baptiste0928/[email protected]
- if: (github.event_name == 'pull_request_review' && github.event.review.state == 'approved') || (github.event_name == 'workflow_dispatch')
+ if: (github.event_name == 'pull_request_review' && github.event.review.state == 'approved') || (github.event_name == 'workflow_dispatch')
with:
crate: diesel_cli
features: postgres
args: "--no-default-features"
- name: Diesel migration run
- if: (github.event_name == 'pull_request_review' && github.event.review.state == 'approved') || (github.event_name == 'workflow_dispatch')
+ if: (github.event_name == 'pull_request_review' && github.event.review.state == 'approved') || (github.event_name == 'workflow_dispatch')
shell: bash
env:
DATABASE_URL: postgres://db_user:db_pass@localhost:5432/hyperswitch_db
run: diesel migration run
- name: Start server and run tests
- if: (github.event_name == 'pull_request_review' && github.event.review.state == 'approved') || (github.event_name == 'workflow_dispatch')
+ if: (github.event_name == 'pull_request_review' && github.event.review.state == 'approved') || (github.event_name == 'workflow_dispatch')
env:
UI_TESTCASES_PATH: ${{ secrets.UI_TESTCASES_PATH }}
INPUT: ${{ matrix.connector }}
@@ -140,12 +142,12 @@ jobs:
run: sh .github/scripts/run_ui_tests.sh
- name: View test results
- if: (github.event_name == 'pull_request_review' && github.event.review.state == 'approved') || (github.event_name == 'workflow_dispatch')
+ if: (github.event_name == 'pull_request_review' && github.event.review.state == 'approved') || (github.event_name == 'workflow_dispatch')
shell: bash
run: cat tests/test_results.log
- name: Check test results
- if: (github.event_name == 'pull_request_review' && github.event.review.state == 'approved') || (github.event_name == 'workflow_dispatch')
+ if: (github.event_name == 'pull_request_review' && github.event.review.state == 'approved') || (github.event_name == 'workflow_dispatch')
shell: bash
run: |
if test "$( grep 'test result: FAILED' -r tests/test_results.log | wc -l )" -gt "0"; then
diff --git a/.github/workflows/postman-collection-runner.yml b/.github/workflows/postman-collection-runner.yml
index 37c1bdd1b3..b7615524c3 100644
--- a/.github/workflows/postman-collection-runner.yml
+++ b/.github/workflows/postman-collection-runner.yml
@@ -16,7 +16,9 @@ env:
RUSTUP_MAX_RETRIES: 10
RUST_BACKTRACE: short
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
- CONNECTORS: aci, adyen_uk, airwallex, authorizedotnet, bambora, bambora_3ds, bluesnap, checkout, globalpay, mollie, nexinets, nmi, shift4, stripe, trustpay, worldline
+ CONNECTORS: "aci, adyen_uk, airwallex, authorizedotnet, bambora, bambora_3ds, bluesnap, checkout, globalpay, mollie, nexinets, nmi, shift4, stripe, trustpay, worldline"
+ SCCACHE_GHA_ENABLED: "true"
+ RUSTC_WRAPPER: "sccache"
jobs:
runner:
@@ -33,6 +35,7 @@ jobs:
--health-retries 5
ports:
- 6379:6379
+
postgres:
image: "${{ github.event_name != 'pull_request' && 'postgres:14.5' || '' }}"
env:
@@ -52,7 +55,7 @@ jobs:
if: github.event_name == 'pull_request'
shell: bash
run: |
- echo "Skipped tests as the event is pull request"
+ echo "Skipped tests as the event is pull request"
exit 0
- name: Repository checkout
@@ -87,9 +90,8 @@ jobs:
with:
toolchain: stable
- - name: Build and Cache Rust Dependencies
+ - uses: mozilla-actions/[email protected]
if: github.event_name != 'pull_request'
- uses: Swatinem/[email protected]
- name: Install Diesel CLI with Postgres Support
if: github.event_name != 'pull_request'
@@ -112,12 +114,12 @@ jobs:
cargo run &
COUNT=0
# Wait for the server to start in port 8080
- while netstat -lnt | awk '$4 ~ /:8080$/ {exit 1}'; do
+ while netstat -lnt | awk '$4 ~ /:8080$/ {exit 1}'; do
# Wait for 15 mins to start otherwise kill the task
if [ $COUNT -gt 90 ];
then
exit 1
- else
+ else
COUNT=$((COUNT+1))
sleep 10
fi
diff --git a/.github/workflows/validate-openapi-spec.yml b/.github/workflows/validate-openapi-spec.yml
index 72b76157f1..a25380ffad 100644
--- a/.github/workflows/validate-openapi-spec.yml
+++ b/.github/workflows/validate-openapi-spec.yml
@@ -11,6 +11,32 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
+env:
+ # Disable incremental compilation.
+ #
+ # Incremental compilation is useful as part of an edit-build-test-edit cycle,
+ # as it lets the compiler avoid recompiling code that hasn't changed. However,
+ # on CI, we're not making small edits; we're almost always building the entire
+ # project from scratch. Thus, incremental compilation on CI actually
+ # introduces *additional* overhead to support making future builds
+ # faster...but no future builds will ever occur in any given CI environment.
+ #
+ # See https://matklad.github.io/2021/09/04/fast-rust-builds.html#ci-workflow
+ # for details.
+ CARGO_INCREMENTAL: 0
+ # Allow more retries for network requests in cargo (downloading crates) and
+ # rustup (installing toolchains). This should help to reduce flaky CI failures
+ # from transient network timeouts or other issues.
+ CARGO_NET_RETRY: 10
+ RUSTUP_MAX_RETRIES: 10
+ # Don't emit giant backtraces in the CI logs.
+ RUST_BACKTRACE: short
+ # Use cargo's sparse index protocol
+ CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
+ # Enable and use the sccache action for caching
+ SCCACHE_GHA_ENABLED: "true"
+ RUSTC_WRAPPER: "sccache"
+
jobs:
validate_json:
name: Validate generated OpenAPI spec file
@@ -35,6 +61,8 @@ jobs:
with:
toolchain: stable
+ - uses: mozilla-actions/[email protected]
+
- name: Generate the OpenAPI spec file
shell: bash
run: cargo run --features openapi -- generate-openapi-spec