Skip to content

Commit

Permalink
+ cargo binstall
Browse files Browse the repository at this point in the history
  • Loading branch information
AtomicGamer9523 committed Nov 11, 2023
1 parent c0bd037 commit 3328826
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ jobs:
uses: dtolnay/rust-toolchain@stable
with:
target: aarch64-linux-android
- name: Set up Rust Part 2
uses: cargo-bins/cargo-binstall@main
- name: Install rustup target
run: rustup target add aarch64-linux-android
- name: Set up Python
Expand All @@ -78,6 +80,8 @@ jobs:
uses: dtolnay/rust-toolchain@stable
with:
profile: minimal
- name: Set up Rust Part 2
uses: cargo-bins/cargo-binstall@main
- name: Set up Python
uses: actions/setup-python@v4
with:
Expand Down
14 changes: 14 additions & 0 deletions libs/scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,20 @@ def fmt(cd: str, args: list[str]) -> str | int | None:
if res.returncode != 0: exit(res.returncode)

def test(cd: str, args: list[str]) -> str | int | None:
# Check if tarpaulin is installed
def is_tarpaulin_installed() -> bool:
res = subprocess.run(["cargo", "tarpaulin", "--version"], capture_output=True)
return res.returncode == 0

# Install tarpaulin
def install_tarpaulin() -> None:
res = subprocess.run(["cargo", "binstall", "cargo-tarpaulin"])
if res.returncode != 0: exit(res.returncode)

# Check if tarpaulin is installed and install it if it isn't
if not is_tarpaulin_installed(): install_tarpaulin()

# Run tarpaulin
cmd = ["cargo", "tarpaulin"]
cmd.extend(args)
res = subprocess.run(cmd, cwd=cd)
Expand Down

0 comments on commit 3328826

Please sign in to comment.