Skip to content

Commit 81cc540

Browse files
authored
Enable Travis CI and build documentation (#21)
1 parent da6057b commit 81cc540

File tree

5 files changed

+112
-18
lines changed

5 files changed

+112
-18
lines changed

.travis.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
language: julia
2+
3+
os:
4+
- linux
5+
- osx
6+
- windows
7+
8+
arch:
9+
- amd64
10+
- i386
11+
- arm64
12+
13+
julia:
14+
- 1.3
15+
- 1.4
16+
- nightly
17+
18+
notifications:
19+
email: false
20+
21+
script:
22+
- if [[ -a .git/shallow ]]; then git fetch --unshallow; fi
23+
# Needed to take precedence on Julia's version of Statistics
24+
- julia -e 'using UUIDs; write("Project.toml", replace(read("Project.toml", String), r"uuid = .*?\n" =>"uuid = \"$(uuid4())\"\n"))'
25+
- julia --project --check-bounds=yes -e 'import Pkg; Pkg.build();
26+
using Statistics;
27+
@assert pathof(Statistics) == joinpath(pwd(), "src", "Statistics.jl");
28+
Pkg.test(; coverage=true)'
29+
30+
after_success:
31+
- julia -e 'using Pkg; Pkg.add("Coverage"); using Coverage; Coveralls.submit(Coveralls.process_folder())';
32+
33+
jobs:
34+
exclude:
35+
- os: osx
36+
arch: i386
37+
- os: osx
38+
arch: arm64
39+
- os: windows
40+
arch: arm64
41+
include:
42+
- stage: "Documentation"
43+
os: linux
44+
julia: 1.3
45+
script:
46+
# Needed to take precedence on Julia's version of Statistics
47+
- julia -e 'using UUIDs; write("Project.toml", replace(read("Project.toml", String), r"uuid = .*?\n" =>"uuid = \"$(uuid4())\"\n"))'
48+
- julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd()));
49+
Pkg.instantiate();
50+
using Statistics;
51+
@assert pathof(Statistics) == joinpath(pwd(), "src", "Statistics.jl");'
52+
- julia --project=docs/ docs/make.jl
53+
after_success: skip
54+

docs/Project.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[deps]
2+
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
3+
4+
[compat]
5+
Documenter = "0.24"

docs/make.jl

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using Documenter, Statistics
2+
3+
# Workaround for JuliaLang/julia/pull/28625
4+
if Base.HOME_PROJECT[] !== nothing
5+
Base.HOME_PROJECT[] = abspath(Base.HOME_PROJECT[])
6+
end
7+
8+
makedocs(
9+
modules = [Statistics],
10+
sitename = "Statistics",
11+
pages = Any[
12+
"Statistics" => "index.md"
13+
]
14+
)
15+
16+
deploydocs(repo = "github.com/JuliaLang/Statistics.jl.git")

docs/src/index.md

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,19 @@
11
# Statistics
22

3-
The Statistics module contains basic statistics functionality.
4-
5-
!!! note
6-
To use any of the examples described below, run `using Statistics` and then the code from the example.
3+
The Statistics standard library module contains basic statistics functionality.
74

85
```@docs
9-
Statistics.std
10-
Statistics.stdm
11-
Statistics.var
12-
Statistics.varm
13-
Statistics.cor
14-
Statistics.cov
15-
Statistics.mean!
16-
Statistics.mean
17-
Statistics.median!
18-
Statistics.median
19-
Statistics.middle
20-
Statistics.quantile!
21-
Statistics.quantile
6+
std
7+
stdm
8+
var
9+
varm
10+
cor
11+
cov
12+
mean!
13+
mean
14+
median!
15+
median
16+
middle
17+
quantile!
18+
quantile
2219
```

src/Statistics.jl

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ Compute the mean of all elements in a collection.
2929
3030
# Examples
3131
```jldoctest
32+
julia> using Statistics
33+
3234
julia> mean(1:20)
3335
10.5
3436
@@ -47,6 +49,8 @@ mean(itr) = mean(identity, itr)
4749
Apply the function `f` to each element of collection `itr` and take the mean.
4850
4951
```jldoctest
52+
julia> using Statistics
53+
5054
julia> mean(√, [1, 2, 3])
5155
1.3820881233139908
5256
@@ -83,6 +87,8 @@ Apply the function `f` to each element of array `A` and take the mean over dimen
8387
This method requires at least Julia 1.3.
8488
8589
```jldoctest
90+
julia> using Statistics
91+
8692
julia> mean(√, [1, 2, 3])
8793
1.3820881233139908
8894
@@ -107,6 +113,8 @@ Compute the mean of `v` over the singleton dimensions of `r`, and write results
107113
108114
# Examples
109115
```jldoctest
116+
julia> using Statistics
117+
110118
julia> v = [1 2; 3 4]
111119
2×2 Array{Int64,2}:
112120
1 2
@@ -139,6 +147,8 @@ Compute the mean of an array over the given dimensions.
139147
140148
# Examples
141149
```jldoctest
150+
julia> using Statistics
151+
142152
julia> A = [1 2; 3 4]
143153
2×2 Array{Int64,2}:
144154
1 2
@@ -720,6 +730,8 @@ Compute the middle of a range, which consists of computing the mean of its extre
720730
Since a range is sorted, the mean is performed with the first and last element.
721731
722732
```jldoctest
733+
julia> using Statistics
734+
723735
julia> middle(1:10)
724736
5.5
725737
```
@@ -733,6 +745,8 @@ Compute the middle of an array `a`, which consists of finding its
733745
extrema and then computing their mean.
734746
735747
```jldoctest
748+
julia> using Statistics
749+
736750
julia> a = [1,2,3.6,10.9]
737751
4-element Array{Float64,1}:
738752
1.0
@@ -782,6 +796,8 @@ equivalent to calculating mean of two median elements.
782796
783797
# Examples
784798
```jldoctest
799+
julia> using Statistics
800+
785801
julia> median([1, 2, 3])
786802
2.0
787803
@@ -803,7 +819,9 @@ median(itr) = median!(collect(itr))
803819
Compute the median of an array along the given dimensions.
804820
805821
# Examples
806-
```jldoctest
822+
```jl
823+
julia> using Statistics
824+
807825
julia> median([1 2; 3 4], dims=1)
808826
1×2 Array{Float64,2}:
809827
2.0 3.0
@@ -838,6 +856,8 @@ for `k = 1:n` where `n = length(v)`. This corresponds to Definition 7 of Hyndman
838856
839857
# Examples
840858
```jldoctest
859+
julia> using Statistics
860+
841861
julia> x = [3, 2, 1];
842862
843863
julia> quantile!(x, 0.5)
@@ -950,6 +970,8 @@ for `k = 1:n` where `n = length(itr)`. This corresponds to Definition 7 of Hyndm
950970
951971
# Examples
952972
```jldoctest
973+
julia> using Statistics
974+
953975
julia> quantile(0:20, 0.5)
954976
10.0
955977

0 commit comments

Comments
 (0)