Skip to content

Commit 6974ab2

Browse files
committed
Move doctests into separate workflow
1 parent e0ec601 commit 6974ab2

File tree

3 files changed

+59
-20
lines changed

3 files changed

+59
-20
lines changed

.github/workflows/DocTest.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# We want to only run doctests on a single version of Julia, because
2+
# things like error messages / output can change between versions and
3+
# is fragile to test against.
4+
name: Doctests
5+
6+
on:
7+
push:
8+
branches:
9+
- main
10+
pull_request:
11+
merge_group:
12+
types: [checks_requested]
13+
14+
# needed to allow julia-actions/cache to delete old caches that it has created
15+
permissions:
16+
actions: write
17+
contents: read
18+
19+
# Cancel existing tests on the same PR if a new commit is added to a pull request
20+
concurrency:
21+
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
22+
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
23+
24+
jobs:
25+
test:
26+
runs-on: ubuntu-latest
27+
28+
steps:
29+
- uses: actions/checkout@v4
30+
31+
- uses: julia-actions/setup-julia@v2
32+
with:
33+
version: '1'
34+
35+
- uses: julia-actions/cache@v2
36+
37+
- uses: julia-actions/julia-buildpkg@v1
38+
39+
- name: Run doctests
40+
shell: julia --color=yes --project=docs {0}
41+
run: |
42+
# Develop currently checked out version of DynamicPPL
43+
using Pkg
44+
Pkg.develop(path=pwd())
45+
46+
using Documenter
47+
DocMeta.setdocmeta!(
48+
DynamicPPL,
49+
:DocTestSetup,
50+
:(using DynamicPPL, Distributions);
51+
recursive=true,
52+
)
53+
doctestfilters = [
54+
# Ignore the source of a warning in the doctest output, since this is dependent on host.
55+
# This is a line that starts with "└ @ " and ends with the line number.
56+
r"└ @ .+:[0-9]+",
57+
]
58+
59+
doctest(DynamicPPL; manual=false, doctestfilters=doctestfilters)

test/Project.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ DifferentiationInterface = "a0c0ee7d-e4b9-4e03-894e-1c5f64a51d63"
1111
Distributed = "8ba89e20-285c-5b6f-9357-94700520ee1b"
1212
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
1313
DistributionsAD = "ced4e74d-a319-5a8a-b0ac-84af2272839c"
14-
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
1514
EnzymeCore = "f151be2c-9106-41f4-ab19-57ee4f262869"
1615
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
1716
JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b"
@@ -40,7 +39,6 @@ Compat = "4.3.0"
4039
DifferentiationInterface = "0.6.41"
4140
Distributions = "0.25"
4241
DistributionsAD = "0.6.3"
43-
Documenter = "1"
4442
EnzymeCore = "0.6 - 0.8"
4543
ForwardDiff = "0.10.12"
4644
JET = "0.9, 0.10"

test/runtests.jl

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ using Bijectors
77
using DifferentiationInterface
88
using Distributions
99
using DistributionsAD
10-
using Documenter
1110
using ForwardDiff
1211
using LogDensityProblems
1312
using MacroTools
@@ -97,22 +96,5 @@ include("test_util.jl")
9796
@test_throws ErrorException prob"..."
9897
@test_throws ErrorException logprob"..."
9998
end
100-
if !IS_PRERELEASE
101-
# Don't run doctests on prerelease as error messages etc. may vary
102-
@testset "doctests" begin
103-
DocMeta.setdocmeta!(
104-
DynamicPPL,
105-
:DocTestSetup,
106-
:(using DynamicPPL, Distributions);
107-
recursive=true,
108-
)
109-
doctestfilters = [
110-
# Ignore the source of a warning in the doctest output, since this is dependent on host.
111-
# This is a line that starts with "└ @ " and ends with the line number.
112-
r"└ @ .+:[0-9]+",
113-
]
114-
doctest(DynamicPPL; manual=false, doctestfilters=doctestfilters)
115-
end
116-
end
11799
end
118100
end

0 commit comments

Comments
 (0)