Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(ci): from Make to just #101

Merged
merged 4 commits into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,8 @@ jobs:

linkcheck-docs:
runs-on: ubuntu-latest
env:
NO_RYE: 1
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand All @@ -291,7 +293,8 @@ jobs:
- name: Install dependencies
run: pip install -r requirements-dev.lock

- name: Install Just
uses: taiki-e/install-action@just

- name: Check links in documentation
run: |
cd docs
NB_OFF=1 make linkcheck
run: just docs/linkcheck
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ target/
# Docs

docs/build/
docs/jupyter_execute/
docs/source/reference/*.rst

# Sionna data
Expand Down
15 changes: 11 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,16 @@ To run build this package locally, you need:

- [Python 3.9](https://www.python.org/) or above;
- [Rust](https://www.rust-lang.org/) stable toolchain;
- `make` (e.g., GNU Make or Make for Windows);
- [just](https://github.com/casey/just) to easily run commands listed in `justfile`s;
- [Maturin](https://www.maturin.rs/) for building Python bindings from Rust code;
- and [Rye](https://rye.astral.sh/) to manage this project.

This project contains `justfile`s with recipes[^1] for most common
use cases, so feel free to use them instead of the commands listed below/

[^1]: `just` is as alternative tool to Make, that provides more modern
user experience. Enter `just` to list all available recipes.

## Local development

The following commands assume that you installed
Expand All @@ -77,11 +83,12 @@ and that you activated the corresponding Python virtual environment:
To generate the documentation, please run the following:

```bash
cd docs
make html
just docs/build
```

Finally, you can open `build/html/index.html` to see the generated docs.
Finally, you can open `docs/build/html/index.html` to see the generated docs.

Other recipes are available, and you can list them with `just docs/`.

### Testing

Expand Down
26 changes: 0 additions & 26 deletions docs/Makefile

This file was deleted.

24 changes: 24 additions & 0 deletions docs/justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Run Python commands inside environment
env-run := if env("NO_RYE", "") == "1" { "" } else { "rye run" }

# Default command (list all commands)
default:
@just --list

# Clean build artifacts
clean:
rm -rf build
rm -f source/reference/*.rst

# Build docs
build builder="html" *OPTIONS="-W --keep-going":
{{env-run}} sphinx-build {{OPTIONS}} -b={{builder}} source build

# Build docs in "draft" mode
draft *ARGS:
NB_OFF="1" just build {{ARGS}}

# Check links
linkcheck *ARGS: (draft "linkcheck" ARGS)

alias check := linkcheck
72 changes: 72 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Run Python commands inside environment
env-run := if env("NO_RYE", "") == "1" { "" } else { "rye run" }

# Default command (list all commands)
default:
@just --list

# Benchmark code
[group('test')]
bench: bench-python bench-rust

# Benchmark Python code
[group('python')]
[group('test')]
bench-python *ARGS:
pytest --benchmark-only {{ARGS}}

# Benchmark Rust code
[group('rust')]
[group('test')]
bench-rust *ARGS:
cargo bench {{ARGS}}

# Build Python package(s)
[group('dev')]
build *ARGS:
rye build {{ARGS}}

# Bump packages version
[group('dev')]
bump +ARGS="patch":
{{env-run}} bump-my-version {{ARGS}}

# Check the code can compile
[group('rust')]
[group('test')]
check:
cargo check

# Clean build artifacts
[group('dev')]
clean:
cargo clean
rm -rf dist

# Build and install Python packages
[group('dev')]
install:
rye sync

# Run code linters and formatters
[group('dev')]
lint:
{{env-run}} pre-commit run --all-files

alias fmt := lint

# Test code
[group('test')]
test: test-python test-rust

# Test Python code
[group('python')]
[group('test')]
test-python *ARGS:
{{env-run}} pytest {{ARGS}}

# Test Rust code
[group('rust')]
[group('test')]
test-rust *ARGS:
cargo test {{ARGS}}