Skip to content

Commit 9b9f8dc

Browse files
committed
chore: add GitHub Actions
1 parent d68dd2d commit 9b9f8dc

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed

.github/workflows/ci.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
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+
- uses: actions/checkout@v4
41+
- name: Run rustdoc
42+
run: cargo rustdoc --all-features -- -D warnings
43+
44+
build:
45+
runs-on: ubuntu-24.04
46+
name: Release build
47+
- uses: actions/checkout@v4
48+
- name: Run cargo release build
49+
run: cargo build --release
50+
51+
# Enable these tests once there's a runner with a GPU.
52+
test_gpu:
53+
runs-on: ubuntu-24.04
54+
name: Test
55+
steps:
56+
- uses: actions/checkout@v4
57+
- name: Install required packages
58+
run: sudo apt install --no-install-recommends --yes libhwloc-dev nvidia-cuda-toolkit ocl-icd-opencl-dev
59+
- name: Run tests
60+
run: cargo test
61+
- name: Run `add` example
62+
run: cargo run --example add

0 commit comments

Comments
 (0)