| 1 | name: Documentation Code Testing |
| 2 | |
| 3 | on: |
| 4 | push: |
| 5 | branches: |
| 6 | - main |
| 7 | paths: |
| 8 | - docs/** |
| 9 | - .github/workflows/docs_test.yml |
| 10 | pull_request: |
| 11 | paths: |
| 12 | - docs/** |
| 13 | - .github/workflows/docs_test.yml |
| 14 | |
| 15 | # Allows you to run this workflow manually from the Actions tab |
| 16 | workflow_dispatch: |
| 17 | |
| 18 | env: |
| 19 | # Disable full debug symbol generation to speed up CI build and keep memory down |
| 20 | # "1" means line tables only, which is useful for panic tracebacks. |
| 21 | RUSTFLAGS: "-C debuginfo=1 -C target-cpu=haswell -C target-feature=+f16c,+avx2,+fma" |
| 22 | RUST_BACKTRACE: "1" |
| 23 | |
| 24 | jobs: |
| 25 | test-python: |
| 26 | name: Test doc python code |
| 27 | runs-on: ubuntu-24.04 |
| 28 | steps: |
| 29 | - name: Checkout |
| 30 | uses: actions/checkout@v4 |
| 31 | - name: Print CPU capabilities |
| 32 | run: cat /proc/cpuinfo |
| 33 | - name: Install protobuf |
| 34 | run: | |
| 35 | sudo apt update |
| 36 | sudo apt install -y protobuf-compiler |
| 37 | - name: Install dependecies needed for ubuntu |
| 38 | run: | |
| 39 | sudo apt install -y libssl-dev |
| 40 | rustup update && rustup default |
| 41 | - name: Set up Python |
| 42 | uses: actions/setup-python@v5 |
| 43 | with: |
| 44 | python-version: 3.11 |
| 45 | cache: "pip" |
| 46 | cache-dependency-path: "docs/test/requirements.txt" |
| 47 | - name: Rust cache |
| 48 | uses: swatinem/rust-cache@v2 |
| 49 | - name: Build Python |
| 50 | working-directory: docs/test |
| 51 | run: |
| 52 | python -m pip install -r requirements.txt |
| 53 | - name: Create test files |
| 54 | run: | |
| 55 | cd docs/test |
| 56 | python md_testing.py |
| 57 | - name: Test |
| 58 | run: | |
| 59 | cd docs/test/python |
| 60 | for d in *; do cd "$d"; echo "$d".py; python "$d".py; cd ..; done |
| 61 | test-node: |
| 62 | name: Test doc nodejs code |
| 63 | runs-on: ubuntu-24.04 |
| 64 | timeout-minutes: 60 |
| 65 | strategy: |
| 66 | fail-fast: false |
| 67 | steps: |
| 68 | - name: Checkout |
| 69 | uses: actions/checkout@v4 |
| 70 | with: |
| 71 | fetch-depth: 0 |
| 72 | lfs: true |
| 73 | - name: Print CPU capabilities |
| 74 | run: cat /proc/cpuinfo |
| 75 | - name: Set up Node |
| 76 | uses: actions/setup-node@v4 |
| 77 | with: |
| 78 | node-version: 20 |
| 79 | - name: Install protobuf |
| 80 | run: | |
| 81 | sudo apt update |
| 82 | sudo apt install -y protobuf-compiler |
| 83 | - name: Install dependecies needed for ubuntu |
| 84 | run: | |
| 85 | sudo apt install -y libssl-dev |
| 86 | rustup update && rustup default |
| 87 | - name: Rust cache |
| 88 | uses: swatinem/rust-cache@v2 |
| 89 | - name: Install node dependencies |
| 90 | run: | |
| 91 | sudo swapoff -a |
| 92 | sudo fallocate -l 8G /swapfile |
| 93 | sudo chmod 600 /swapfile |
| 94 | sudo mkswap /swapfile |
| 95 | sudo swapon /swapfile |
| 96 | sudo swapon --show |
| 97 | cd node |
| 98 | npm ci |
| 99 | npm run build-release |
| 100 | cd ../docs |
| 101 | npm install |
| 102 | - name: Test |
| 103 | env: |
| 104 | LANCEDB_URI: ${{ secrets.LANCEDB_URI }} |
| 105 | LANCEDB_DEV_API_KEY: ${{ secrets.LANCEDB_DEV_API_KEY }} |
| 106 | run: | |
| 107 | cd docs |
| 108 | npm t |