This repository has been archived by the owner on Jun 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 368
172 lines (157 loc) · 4.99 KB
/
rust.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
name: Rust
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
env:
CARGO_TERM_COLOR: always
jobs:
build:
strategy:
# Don't stop building if it fails on an OS
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.65.0
override: true
- name: Check
run: cargo check --verbose
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --all --verbose
fmt:
name: Clippy, formatting and docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: rustfmt, clippy
- name: Formatting
run: cargo fmt --all -- --check
- name: Clippy
run: cargo clippy --workspace -- -Dclippy::all
- name: Documentation
env:
RUSTDOCFLAGS: -Dwarnings
run: cargo doc --workspace --exclude llm-cli
metal:
name: Build with Metal support
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.65.0
override: true
- name: Check
run: cargo check --verbose
- name: Build
run: cargo build --verbose --features metal
cuda:
name: Build with CUDA support
strategy:
# Don't stop building if it fails on an OS
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: Jimver/[email protected]
name: Install CUDA toolkit on Linux
if: matrix.os == 'ubuntu-latest'
id: cuda-toolkit-linux
with:
cuda: "12.2.0"
method: "network"
#See e.g. https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/
non-cuda-sub-packages: '["libcublas","libcublas-dev"]'
sub-packages: '["nvcc","compiler","libraries","libraries-dev","cudart","cudart-dev"]'
- uses: Jimver/[email protected]
name: Install CUDA toolkit on Windows
if: matrix.os == 'windows-latest'
id: cuda-toolkit-windows
with:
cuda: "12.2.0"
#See https://docs.nvidia.com/cuda/cuda-installation-guide-microsoft-windows/index.html#install-the-cuda-software
method: "local"
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.65.0
override: true
- name: Check
run: cargo check --verbose
- name: Build
run: cargo build --verbose --features cublas
opencl:
name: Build with OpenCL support
strategy:
# Don't stop building if it fails on an OS
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Install CLBlast on linux
if: matrix.os == 'ubuntu-latest'
run: sudo apt install libclblast-dev
- name: Install vcpkg on windows
if: matrix.os == 'windows-latest'
run: |
git clone https://github.com/microsoft/vcpkg.git
cd vcpkg
./bootstrap-vcpkg.sh
ls -la
shell: bash
- name: Install OpenCL on windows
if: matrix.os == 'windows-latest'
run: |
${{ github.workspace }}\vcpkg\vcpkg.exe install opencl:x64-windows
shell: pwsh
- name: Install CLBlast on windows
if: matrix.os == 'windows-latest'
run: |
${{ github.workspace }}\vcpkg\vcpkg.exe install clblast:x64-windows
shell: pwsh
- name: Set Windows Environment Variables
if: matrix.os == 'windows-latest'
run: |
echo "CLBLAST_PATH=${{ github.workspace }}/vcpkg/packages/clblast_x64-windows" >> $GITHUB_ENV
echo "OPENCL_PATH=${{ github.workspace }}/vcpkg/packages/opencl_x64-windows" >> $GITHUB_ENV
echo "${{ github.workspace }}/vcpkg/packages/clblast_x64-windows/bin" >> $GITHUB_PATH
echo "${{ github.workspace }}/vcpkg/packages/opencl_x64-windows/bin" >> $GITHUB_PATH
shell: bash
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.65.0
override: true
- name: Check
run: cargo check --verbose
- name: Build with OpenCL on Windows
if: matrix.os == 'windows-latest'
run: cargo build --verbose --features clblast
env:
RUSTFLAGS: "-Ctarget-feature=+crt-static"
- name: Build with OpenCL on Linux
if: matrix.os == 'ubuntu-latest'
run: cargo build --verbose --features clblast