Skip to content

Commit 3fffd3e

Browse files
Documentation and Turing Navigation CI improvement (#157)
* Update Docs.yml * Improved DocsNav working using [Turing actions](https://github.com/TuringLang/actions/) * No need of deploydocs() after using new Docs & DocsNav workflows * Update Docs.yml * Update DocsNav.yml * Fix failing test, disable fail-fast --------- Co-authored-by: Penelope Yong <[email protected]>
1 parent 217200e commit 3fffd3e

File tree

5 files changed

+38
-46
lines changed

5 files changed

+38
-46
lines changed

.github/workflows/CI.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ jobs:
2020
test:
2121
runs-on: ${{ matrix.runner.os }}
2222
strategy:
23+
fail-fast: false
2324
matrix:
2425
num_threads:
2526
- 1

.github/workflows/Docs.yml

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,20 @@ on:
77
tags: '*'
88
pull_request:
99

10+
concurrency:
11+
# Skip intermediate builds: always.
12+
# Cancel intermediate builds: only if it is a pull request build.
13+
group: ${{ github.workflow }}-${{ github.ref }}
14+
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
15+
16+
permissions:
17+
contents: write
18+
pull-requests: read
19+
1020
jobs:
11-
build:
21+
docs:
1222
runs-on: ubuntu-latest
23+
1324
steps:
14-
- uses: actions/checkout@v2
15-
- uses: julia-actions/setup-julia@v1
16-
with:
17-
version: '1'
18-
- uses: julia-actions/julia-buildpkg@v1
19-
- uses: julia-actions/julia-docdeploy@v1
20-
env:
21-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # For authentication with GitHub Actions token
22-
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} # For authentication with SSH deploy key
23-
JULIA_DEBUG: Documenter # Print `@debug` statements (https://github.com/JuliaDocs/Documenter.jl/issues/955)
25+
- name: Build and deploy Documenter.jl docs
26+
uses: TuringLang/actions/DocsDocumenter@main

.github/workflows/DocsNav.yml

Lines changed: 22 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,39 @@
1-
name: Add Navbar
1+
name: Rebuild docs with newest navbar
22

33
on:
4-
page_build: # Triggers the workflow on push events to gh-pages branch
5-
workflow_dispatch: # Allows manual triggering
4+
# 3:25 AM UTC every Sunday -- choose an uncommon time to avoid
5+
# periods of heavy GitHub Actions usage
66
schedule:
7-
- cron: '0 0 * * 0' # Runs every week on Sunday at midnight (UTC)
7+
- cron: '25 3 * * 0'
8+
# Whenever needed
9+
workflow_dispatch:
10+
11+
permissions:
12+
contents: write
813

914
jobs:
10-
add-navbar:
15+
update-navbar:
1116
runs-on: ubuntu-latest
12-
permissions:
13-
contents: write
17+
1418
steps:
15-
- name: Checkout gh-pages
19+
- name: Checkout gh-pages branch
1620
uses: actions/checkout@v4
1721
with:
1822
ref: gh-pages
19-
fetch-depth: 0
2023

21-
- name: Download insert_navbar.sh
22-
run: |
23-
curl -O https://raw.githubusercontent.com/TuringLang/turinglang.github.io/main/assets/scripts/insert_navbar.sh
24-
chmod +x insert_navbar.sh
24+
- name: Insert navbar
25+
uses: TuringLang/actions/DocsNav@main
26+
with:
27+
doc-path: '.'
2528

26-
- name: Update Navbar
27-
env:
28-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
29+
- name: Commit and push changes
2930
run: |
30-
git config user.name github-actions[bot]
31-
git config user.email github-actions[bot]@users.noreply.github.com
32-
33-
# Define the URL of the navbar to be used
34-
NAVBAR_URL="https://raw.githubusercontent.com/TuringLang/turinglang.github.io/main/assets/scripts/TuringNavbar.html"
35-
36-
# Update all HTML files in the current directory (gh-pages root)
37-
./insert_navbar.sh . $NAVBAR_URL
38-
39-
# Remove the insert_navbar.sh file
40-
rm insert_navbar.sh
41-
42-
# Check if there are any changes
4331
if [[ -n $(git status -s) ]]; then
44-
git add .
45-
git commit -m "Added navbar and removed insert_navbar.sh"
46-
git push "https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" gh-pages
32+
git config user.name github-actions[bot]
33+
git config user.email github-actions[bot]@users.noreply.github.com
34+
git add -A
35+
git commit -m "Update navbar (automated)"
36+
git push
4737
else
4838
echo "No changes to commit"
4939
fi

docs/make.jl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,3 @@ makedocs(;
1111
pages=["Home" => "index.md", "api.md", "design.md"],
1212
checkdocs=:exports,
1313
)
14-
15-
deploydocs(; repo="github.com/TuringLang/AbstractMCMC.jl.git", push_preview=true)

test/sample.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,7 @@
692692
@test mean(x.a for x in view(chain, 2:1_000)) 0.5 atol = 6e-2
693693
@test var(x.a for x in view(chain, 2:1_000)) 1 / 12 atol = 1e-2
694694
@test mean(x.b for x in chain) 0 atol = 0.11
695-
@test var(x.b for x in chain) 1 atol = 0.15
695+
@test var(x.b for x in chain) 1 atol = 0.2
696696
end
697697

698698
@testset "Testing callbacks" begin

0 commit comments

Comments
 (0)