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: move check-msrv sccache to S3 and run it on hyperswitch-runners (#14847)

Hrithikesh2b4346f59dce
diff --git a/.github/workflows/CI-pr.yml b/.github/workflows/CI-pr.yml
index 6cba9a8a19..6105486643 100644
--- a/.github/workflows/CI-pr.yml
+++ b/.github/workflows/CI-pr.yml
@@ -72,23 +72,17 @@ jobs:
check-msrv:
name: Check compilation on MSRV toolchain
- runs-on: ${{ matrix.runner }}
+ runs-on: hyperswitch-runners
if: ${{ ! startsWith(github.event.pull_request.base.ref, 'hotfix-') }}
env:
- # sccache on local disk via actions/cache, not SCCACHE_GHA_ENABLED (slower here; see git log).
+ # sccache restored as one archive instead of S3 — avoids per-object round trips.
RUSTC_WRAPPER: sccache
SCCACHE_DIR: ${{ github.workspace }}/.sccache
SCCACHE_CACHE_SIZE: "2G"
SCCACHE_IDLE_TIMEOUT: "0"
RUSTFLAGS: "-D warnings"
- strategy:
- fail-fast: false
- matrix:
- runner:
- - ubuntu-latest
-
steps:
- name: Checkout repository
uses: actions/checkout@v7
@@ -115,20 +109,35 @@ jobs:
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
+ - name: Mask S3 cache location in job logs
+ shell: bash
+ run: .github/scripts/sccache-mask-s3-env.sh
+
- name: Install sccache
uses: taiki-e/install-action@v2
with:
tool: sccache
checksum: true
- - name: Restore sccache cache
- uses: actions/cache/restore@v6
- with:
- path: ${{ env.SCCACHE_DIR }}
- key: sccache-local-check-msrv-${{ runner.os }}-${{ runner.arch }}
+ # PRs changing third-party crates get their own cache key; others share. See the script.
+ - name: Decide the sccache scope for this PR
+ id: cache_scope
+ shell: bash
+ run: |
+ .github/scripts/sccache-cache-scope.sh \
+ "${{ github.event.pull_request.base.sha }}" \
+ "${{ github.event.pull_request.number }}" \
+ "${{ github.event.pull_request.head.repo.full_name == github.repository }}"
+
+ - name: Restore sccache cache from S3
+ continue-on-error: true
+ shell: bash
+ run: .github/scripts/sccache-restore-s3.sh check-msrv "${{ steps.cache_scope.outputs.scope }}"
- name: Run cargo check
shell: bash
+ env:
+ CARGO_BUILD_JOBS: 10
run: cargo check --features "release"
- name: Show sccache stats
@@ -136,6 +145,14 @@ jobs:
shell: bash
run: sccache --show-stats
+ # Only for PRs that changed Cargo.lock (see the scope step). Writes a PR-scoped
+ # key, never clobbering the shared cache. `!cancelled()`: cache on failure, skip on cancel.
+ - name: Save sccache cache to S3
+ if: ${{ !cancelled() && steps.cache_scope.outputs.scope != '' }}
+ continue-on-error: true
+ shell: bash
+ run: .github/scripts/sccache-save-s3.sh check-msrv "${{ steps.cache_scope.outputs.scope }}"
+
test:
name: Run tests on stable toolchain
runs-on: hyperswitch-runners
diff --git a/.github/workflows/CI-push.yml b/.github/workflows/CI-push.yml
index 3c0003ef1b..fc6f15b30d 100644
--- a/.github/workflows/CI-push.yml
+++ b/.github/workflows/CI-push.yml
@@ -54,28 +54,16 @@ jobs:
check-msrv:
name: Check compilation on MSRV toolchain
- runs-on: ${{ matrix.runner }}
-
- permissions:
- contents: read
- # actions/cache keys are immutable; needed for `gh cache delete`.
- actions: write
+ runs-on: hyperswitch-runners
env:
- # sccache on local disk via actions/cache, not SCCACHE_GHA_ENABLED
- # (proven slower here before — see git log for check-msrv).
+ # sccache restored as one archive instead of S3 — avoids per-object round trips.
RUSTC_WRAPPER: sccache
SCCACHE_DIR: ${{ github.workspace }}/.sccache
SCCACHE_CACHE_SIZE: "2G"
SCCACHE_IDLE_TIMEOUT: "0"
RUSTFLAGS: "-D warnings"
- strategy:
- fail-fast: true
- matrix:
- runner:
- - ubuntu-latest
-
steps:
- name: Checkout repository
uses: actions/checkout@v7
@@ -102,18 +90,6 @@ jobs:
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- - name: Install sccache
- uses: taiki-e/install-action@v2
- with:
- tool: sccache
- checksum: true
-
- - name: Restore sccache cache
- uses: actions/cache/restore@v6
- with:
- path: ${{ env.SCCACHE_DIR }}
- key: sccache-local-check-msrv-${{ runner.os }}-${{ runner.arch }}
-
- name: Install cargo-hack
uses: taiki-e/install-action@v2
with:
@@ -130,8 +106,25 @@ jobs:
shell: bash
run: .github/scripts/install-jq.sh
+ - name: Mask S3 cache location in job logs
+ shell: bash
+ run: .github/scripts/sccache-mask-s3-env.sh
+
+ - name: Install sccache
+ uses: taiki-e/install-action@v2
+ with:
+ tool: sccache
+ checksum: true
+
+ - name: Restore sccache cache from S3
+ continue-on-error: true
+ shell: bash
+ run: .github/scripts/sccache-restore-s3.sh check-msrv
+
- name: Run cargo check
shell: bash
+ env:
+ CARGO_BUILD_JOBS: 10
run: cargo check --features "release"
- name: Show sccache stats
@@ -140,20 +133,11 @@ jobs:
run: sccache --show-stats
# !cancelled(), not always() — cache-on-failure, but skip on cancel.
- - name: Delete stale sccache cache entry
+ - name: Save sccache cache to S3
if: ${{ !cancelled() && github.event_name == 'push' }}
continue-on-error: true
shell: bash
- env:
- GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: gh cache delete "sccache-local-check-msrv-${{ runner.os }}-${{ runner.arch }}" --repo "${{ github.repository }}"
-
- - name: Save sccache cache
- if: ${{ !cancelled() && github.event_name == 'push' }}
- uses: actions/cache/save@v6
- with:
- path: ${{ env.SCCACHE_DIR }}
- key: sccache-local-check-msrv-${{ runner.os }}-${{ runner.arch }}
+ run: .github/scripts/sccache-save-s3.sh check-msrv
# cargo-deny:
# name: Run cargo-deny