Skip to content

Commit 7564d38

Browse files
authored
setup Documenter (#11)
1 parent 12fbf20 commit 7564d38

File tree

7 files changed

+124
-2
lines changed

7 files changed

+124
-2
lines changed

.github/workflows/Cleanup.yml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Doc Preview Cleanup
2+
3+
on:
4+
pull_request:
5+
types: [closed]
6+
7+
# Ensure that only one "Doc Preview Cleanup" workflow is force pushing at a time
8+
concurrency:
9+
group: doc-preview-cleanup
10+
cancel-in-progress: false
11+
12+
jobs:
13+
doc-preview-cleanup:
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: write
17+
steps:
18+
- name: Checkout gh-pages branch
19+
uses: actions/checkout@v4
20+
with:
21+
ref: gh-pages
22+
- name: Delete preview and history + push changes
23+
run: |
24+
if [ -d "${preview_dir}" ]; then
25+
git config user.name "Documenter.jl"
26+
git config user.email "[email protected]"
27+
git rm -rf "${preview_dir}"
28+
git commit -m "delete preview"
29+
git branch gh-pages-new $(echo "delete history" | git commit-tree HEAD^{tree})
30+
git push --force origin gh-pages-new:gh-pages
31+
fi
32+
env:
33+
preview_dir: previews/PR${{ github.event.number }}

.github/workflows/Documentation.yml

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Documentation
2+
on:
3+
pull_request:
4+
push:
5+
branches:
6+
- main
7+
tags: "*"
8+
9+
# needed to allow julia-actions/cache to delete old caches that it has created
10+
permissions:
11+
actions: write
12+
contents: read
13+
14+
jobs:
15+
docs:
16+
name: Documentation
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v4
20+
- uses: julia-actions/setup-julia@v2
21+
with:
22+
version: "1"
23+
- uses: julia-actions/cache@v2
24+
- name: instantiate docs
25+
run: |
26+
julia --project=docs -e '
27+
using Pkg
28+
Pkg.instantiate()
29+
'
30+
- name: run doctests
31+
run: |
32+
julia --project=docs -e '
33+
using Documenter: DocMeta, doctest
34+
using GPUToolbox
35+
DocMeta.setdocmeta!(GPUToolbox, :DocTestSetup, :(using GPUToolbox); recursive=true)
36+
doctest(GPUToolbox)
37+
'
38+
- name: generate docs
39+
run: julia --project=docs docs/make.jl
40+
env:
41+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42+
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}

docs/.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Manifest.toml
2+
build

docs/Project.toml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[deps]
2+
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
3+
GPUToolbox = "096a3bc2-3ced-46d0-87f4-dd12716f4bfc"
4+
5+
[sources]
6+
GPUToolbox = {path = ".."}
7+
8+
[compat]
9+
Documenter = "1.8"
10+
julia = "1.11"

docs/make.jl

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
using GPUToolbox
2+
using Documenter
3+
import Documenter.Remotes: GitHub
4+
5+
DocMeta.setdocmeta!(GPUToolbox, :DocTestSetup, :(using GPUToolbox); recursive = true)
6+
7+
makedocs(;
8+
modules = [GPUToolbox],
9+
authors = "",
10+
repo = GitHub("JuliaGPU", "GPUToolbox.jl"),
11+
sitename = "GPUToolbox.jl",
12+
format = Documenter.HTML(;
13+
prettyurls = get(ENV, "CI", "false") == "true",
14+
canonical = "https://juliagpu.com/GPUToolbox.jl",
15+
mathengine = MathJax3(),
16+
),
17+
pages = [
18+
"Home" => "index.md",
19+
],
20+
doctest = true,
21+
linkcheck = true,
22+
)
23+
24+
deploydocs(;
25+
repo = "github.com/JuliaGPU/GPUToolbox.jl.git",
26+
devbranch = "main",
27+
push_preview = true,
28+
)

docs/src/index.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# GPUToolbox.jl
2+
3+
## API
4+
5+
```@autodocs
6+
Modules = [GPUToolbox]
7+
```

src/ccalls.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,9 @@ render_arg(io, arg::Base.RefValue{T}) where {T} = print(io, "Ref{", T, "}")
9898
const HAS_CCALL_GCSAFE = VERSION >= v"1.13.0-DEV.70" || v"1.12-DEV.2029" <= VERSION < v"1.13-"
9999

100100
"""
101-
@gcsafe_ccall ...
101+
@gcsafe_ccall ...
102102
103-
Call a foreign function just like `@ccall`, but marking it safe for the GC to run. This is
103+
Call a foreign function just like [`@ccall`](https://docs.julialang.org/en/v1/base/c/#Base.@ccall), but marking it safe for the GC to run. This is
104104
useful for functions that may block, so that the GC isn't blocked from running, but may also
105105
be required to prevent deadlocks (see JuliaGPU/CUDA.jl#2261).
106106

0 commit comments

Comments
 (0)