Skip to content

Commit d46299d

Browse files
committed
work on help build for GSAS-II dist & a bit of cleanup
1 parent f2eac52 commit d46299d

File tree

5 files changed

+101
-79
lines changed

5 files changed

+101
-79
lines changed

.github/workflows/builddocsite.yml

Lines changed: 91 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
11
# create a documentation web site for GSAS-II from four sources
22
# * HTML tutorials are simply copied
33
# * markdown tutorials (in ./MDtutorials) are formatted with pandoc and are copied over
4-
# * HTML help files are copied over from the GSAS-II sources
54
# * sphinx is used to generate HTML from files in ./webdocs
5+
# * the tutorials.html file and the */data/index.html files are
6+
# created by running scripts/makeGitTutorial
7+
# * the help pages are created from the .md file in the MDhelp directory
8+
# * this triggers a process that also creates the help files and places
9+
# the .html files into the GSAS-II sources
610

7-
# Also the tutorials.html file and the */data/index.html files are
8-
# created by running scripts/makeGitTutorial
11+
name: build GSAS-II web site w/MD Help
912

10-
name: build GSAS-II web site
11-
12-
on: [workflow_dispatch]
13-
#on: [push, workflow_dispatch]
13+
#on: [workflow_dispatch]
14+
on:
15+
push:
16+
branches:
17+
- "main"
18+
workflow_dispatch:
1419

1520
permissions:
1621
contents: write
@@ -22,6 +27,20 @@ jobs:
2227
runs-on: ubuntu-latest
2328
steps:
2429

30+
- name: Trigger remote workflow to update help files in GSAS-II repo
31+
# see below for info on setting this up
32+
run: |
33+
# config var follows
34+
repo_owner="AdvancedPhotonSource"
35+
36+
curl -L \
37+
-X POST \
38+
-H "Accept: application/vnd.github+json" \
39+
-H "Authorization: Bearer ${{ secrets.G2TUT_2_G2_4HELP }}" \
40+
-H "X-GitHub-Api-Version: 2022-11-28" \
41+
https://api.github.com/repos/$repo_owner/GSAS-II/dispatches \
42+
-d '{"event_type": "remote build", "client_payload": {"service": "remote build", "unit": false, "integration": true}}'
43+
2544
- name: Python setup
2645
uses: actions/setup-python@v3
2746
- name: Sphinx setup
@@ -30,14 +49,49 @@ jobs:
3049
- name: pandoc setup
3150
uses: pandoc/actions/setup@v1
3251

52+
# MD help stuff
53+
- name: install debian chrome
54+
run: |
55+
set -ex
56+
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
57+
sudo apt install ./google-chrome-stable_current_amd64.deb
58+
59+
# - name: test newly-installed chrome # for debug
60+
# run: |
61+
# which google-chrome-stable
62+
# google-chrome-stable --version
63+
# /usr/bin/google-chrome-stable --headless --disable-gpu --dump-dom https://google.com
64+
- name: mkdocs setup
65+
run: |
66+
pip install mkdocs mkdocs-material python-markdown-math mkdocs-static-i18n
67+
pip install mkdocs-to-pdf pymdown-extensions
68+
3369
- name: Checkout
3470
uses: actions/checkout@v4
71+
72+
# MD help stuff
73+
- name: convert MDhelp
74+
run: |
75+
cd MDhelp
76+
#mkdocs build
77+
ENABLE_PDF_EXPORT=1 mkdocs build
78+
mv site/GSASII-help.pdf ../docs/
79+
# create an anchor index in the help files (only used by Python code)
80+
python findMDanchors.py
81+
cp -vr site/* ../help/
82+
83+
# - name: Upload help artifact # creates zip file with website contents for debug
84+
# uses: actions/upload-pages-artifact@v3
85+
# with:
86+
# path: MDhelp/site
87+
# name: MDhelp
88+
# retention-days: 1
3589

3690
- name: Get tutorials index from source code
3791
run: |
3892
curl -L https://github.com/AdvancedPhotonSource/GSAS-II/raw/master/GSASII/tutorialIndex.py -o scripts/tutorialIndex.py
3993
40-
- name: convert tutorials
94+
- name: convert MarkDown tutorials
4195
run: |
4296
cd MDtutorials
4397
for path in ./*; do
@@ -63,30 +117,23 @@ jobs:
63117
cd scripts
64118
python makeGitTutorial.py ..
65119
66-
# - name: Note changed files
67-
# run: |
68-
# git add tutorials.html
69-
# git add */data/index.html
70-
# git status
71-
# git commit -m"changes from automated build of tutorials"
72-
# - name: Push changes
73-
# uses: ad-m/github-push-action@master
74-
75120
- name: Sphinx build
76121
run: |
77122
sphinx-build webdocs . # place output into root dir
78123
cp webdocs/_static/fix.css _static/fix.css # should be done by sphinx
79124
125+
# to be replaced by MD help stuff
80126
# get the help pages from the GSAS-II sources into the web site
81-
- name: Get GSAS-II
82-
run: |
83-
git clone --depth 1 https://github.com/AdvancedPhotonSource/GSAS-II.git _gsas2
84-
- name: move help into site
85-
run: |
86-
mv _gsas2/GSASII/help ./help
127+
# - name: Get GSAS-II
128+
# run: |
129+
# git clone --depth 1 https://github.com/AdvancedPhotonSource/GSAS-II.git _gsas2
130+
# - name: move help into site
131+
# run: |
132+
# mv _gsas2/GSASII/help ./help
133+
87134
- name: Get rid of the rest of the GSAS-II files & other stuff not needed on web
88135
run: |
89-
rm -rf _gsas2 webdocs scripts MDtutorials
136+
rm -rf webdocs scripts MDtutorials MDhelp
90137
91138
- name: Upload artifact # creates zip file with website contents
92139
uses: actions/upload-pages-artifact@v3
@@ -112,3 +159,23 @@ jobs:
112159
with:
113160
token: ${{ secrets.GITHUB_TOKEN }}
114161
artifact_name: github-pages
162+
163+
164+
# 1) This will trigger all GitHub Actions in GSAS-II workflows that have an
165+
# on: repository_dispatch:
166+
#
167+
# 2) an authorized user (Brian, or perhaps organization) creates a
168+
# personal access token.
169+
# Do this by clicking on "picture (upper rt)
170+
# then "Settings" in drop-down and
171+
# then select "Developer settings" (at bottom).
172+
# Finally select "Fine-grained tokens"
173+
# Personal access token settings:
174+
# select owner: APS;
175+
# select APS/G2;
176+
# Repo permissions: contents r/w & metadata: r/o.
177+
# 3) Save the created token in this (G2-tut) repo.
178+
# Use repo-level settings on 2nd line from top (may be in ... menu).
179+
# Select Actions in Secrets & variables and create a repository secret.
180+
# Name assigned there must match ${{ secrets.XXX }} in workflow's
181+
# curl call (N.B. "Authorization:" setting)

.github/workflows/test_builddocsite.yml renamed to .github/workflows/builddocsite.yml.old

Lines changed: 5 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,16 @@
11
# create a documentation web site for GSAS-II from four sources
22
# * HTML tutorials are simply copied
33
# * markdown tutorials (in ./MDtutorials) are formatted with pandoc and are copied over
4+
# * HTML help files are copied over from the GSAS-II sources
45
# * sphinx is used to generate HTML from files in ./webdocs
56

67
# Also the tutorials.html file and the */data/index.html files are
78
# created by running scripts/makeGitTutorial
89

9-
# this is a development version that creates draft help pages from the MDhelp directory
10-
# For now
11-
# * HTML help files are copied over from the GSAS-II sources
12-
# Eventually, the help files generated here need to get into the GSASII/help
13-
# directory
14-
15-
name: build GSAS-II web site w/test MD Help
10+
name: build GSAS-II web site
1611

17-
#on: [workflow_dispatch]
18-
on:
19-
push:
20-
branches:
21-
- "main"
22-
workflow_dispatch:
12+
on: [workflow_dispatch]
13+
#on: [push, workflow_dispatch]
2314

2415
permissions:
2516
contents: write
@@ -39,44 +30,8 @@ jobs:
3930
- name: pandoc setup
4031
uses: pandoc/actions/setup@v1
4132

42-
# MD help stuff
43-
- name: install debian chrome
44-
run: |
45-
set -ex
46-
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
47-
sudo apt install ./google-chrome-stable_current_amd64.deb
48-
49-
# - name: test newly-installed chrome
50-
# run: |
51-
# which google-chrome-stable
52-
# google-chrome-stable --version
53-
# /usr/bin/google-chrome-stable --headless --disable-gpu --dump-dom https://google.com
54-
- name: mkdocs setup
55-
run: |
56-
pip install mkdocs mkdocs-material python-markdown-math mkdocs-static-i18n
57-
pip install mkdocs-to-pdf pymdown-extensions
58-
5933
- name: Checkout
6034
uses: actions/checkout@v4
61-
62-
# MD help stuff
63-
- name: convert MDhelp
64-
run: |
65-
cd MDhelp
66-
mkdocs build
67-
cp -vr site ../help_test
68-
ENABLE_PDF_EXPORT=1 mkdocs build
69-
mv site/GSASII-help.pdf ../docs/
70-
# create an anchor index
71-
python findMDanchors.py
72-
cp -vr site ../help_test
73-
74-
# - name: Upload help artifact # creates zip file with website contents
75-
# uses: actions/upload-pages-artifact@v3
76-
# with:
77-
# path: MDhelp/site
78-
# name: MDhelp
79-
# retention-days: 1
8035

8136
- name: Get tutorials index from source code
8237
run: |
@@ -122,7 +77,6 @@ jobs:
12277
sphinx-build webdocs . # place output into root dir
12378
cp webdocs/_static/fix.css _static/fix.css # should be done by sphinx
12479

125-
# to be replaced by MD help stuff
12680
# get the help pages from the GSAS-II sources into the web site
12781
- name: Get GSAS-II
12882
run: |
@@ -132,7 +86,7 @@ jobs:
13286
mv _gsas2/GSASII/help ./help
13387
- name: Get rid of the rest of the GSAS-II files & other stuff not needed on web
13488
run: |
135-
rm -rf _gsas2 webdocs scripts MDtutorials MDhelp
89+
rm -rf _gsas2 webdocs scripts MDtutorials
13690

13791
- name: Upload artifact # creates zip file with website contents
13892
uses: actions/upload-pages-artifact@v3
File renamed without changes.
File renamed without changes.

webdocs/documentation.rst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,15 @@ Help pages
2525

2626
The GSAS-II GUI provides context-based help via web files that are
2727
distributed with the program, as well as can be `viewed here
28-
<help/index.html>`_. These help pages are not always complete,
29-
but do provide information on how different sections of the program
30-
work. The help information can also be viewed `as a PDF document
28+
<help/index.html>`_. These help pages are not complete for all
29+
sections of the code,
30+
but do provide at least some information on how every section of the program
31+
works. The help information can also be viewed `as a PDF document
3132
<https://advancedphotonsource.github.io/GSAS-II-tutorials/docs/GSASII-help.pdf>`_.
3233

3334
Note that the help documentation was recently reformatted and updated
3435
as MarkDown (simple text) input files found
35-
`here in GitHub<https://github.com/AdvancedPhotonSource/GSAS-II-tutorials/tree/main/MDhelp>`_.
36+
`in GitHub, here<https://github.com/AdvancedPhotonSource/GSAS-II-tutorials/tree/main/MDhelp>`_.
3637
Comments, corrections, additions and issue reports on Help are most welcome.
3738

3839
.. index:: Source code documentation

0 commit comments

Comments
 (0)