|
8 | 8 |
|
9 | 9 | env: |
10 | 10 | CARGO_TERM_COLOR: always |
| 11 | + # Point ort-sys to the system-installed ONNX Runtime so it never tries to |
| 12 | + # reach cdn.pyke.io (which is not available on GitHub-hosted runners). |
| 13 | + ORT_LIB_LOCATION: /opt/onnxruntime/lib |
| 14 | + ORT_PREFER_DYNAMIC_LINK: "1" |
11 | 15 |
|
12 | 16 | jobs: |
| 17 | + setup-onnxruntime: |
| 18 | + name: Cache ONNX Runtime |
| 19 | + runs-on: ubuntu-latest |
| 20 | + steps: |
| 21 | + - name: Cache ONNX Runtime |
| 22 | + id: cache-ort |
| 23 | + uses: actions/cache@v4 |
| 24 | + with: |
| 25 | + path: /opt/onnxruntime |
| 26 | + key: onnxruntime-1.23.2-linux-x64 |
| 27 | + |
| 28 | + - name: Download ONNX Runtime 1.23.2 |
| 29 | + if: steps.cache-ort.outputs.cache-hit != 'true' |
| 30 | + run: | |
| 31 | + curl -L "https://github.com/microsoft/onnxruntime/releases/download/v1.23.2/onnxruntime-linux-x64-1.23.2.tgz" \ |
| 32 | + -o /tmp/onnxruntime.tgz |
| 33 | + mkdir -p /opt/onnxruntime |
| 34 | + tar -xzf /tmp/onnxruntime.tgz --strip-components=1 -C /opt/onnxruntime |
| 35 | +
|
13 | 36 | check: |
14 | 37 | name: Check |
15 | 38 | runs-on: ubuntu-latest |
| 39 | + needs: setup-onnxruntime |
16 | 40 | steps: |
17 | 41 | - uses: actions/checkout@v4 |
18 | 42 | - uses: dtolnay/rust-toolchain@stable |
19 | 43 | - uses: Swatinem/rust-cache@v2 |
| 44 | + - name: Restore ONNX Runtime |
| 45 | + uses: actions/cache@v4 |
| 46 | + with: |
| 47 | + path: /opt/onnxruntime |
| 48 | + key: onnxruntime-1.23.2-linux-x64 |
| 49 | + - run: echo "/opt/onnxruntime/lib" | sudo tee /etc/ld.so.conf.d/onnxruntime.conf && sudo ldconfig |
20 | 50 | - run: cargo check |
21 | 51 |
|
22 | 52 | test: |
23 | 53 | name: Test |
24 | 54 | runs-on: ubuntu-latest |
| 55 | + needs: setup-onnxruntime |
25 | 56 | steps: |
26 | 57 | - uses: actions/checkout@v4 |
27 | 58 | - uses: dtolnay/rust-toolchain@stable |
28 | 59 | - uses: Swatinem/rust-cache@v2 |
| 60 | + - name: Restore ONNX Runtime |
| 61 | + uses: actions/cache@v4 |
| 62 | + with: |
| 63 | + path: /opt/onnxruntime |
| 64 | + key: onnxruntime-1.23.2-linux-x64 |
| 65 | + - run: echo "/opt/onnxruntime/lib" | sudo tee /etc/ld.so.conf.d/onnxruntime.conf && sudo ldconfig |
29 | 66 | - run: cargo test |
30 | 67 |
|
31 | 68 | clippy: |
32 | 69 | name: Clippy |
33 | 70 | runs-on: ubuntu-latest |
| 71 | + needs: setup-onnxruntime |
34 | 72 | steps: |
35 | 73 | - uses: actions/checkout@v4 |
36 | 74 | - uses: dtolnay/rust-toolchain@stable |
37 | 75 | with: |
38 | 76 | components: clippy |
39 | 77 | - uses: Swatinem/rust-cache@v2 |
| 78 | + - name: Restore ONNX Runtime |
| 79 | + uses: actions/cache@v4 |
| 80 | + with: |
| 81 | + path: /opt/onnxruntime |
| 82 | + key: onnxruntime-1.23.2-linux-x64 |
| 83 | + - run: echo "/opt/onnxruntime/lib" | sudo tee /etc/ld.so.conf.d/onnxruntime.conf && sudo ldconfig |
40 | 84 | - run: cargo clippy -- -D warnings |
41 | 85 |
|
42 | 86 | fmt: |
|
0 commit comments