Skip to content

Commit

Permalink
test Rust and Python code in guidebook
Browse files Browse the repository at this point in the history
  • Loading branch information
apparebit committed Aug 12, 2024
1 parent 249950b commit f6c5af7
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 3 deletions.
21 changes: 19 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ jobs:
- name: Set up stable Rust
run: rustup toolchain install stable

- name: Install mdBook
run: cargo install mdbook

- name: Check Rust code (with & without features)
run: |
cargo check
Expand All @@ -59,17 +62,31 @@ jobs:
run: cargo test

- name: Build extension module
run: pip install -e .

- name: Create symbolic links
if: runner.os != 'Windows'
run: |
pip install -e .
mkdir -p prettypretty/color
ln -s '../color.abi3.so' prettypretty/color/gamut.abi3.so
ln -s '../color.abi3.so' prettypretty/color/spectrum.abi3.so
ln -s '../color.abi3.so' prettypretty/color/term.abi3.so
ln -s '../color.abi3.so' prettypretty/color/style.abi3.so
ln -s '../color.abi3.so' prettypretty/color/trans.abi3.so
- name: Typecheck and test Python code
run: python -m runtest

- name: Test guide's Rust examples
run: |
cargo clean
cargo build
mdbook test -L target/debug/deps docs
- name: Test guide's Python examples
run: |
mdbook build docs
python docs/book.py
linux:
runs-on: ${{ matrix.platform.runner }}
strategy:
Expand Down
12 changes: 11 additions & 1 deletion rr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ install_tool() {
}

install() {
print_run_header "Update $INSTALLER and its packages"
print_run_header "Updating $INSTALLER and its packages"
installer_update
echo

Expand Down Expand Up @@ -162,12 +162,22 @@ check() {
run cargo clippy
run cargo clippy --all-features
run cargo test

if [ -d prettypretty ]; then
run npm run pyright -- --pythonpath ./.venv/bin/python
fi
if [ -d test ]; then
run run_python_tests
fi

print_run_header "Testing guide's Rust examples"
cargo clean
cargo build
mdbook test -L target/debug/deps docs

print_run_header "Testing guide's Python examples"
mdbook build docs
python docs/book.py
}

run_python_tests() {
Expand Down

0 comments on commit f6c5af7

Please sign in to comment.