Skip to content

Commit aecafad

Browse files
authored
ci: add ci to test rust std::autodiff (#2430)
1 parent 63c8187 commit aecafad

File tree

1 file changed

+90
-0
lines changed

1 file changed

+90
-0
lines changed

.github/workflows/enzyme-rust.yml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
name: Enzyme Rust CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
merge_group:
11+
12+
jobs:
13+
rust-autodiff:
14+
name: Rust Autodiff ${{ matrix.os }}
15+
runs-on: ${{ matrix.os }}
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
os: [linux-x86-n2-32]
20+
commit: [b2ee1b333aea9951c3eefa4967098cc763de59ca]
21+
22+
timeout-minutes: 90
23+
24+
container:
25+
image: ${{ (contains(matrix.os, 'linux') && 'ghcr.io/enzymead/reactant-docker-images@sha256:91e1edb7a7c869d5a70db06e417f22907be0e67ca86641d48adcea221fedc674' ) || '' }}
26+
27+
steps:
28+
- name: Prepare env
29+
run: |
30+
echo "CCACHE_DIR=${GITHUB_WORKSPACE}/.ccache" >> "${GITHUB_ENV}"
31+
- name: Install dependencies
32+
run: |
33+
apt-get update
34+
apt-get install -y ninja-build cmake ccache nodejs
35+
- name: Prepare ccache directory
36+
run: |
37+
mkdir -p "$CCACHE_DIR"
38+
- name: Install Rust toolchain
39+
run: |
40+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
41+
. ~/.cargo/env
42+
rustup toolchain install nightly
43+
rustup default nightly
44+
- uses: actions/checkout@v5
45+
name: Checkout Enzyme
46+
- uses: actions/checkout@v5
47+
name: Checkout Rust compiler
48+
with:
49+
repository: rust-lang/rust
50+
ref: ${{ matrix.commit }}
51+
path: rust
52+
- name: Cache ccache
53+
uses: actions/cache@v4
54+
with:
55+
path: ${{ env.CCACHE_DIR }}
56+
key: ccache-rust-${{ matrix.os }}-${{ matrix.commit }}
57+
- name: ccache --show-stats
58+
run: |
59+
ccache --show-stats --verbose
60+
- name: Configure Rust compiler
61+
run: |
62+
. ~/.cargo/env
63+
cd rust
64+
# Replace rustc's built-in Enzyme submodule with the Enzyme source code from this repository
65+
rm -rf src/tools/enzyme/enzyme
66+
ln -s "${GITHUB_WORKSPACE}/enzyme" src/tools/enzyme/enzyme
67+
./configure \
68+
--release-channel=nightly \
69+
--enable-llvm-enzyme \
70+
--enable-option-checking \
71+
--disable-docs \
72+
--enable-ccache \
73+
--enable-llvm-assertions \
74+
--enable-llvm-link-shared
75+
- name: Build Rust compiler stage 1
76+
working-directory: rust
77+
run: |
78+
. ~/.cargo/env
79+
./x build --stage 1 library
80+
- name: Run Rust autodiff tests
81+
working-directory: rust
82+
run: |
83+
. ~/.cargo/env
84+
./x test --stage 1 tests/codegen-llvm/autodiff
85+
./x test --stage 1 tests/pretty/autodiff
86+
./x test --stage 1 tests/ui/autodiff
87+
./x test --stage 1 tests/ui/feature-gates/feature-gate-autodiff.rs
88+
- name: ccache --show-stats
89+
run: |
90+
ccache --show-stats --verbose

0 commit comments

Comments
 (0)