Skip to content

Commit 4b464ac

Browse files
authored
ci: add DynamicExpressions integration tests (#1675)
* ci: add DynamicExpressions integration tests * ci: set to 1.10 for tests * ci: fix DE integration test compat * ci: fix DE integration test env * ci: fix DE integration command
1 parent 5fc2309 commit 4b464ac

File tree

3 files changed

+61
-0
lines changed

3 files changed

+61
-0
lines changed

.github/workflows/CI.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,32 @@ jobs:
225225
if: matrix.version != 'nightly' || steps.run_tests.outcome == 'success'
226226
with:
227227
files: lcov.info
228+
integration:
229+
name: Integration Tests - ${{ matrix.test }}
230+
runs-on: ${{ matrix.os }}
231+
env:
232+
JULIA_PKG_SERVER_REGISTRY_PREFERENCE: eager
233+
strategy:
234+
fail-fast: false
235+
matrix:
236+
version:
237+
- '1.10'
238+
os:
239+
- ubuntu-latest
240+
test:
241+
- DynamicExpressions
242+
steps:
243+
- uses: actions/checkout@v4
244+
- uses: julia-actions/setup-julia@v1
245+
with:
246+
version: ${{ matrix.version }}
247+
- uses: julia-actions/cache@v1
248+
- uses: julia-actions/julia-buildpkg@v1
249+
- name: "Run tests"
250+
run: |
251+
julia --color=yes --project=test/integration -e 'using Pkg; Pkg.develop([PackageSpec(; path) for path in (".", "lib/EnzymeCore")]); Pkg.instantiate()'
252+
julia --color=yes --project=test/integration --threads=auto --check-bounds=yes test/integration/${{ matrix.test }}.jl
253+
shell: bash
228254
docs:
229255
name: Documentation
230256
runs-on: ubuntu-latest
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
using Test, Enzyme, DynamicExpressions
2+
3+
operators = OperatorEnum(; binary_operators=(+, -, *, /), unary_operators=(cos, sin))
4+
5+
tree = Node(; op=1, l=Node{Float64}(; feature=1), r=Node(; op=1, l=Node{Float64}(; feature=2)))
6+
# == x1 + cos(x2)
7+
8+
X = randn(3, 100);
9+
dX = zero(X)
10+
11+
function f(tree, X, operators, output)
12+
output[] = sum(eval_tree_array(tree, X, operators)[1])
13+
return nothing
14+
end
15+
16+
output = [0.0]
17+
doutput = [1.0]
18+
19+
autodiff(
20+
Reverse,
21+
f,
22+
Const(tree),
23+
Duplicated(X, dX),
24+
Const(operators),
25+
Duplicated(output, doutput),
26+
)
27+
28+
true_dX = cat(ones(100), -sin.(X[2, :]), zeros(100); dims=2)'
29+
30+
@test true_dX dX

test/integration/Project.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[deps]
2+
DynamicExpressions = "a40a106e-89c9-4ca8-8020-a735e8728b6b"
3+
4+
[compat]
5+
DynamicExpressions = "=0.18.5"

0 commit comments

Comments
 (0)