Skip to content

Commit 4a66306

Browse files
committed
chore: add GitHub Actions
1 parent d68dd2d commit 4a66306

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed

.github/workflows/ci.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: CI
2+
3+
on: [pull_request, push]
4+
5+
# Cancel a job if there's a new on on the same branch started.
6+
# Based on https://stackoverflow.com/questions/58895283/stop-already-running-workflow-job-in-github-actions/67223051#67223051
7+
concurrency:
8+
group: ${{ github.ref }}
9+
cancel-in-progress: true
10+
11+
env:
12+
CARGO_INCREMENTAL: 0
13+
RUST_BACKTRACE: 1
14+
# Faster crates.io index checkout.
15+
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
16+
RUST_LOG: debug
17+
18+
jobs:
19+
check_clippy:
20+
runs-on: ubuntu-24.04
21+
name: Clippy
22+
steps:
23+
- uses: actions/checkout@v4
24+
#- name: Install required packages
25+
# run: sudo apt install --no-install-recommends --yes libhwloc-dev nvidia-cuda-toolkit ocl-icd-opencl-dev
26+
- name: Run cargo clippy
27+
run: cargo clippy --all-targets --workspace --all-features -- -D warnings
28+
29+
check_fmt:
30+
runs-on: ubuntu-24.04
31+
name: Checking fmt
32+
steps:
33+
- uses: actions/checkout@v4
34+
- name: Run cargo fmt
35+
run: cargo fmt --all -- --check
36+
37+
rustdoc:
38+
runs-on: ubuntu-24.04
39+
name: Rustdoc
40+
steps:
41+
- uses: actions/checkout@v4
42+
- name: Run rustdoc
43+
run: cargo rustdoc --all-features -- -D warnings
44+
45+
build:
46+
runs-on: ubuntu-24.04
47+
name: Release build
48+
steps:
49+
- uses: actions/checkout@v4
50+
- name: Run cargo release build
51+
run: cargo build --release
52+
53+
# Enable these tests once there's a runner with a GPU.
54+
test_gpu:
55+
runs-on: ubuntu-24.04
56+
name: Test
57+
steps:
58+
- uses: actions/checkout@v4
59+
- name: Install required packages
60+
run: sudo apt install --no-install-recommends --yes libhwloc-dev nvidia-cuda-toolkit ocl-icd-opencl-dev
61+
- name: Run tests
62+
run: cargo test
63+
- name: Run `add` example
64+
run: cargo run --example add

0 commit comments

Comments
 (0)