Skip to content

Commit 6eaabaa

Browse files
authored
Merge pull request #654 from tyreseluo/fix/ci-makepad-rev
2 parents 5972032 + 80159d8 commit 6eaabaa

File tree

4 files changed

+55
-19
lines changed

4 files changed

+55
-19
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Setup cargo-makepad
2+
description: Resolve Makepad revision from Cargo.lock and install cargo-makepad.
3+
inputs:
4+
lockfile:
5+
description: Path to Cargo.lock
6+
required: false
7+
default: Cargo.lock
8+
runs:
9+
using: composite
10+
steps:
11+
- name: Resolve Makepad revision
12+
id: makepad
13+
shell: bash
14+
run: |
15+
bash "$GITHUB_ACTION_PATH/scripts/resolve-makepad-rev.sh" "${{ inputs.lockfile }}" >> "$GITHUB_OUTPUT"
16+
- name: Install cargo-makepad
17+
shell: bash
18+
run: |
19+
cargo install --force --git "${{ steps.makepad.outputs.repo }}" --rev "${{ steps.makepad.outputs.rev }}" cargo-makepad
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
lockfile="${1:-Cargo.lock}"
5+
6+
source_line="$(
7+
awk '
8+
$1 == "name" && $3 == "\"makepad-widgets\"" { in_pkg = 1; next }
9+
in_pkg && $1 == "source" { print $3; exit }
10+
in_pkg && $1 == "[[package]]" { in_pkg = 0 }
11+
' "$lockfile"
12+
)"
13+
14+
if [[ -z "$source_line" ]]; then
15+
echo "error=makepad-widgets source not found in $lockfile" >&2
16+
exit 1
17+
fi
18+
19+
source_line="${source_line%\"}"
20+
source_line="${source_line#\"}"
21+
source_line="${source_line#git+}"
22+
23+
rev="${source_line##*#}"
24+
repo_with_query="${source_line%#*}"
25+
repo="${repo_with_query%%\?*}"
26+
27+
printf 'repo=%s\n' "$repo"
28+
printf 'rev=%s\n' "$rev"

.github/workflows/builds.yml

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -171,10 +171,8 @@ jobs:
171171
run: |
172172
rustup toolchain install nightly
173173
174-
- name: Install cargo-makepad
175-
# The git repo and branch MUST MATCH the `makepad-widgets` dependency defined in `Cargo.toml`.
176-
run: |
177-
cargo install --force --git https://github.com/kevinaboos/makepad.git --branch serde_optional cargo-makepad
174+
- name: Setup cargo-makepad
175+
uses: ./.github/actions/setup-cargo-makepad
178176

179177
- name: Install iOS toolchain
180178
run: |
@@ -209,10 +207,8 @@ jobs:
209207
- name: Install Rust
210208
uses: dtolnay/rust-toolchain@stable
211209

212-
- name: Install cargo-makepad
213-
# The git repo and branch MUST MATCH the `makepad-widgets` dependency defined in `Cargo.toml`.
214-
run: |
215-
cargo install --force --git https://github.com/kevinaboos/makepad.git --branch serde_optional cargo-makepad
210+
- name: Setup cargo-makepad
211+
uses: ./.github/actions/setup-cargo-makepad
216212

217213
- name: Install Android toolchain
218214
run: |
@@ -239,10 +235,8 @@ jobs:
239235
- name: Install Rust
240236
uses: dtolnay/rust-toolchain@stable
241237

242-
- name: Install cargo-makepad
243-
# The git repo and branch MUST MATCH the `makepad-widgets` dependency defined in `Cargo.toml`.
244-
run: |
245-
cargo install --force --git https://github.com/kevinaboos/makepad.git --branch serde_optional cargo-makepad
238+
- name: Setup cargo-makepad
239+
uses: ./.github/actions/setup-cargo-makepad
246240

247241
- name: Install Android toolchain
248242
run: |
@@ -274,10 +268,8 @@ jobs:
274268
with:
275269
key: android-windows-build-${{ hashFiles('Cargo.lock') }}
276270

277-
- name: Install cargo-makepad
278-
# The git repo and branch MUST MATCH the `makepad-widgets` dependency defined in `Cargo.toml`.
279-
run: |
280-
cargo install --force --git https://github.com/kevinaboos/makepad.git --branch serde_optional cargo-makepad
271+
- name: Setup cargo-makepad
272+
uses: ./.github/actions/setup-cargo-makepad
281273

282274
- name: Install Android toolchain
283275
run: |

Cargo.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@ version = "0.0.1-pre-alpha-4"
1616
metadata.makepad-auto-version = "zqpv-Yj-K7WNVK2I8h5Okhho46Q="
1717

1818
[dependencies]
19-
## !NOTE! When updating the makepad dependency, be sure to also change the repo and branch
20-
## !!!!!! that are used in `builds.yml` for installing cargo makepad from git.
21-
## !!!!!! The version (git repo + branch) installed in CI actions should the one defined here.
2219
makepad-widgets = { git = "https://github.com/kevinaboos/makepad", branch = "serde_optional", features = ["serde"] }
2320
# makepad-widgets = { git = "https://github.com/makepad/makepad", branch = "dev", features = ["serde"] }
2421

0 commit comments

Comments
 (0)