Skip to content

Commit c3f708f

Browse files
.github: change workflow cargo patching
1 parent 1362f0f commit c3f708f

1 file changed

Lines changed: 22 additions & 14 deletions

File tree

.github/workflows/tock-build.yml

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ on:
55
push:
66
branches: ["**"] # any branch push
77
pull_request:
8-
branches: [main] # merges into main
8+
branches: [main] # PRs into main
99
schedule:
10-
- cron: "0 6 * * *" # nightly (6 AM UTC)
10+
- cron: "0 6 * * *" # nightly
1111
workflow_dispatch:
1212

1313
jobs:
@@ -36,7 +36,6 @@ jobs:
3636
else
3737
# Manual dispatch = full test
3838
echo 'matrix={"source":["ci-branch","main","crate"]}' >> $GITHUB_OUTPUT
39-
fi
4039
4140
build-tock:
4241
needs: determine-matrix
@@ -70,27 +69,33 @@ jobs:
7069
git submodule update --init --recursive
7170
7271
# -------------------------------------------------
73-
# Variant 1: Use CURRENT CI branch (most important)
74-
# BEST for pushes to feature branches
72+
# Variant 1: Use CURRENT CI branch (local checkout)
7573
# -------------------------------------------------
76-
- name: Patch abacus_registers -> local checkout (CI branch)
74+
- name: Patch abacus_registers -> local CI checkout
7775
if: matrix.source == 'ci-branch'
7876
run: |
79-
echo "Using local abacus-registers checkout (branch: ${GITHUB_REF_NAME})"
8077
cd tock
81-
printf '\n[patch.crates-io]\n' >> Cargo.toml
82-
printf 'abacus_registers = { path = "../" }\n' >> Cargo.toml
78+
mkdir -p .cargo
79+
cat > .cargo/config.toml << 'EOF'
80+
[patch.crates-io]
81+
abacus_registers = { path = "../" }
82+
83+
[patch."https://github.com/abacus-rs/abacus-registers"]
84+
abacus_registers = { path = "../" }
85+
EOF
8386

8487
# -------------------------------------------------
8588
# Variant 2: Force main branch of abacus_registers
86-
# Used for PRs + nightly
8789
# -------------------------------------------------
8890
- name: Patch abacus_registers -> git main
8991
if: matrix.source == 'main'
9092
run: |
9193
cd tock
92-
printf '\n[patch."https://github.com/abacus-rs/abacus-registers"]\n' >> Cargo.toml
93-
printf 'abacus_registers = { git = "https://github.com/abacus-rs/abacus-registers", branch = "main" }\n' >> Cargo.toml
94+
mkdir -p .cargo
95+
cat > .cargo/config.toml << 'EOF'
96+
[patch."https://github.com/abacus-rs/abacus-registers"]
97+
abacus_registers = { git = "https://github.com/abacus-rs/abacus-registers", branch = "main" }
98+
EOF
9499

95100
# -------------------------------------------------
96101
# Variant 3: crates.io (disabled until published)
@@ -99,8 +104,11 @@ jobs:
99104
if: matrix.source == 'crate'
100105
run: |
101106
cd tock
102-
printf '\n[patch.crates-io]\n' >> Cargo.toml
103-
printf 'abacus_registers = { version = "*" }\n' >> Cargo.toml
107+
mkdir -p .cargo
108+
cat > .cargo/config.toml << 'EOF'
109+
[patch.crates-io]
110+
abacus_registers = { version = "*" }
111+
EOF
104112

105113
- name: Show resolved abacus source
106114
run: |

0 commit comments

Comments
 (0)