Skip to content

Commit c90c53d

Browse files
authored
Merge pull request #105 from Zondax/fix/cargo-config-cache-clobber
fix(ledger): re-checkout app/rust/.cargo/config.toml after Rust cache restore
2 parents 9e5715e + b9411b1 commit c90c53d

1 file changed

Lines changed: 48 additions & 0 deletions

File tree

.github/workflows/_ledger_main.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,14 @@ jobs:
121121
restore-keys: |
122122
${{ runner.os }}-rust-${{ runner.arch }}-
123123
${{ runner.os }}-rust-
124+
- name: Restore tracked cargo config (cache may carry a pre-migration copy)
125+
if: ${{ inputs.has-rust }}
126+
run: |
127+
git config --global --add safe.directory "$GITHUB_WORKSPACE"
128+
if git -C "$GITHUB_WORKSPACE" ls-files --error-unmatch app/rust/.cargo/config.toml >/dev/null 2>&1; then
129+
git -C "$GITHUB_WORKSPACE" checkout -- app/rust/.cargo/config.toml
130+
echo "Restored app/rust/.cargo/config.toml from checkout (a stale Rust cache can overwrite it with a pre-migration copy)."
131+
fi
124132
- name: Install rust-src component
125133
if: ${{ inputs.has-rust }}
126134
run: rustup component add rust-src --toolchain ${{ inputs.rust-version }}-x86_64-unknown-linux-gnu
@@ -268,6 +276,14 @@ jobs:
268276
restore-keys: |
269277
${{ runner.os }}-rust-${{ runner.arch }}-
270278
${{ runner.os }}-rust-
279+
- name: Restore tracked cargo config (cache may carry a pre-migration copy)
280+
if: ${{ inputs.has-rust }}
281+
run: |
282+
git config --global --add safe.directory "$GITHUB_WORKSPACE"
283+
if git -C "$GITHUB_WORKSPACE" ls-files --error-unmatch app/rust/.cargo/config.toml >/dev/null 2>&1; then
284+
git -C "$GITHUB_WORKSPACE" checkout -- app/rust/.cargo/config.toml
285+
echo "Restored app/rust/.cargo/config.toml from checkout (a stale Rust cache can overwrite it with a pre-migration copy)."
286+
fi
271287
- name: Install rust-src component
272288
if: ${{ inputs.has-rust }}
273289
run: rustup component add rust-src --toolchain ${{ inputs.rust-version }}-x86_64-unknown-linux-gnu
@@ -342,6 +358,14 @@ jobs:
342358
restore-keys: |
343359
${{ runner.os }}-rust-${{ runner.arch }}-
344360
${{ runner.os }}-rust-
361+
- name: Restore tracked cargo config (cache may carry a pre-migration copy)
362+
if: ${{ inputs.has-rust }}
363+
run: |
364+
git config --global --add safe.directory "$GITHUB_WORKSPACE"
365+
if git -C "$GITHUB_WORKSPACE" ls-files --error-unmatch app/rust/.cargo/config.toml >/dev/null 2>&1; then
366+
git -C "$GITHUB_WORKSPACE" checkout -- app/rust/.cargo/config.toml
367+
echo "Restored app/rust/.cargo/config.toml from checkout (a stale Rust cache can overwrite it with a pre-migration copy)."
368+
fi
345369
- name: Install rust-src component
346370
if: ${{ inputs.has-rust }}
347371
run: rustup component add rust-src --toolchain ${{ inputs.rust-version }}-x86_64-unknown-linux-gnu
@@ -416,6 +440,14 @@ jobs:
416440
restore-keys: |
417441
${{ runner.os }}-rust-${{ runner.arch }}-
418442
${{ runner.os }}-rust-
443+
- name: Restore tracked cargo config (cache may carry a pre-migration copy)
444+
if: ${{ inputs.has-rust }}
445+
run: |
446+
git config --global --add safe.directory "$GITHUB_WORKSPACE"
447+
if git -C "$GITHUB_WORKSPACE" ls-files --error-unmatch app/rust/.cargo/config.toml >/dev/null 2>&1; then
448+
git -C "$GITHUB_WORKSPACE" checkout -- app/rust/.cargo/config.toml
449+
echo "Restored app/rust/.cargo/config.toml from checkout (a stale Rust cache can overwrite it with a pre-migration copy)."
450+
fi
419451
- name: Install rust-src component
420452
if: ${{ inputs.has-rust }}
421453
run: rustup component add rust-src --toolchain ${{ inputs.rust-version }}-x86_64-unknown-linux-gnu
@@ -489,6 +521,14 @@ jobs:
489521
restore-keys: |
490522
${{ runner.os }}-rust-${{ runner.arch }}-
491523
${{ runner.os }}-rust-
524+
- name: Restore tracked cargo config (cache may carry a pre-migration copy)
525+
if: ${{ inputs.has-rust }}
526+
run: |
527+
git config --global --add safe.directory "$GITHUB_WORKSPACE"
528+
if git -C "$GITHUB_WORKSPACE" ls-files --error-unmatch app/rust/.cargo/config.toml >/dev/null 2>&1; then
529+
git -C "$GITHUB_WORKSPACE" checkout -- app/rust/.cargo/config.toml
530+
echo "Restored app/rust/.cargo/config.toml from checkout (a stale Rust cache can overwrite it with a pre-migration copy)."
531+
fi
492532
- name: Install rust-src component
493533
if: ${{ inputs.has-rust }}
494534
run: rustup component add rust-src --toolchain ${{ inputs.rust-version }}-x86_64-unknown-linux-gnu
@@ -562,6 +602,14 @@ jobs:
562602
restore-keys: |
563603
${{ runner.os }}-rust-${{ runner.arch }}-
564604
${{ runner.os }}-rust-
605+
- name: Restore tracked cargo config (cache may carry a pre-migration copy)
606+
if: ${{ inputs.has-rust }}
607+
run: |
608+
git config --global --add safe.directory "$GITHUB_WORKSPACE"
609+
if git -C "$GITHUB_WORKSPACE" ls-files --error-unmatch app/rust/.cargo/config.toml >/dev/null 2>&1; then
610+
git -C "$GITHUB_WORKSPACE" checkout -- app/rust/.cargo/config.toml
611+
echo "Restored app/rust/.cargo/config.toml from checkout (a stale Rust cache can overwrite it with a pre-migration copy)."
612+
fi
565613
- name: Install rust-src component
566614
if: ${{ inputs.has-rust }}
567615
run: rustup component add rust-src --toolchain ${{ inputs.rust-version }}-x86_64-unknown-linux-gnu

0 commit comments

Comments
 (0)