Skip to content

Commit 8a0edcb

Browse files
authored
ci: switch from makefile to justfile (#353)
1 parent 5781660 commit 8a0edcb

8 files changed

Lines changed: 116 additions & 64 deletions

File tree

.github/actions/project-setup/action.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,8 @@ runs:
6868
shell: bash
6969
run: |
7070
curl -L https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
71+
72+
- name: Install just
73+
uses: extractions/setup-just@v3
74+
with:
75+
just-version: 1.46.0

.github/workflows/benchmark.yml

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -27,35 +27,17 @@ jobs:
2727
steps:
2828
- uses: actions/checkout@v4
2929

30-
# - name: Cache cargo
31-
# uses: actions/cache@v4
32-
# with:
33-
# path: |
34-
# ~/.cargo/registry
35-
# ~/.cargo/git
36-
# target
37-
# key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
38-
39-
# - name: Cargo clean if target too large
40-
# run: make clean
41-
4230
- name: Cache uv
4331
uses: actions/cache@v4
4432
with:
4533
path: ~/.cache/uv
4634
key: ${{ runner.os }}-uv-${{ hashFiles('pyproject.toml') }}
4735

48-
# - name: Cache cargo binaries
49-
# uses: actions/cache@v4
50-
# with:
51-
# path: ~/.cargo/bin
52-
# key: ${{ runner.os }}-cargo-bins
53-
5436
- name: Project setup
5537
uses: ./.github/actions/project-setup
5638

5739
- name: Install test dependencies
58-
run: make setup
40+
run: just setup
5941

6042
- name: Install codspeed
6143
run: cargo binstall cargo-codspeed --no-confirm --force

.github/workflows/ci.yml

Lines changed: 2 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -33,30 +33,12 @@ jobs:
3333
steps:
3434
- uses: actions/checkout@v4
3535

36-
# - name: Cache cargo
37-
# uses: actions/cache@v4
38-
# with:
39-
# path: |
40-
# ~/.cargo/registry
41-
# ~/.cargo/git
42-
# target
43-
# key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
44-
45-
# - name: Cargo clean if target too large
46-
# run: make clean
47-
4836
- name: Cache uv
4937
uses: actions/cache@v4
5038
with:
5139
path: ~/.cache/uv
5240
key: ${{ runner.os }}-uv-${{ hashFiles('pyproject.toml') }}
5341

54-
# - name: Cache cargo binaries
55-
# uses: actions/cache@v4
56-
# with:
57-
# path: ~/.cargo/bin
58-
# key: ${{ runner.os }}-cargo-bins
59-
6042
- name: Project setup
6143
uses: ./.github/actions/project-setup
6244

@@ -67,7 +49,7 @@ jobs:
6749
run: cargo binstall cargo-llvm-cov --force --no-confirm
6850

6951
- name: Generate coverage
70-
run: make coverage
52+
run: just coverage
7153

7254
- name: Upload to codecov
7355
uses: codecov/codecov-action@v2
@@ -82,30 +64,12 @@ jobs:
8264
steps:
8365
- uses: actions/checkout@v4
8466

85-
# - name: Cache cargo
86-
# uses: actions/cache@v4
87-
# with:
88-
# path: |
89-
# ~/.cargo/registry
90-
# ~/.cargo/git
91-
# target
92-
# key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
93-
94-
# - name: Cargo clean if target too large
95-
# run: make clean
96-
9767
- name: Cache uv
9868
uses: actions/cache@v4
9969
with:
10070
path: ~/.cache/uv
10171
key: ${{ runner.os }}-uv-${{ hashFiles('pyproject.toml') }}
10272

103-
# - name: Cache cargo binaries
104-
# uses: actions/cache@v4
105-
# with:
106-
# path: ~/.cargo/bin
107-
# key: ${{ runner.os }}-cargo-bins
108-
10973
- name: Project setup
11074
uses: ./.github/actions/project-setup
11175
with:
@@ -114,4 +78,4 @@ jobs:
11478
- run: rustup component add --toolchain nightly-x86_64-unknown-linux-gnu clippy
11579

11680
- name: Run Clippy
117-
run: make lint
81+
run: just lint

CONTRIBUTING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ git clone https://github.com/mozilla-ai/encoderfile.git
3838
cd encoderfile
3939

4040
# Set up development environment
41-
make setup
41+
just setup
4242

4343
# Run tests
44-
make test
44+
just test
4545

4646
# Build documentation
47-
make docs
47+
just docs
4848
```

Justfile

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# Setup
2+
setup:
3+
@echo "creating .venv"
4+
@uv sync --locked
5+
6+
# Build
7+
build-py:
8+
uv run maturin develop \
9+
-m encoderfile-py/Cargo.toml
10+
11+
# Docs
12+
docs:
13+
@uv run --group docs -m mkdocs serve
14+
15+
# Check, Test, & Coverage
16+
17+
check:
18+
@cargo hack check --each-feature
19+
20+
coverage:
21+
@cargo llvm-cov \
22+
--workspace \
23+
--all-features \
24+
--lcov \
25+
--output-path lcov.info
26+
27+
pre-commit:
28+
@uv run --dev pre-commit run --all-files
29+
30+
# Lint & Format
31+
[parallel]
32+
format: format-rs format-py
33+
34+
format-rs:
35+
@cargo fmt
36+
37+
format-py:
38+
@uv run --dev -m ruff format
39+
40+
[parallel]
41+
lint: lint-rs lint-py
42+
43+
lint-rs:
44+
@cargo clippy \
45+
--all-features \
46+
--all-targets \
47+
-- \
48+
-D warnings
49+
50+
lint-py:
51+
# ruff check
52+
@uv run ruff check
53+
54+
stubtest:
55+
@uv run \
56+
--dev \
57+
stubtest \
58+
--allowlist=allowlist.txt \
59+
encoderfile._core
60+
61+
# Assets
62+
generate-test-models:
63+
@uv run \
64+
--group models \
65+
scripts/generate_dummy_models.py
66+
67+
generate-docs:
68+
# JSON schema for encoderfile config
69+
@cargo run \
70+
--bin generate-encoderfile-config-schema \
71+
--all-features
72+
73+
licenses:
74+
@echo "Generating licenses..."
75+
@cargo about generate about.hbs > THIRDPARTY.md
76+
77+
# Utilities
78+
target_max_mb := "2000"
79+
80+
clean:
81+
#!/usr/bin/env bash
82+
if [ -d target ]; then
83+
target_size_mb=$(du -sm target | cut -f1)
84+
echo "target/ size: ${target_size_mb} MB"
85+
if [ "${target_size_mb}" -gt "{{target_max_mb}}" ]; then
86+
echo "target/ exceeds {{target_max_mb}} MB — running cargo clean..."
87+
cargo clean
88+
else
89+
echo "target/ size within limits — skipping clean."
90+
fi
91+
else
92+
echo "target/ does not exist — skipping clean."
93+
fi

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -263,19 +263,21 @@ We welcome contributions! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
263263

264264
### Development Setup
265265

266+
Make sure you have [Just](https://github.com/casey/just) installed.
267+
266268
```bash
267269
# Clone the repository
268270
git clone https://github.com/mozilla-ai/encoderfile.git
269271
cd encoderfile
270272
271273
# Set up development environment
272-
make setup
274+
just setup
273275
274276
# Run tests
275-
make test
277+
just test
276278
277279
# Build documentation
278-
make docs
280+
just docs
279281
```
280282

281283
## 📄 License

allowlist.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
# ignore missing __all__ in encoderfile
22
encoderfile._core.__all__
33
# encoderfile.encoderfile.EncoderfileBuilder.from_config
4+
5+
# allow 'n' parameter for Fixed
6+
encoderfile._core.Fixed.__new__
7+
8+
# run_cli should not be exposed publicly
9+
encoderfile._core.run_cli

docs/reference/building.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ git clone https://github.com/mozilla-ai/encoderfile.git
6565
cd encoderfile
6666

6767
# Set up the development environment
68-
make setup
68+
just setup
6969
```
7070

7171
This will:

0 commit comments

Comments
 (0)