Skip to content

Commit 70b42c2

Browse files
committed
ci: move to pixi for checks
1 parent cab27f2 commit 70b42c2

File tree

4 files changed

+77
-17
lines changed

4 files changed

+77
-17
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -48,31 +48,19 @@ jobs:
4848
path: target
4949
key: ${{ runner.os }}-cargo-build-target-${{ matrix.toolchain }}-${{ hashFiles('**/Cargo.lock') }}
5050

51-
- name: Cache cargo bin # bc wow why does it take three minutes to build `cargo-deny`
51+
- name: Cache cargo bin
5252
uses: actions/cache@v4
5353
with:
5454
path: ~/.cargo/bin
5555
key: ${{ runner.os }}-cargo-bin-${{ hashFiles('**/Cargo.lock') }}
5656

5757
- name: Build
58-
run: cargo build --verbose
58+
run: pixi run build
5959

6060
- name: Install `cargo` tools to do more testing
6161
uses: taiki-e/install-action@v2
6262
with:
63-
tool: cargo-deny,cargo-nextest,cargo-rdme
63+
tool: cargo-deny,cargo-machete,cargo-nextest,cargo-rdme
6464

65-
- name: Check for unused dependencies
66-
uses: bnjbvr/cargo-machete@main
67-
68-
- name: Make sure README is up-to-date
69-
run: cargo rdme --check
70-
71-
- name: Run cargo-deny
72-
run: cargo deny check
73-
74-
- name: Run tests
75-
run: cargo nextest run
76-
77-
- name: Run doctests
78-
run: cargo test --doc
65+
- name: Run checks
66+
run: pixi run check

.scripts/check.bash

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
set -e
3+
4+
# check for unused dependencies
5+
cargo machete
6+
7+
# ensure readme is up-to-date
8+
cargo rdme --check
9+
10+
# check dependency security
11+
cargo deny check
12+
13+
# run our test suite
14+
cargo nextest run
15+
16+
# run doc tests
17+
cargo test --doc

.scripts/check.pre.bash

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#!/bin/bash
2+
set -e
3+
4+
# ensure `cargo` is present!
5+
if ! command -v cargo >/dev/null 2>&1; then
6+
echo "Failed to find \`cargo\` installation!"
7+
exit 255
8+
fi
9+
10+
# ...and that curl is around
11+
if ! command -v curl >/dev/null 2>&1; then
12+
echo "Failed to find \`curl\`!"
13+
echo "Since you've installed \`pixi\`, you probably have it installed. So, please ensure it's in your path."
14+
exit 255
15+
fi
16+
17+
# great..! now, grab `cargo-binstall` if it isn't installed already!
18+
if ! command -v cargo-binstall >/dev/null 2>&1; then
19+
echo "Installing \`cargo-binstall\`..."
20+
curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
21+
echo "Completed \`cargo-binstall\` installation!"
22+
fi
23+
24+
# if not present, install each tool...
25+
#
26+
# ...cargo-rdme
27+
if ! command -v cargo-rdme >/dev/null 2>&1; then
28+
echo "Installing \`cargo-rdme\`..."
29+
cargo binstall cargo-rdme -y --quiet
30+
echo "Completed \`cargo-rdme\` installation!"
31+
fi
32+
#
33+
# ...cargo-deny
34+
if ! command -v cargo-deny >/dev/null 2>&1; then
35+
echo "Installing \`cargo-deny\`..."
36+
cargo binstall cargo-deny -y --quiet
37+
echo "Completed \`cargo-deny\` installation!"
38+
fi
39+
#
40+
# ...cargo-machete
41+
if ! command -v cargo-machete >/dev/null 2>&1; then
42+
echo "Installing \`cargo-machete\`..."
43+
cargo binstall cargo-machete -y --quiet
44+
echo "Completed \`cargo-machete\` installation!"
45+
fi
46+
#
47+
# ...cargo-nextest
48+
if ! command -v cargo-nextest >/dev/null 2>&1; then
49+
echo "Installing \`cargo-nextest\`..."
50+
cargo binstall cargo-nextest -y --quiet
51+
echo "Completed \`cargo-nextest\` installation!"
52+
fi

pixi.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ platforms = ["linux-64", "linux-aarch64", "osx-arm64"]
66
version = "0.1.0"
77

88
[tasks]
9+
build = "cargo build"
10+
check_pre = "bash $PIXI_PROJECT_ROOT/.scripts/check.pre.bash"
11+
check = { cmd = "bash $PIXI_PROJECT_ROOT/.scripts/check.bash", depends-on = ["check_pre"] }
912

1013
[activation.env]
1114
# without this, the build fails due to a lack of `libclang` within Rust's

0 commit comments

Comments
 (0)