-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into docs_add_code_example_for_abo_akademi
- Loading branch information
Showing
40 changed files
with
1,099 additions
and
720 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# EditorConfig is awesome: https://EditorConfig.org | ||
|
||
# top-most EditorConfig file | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 4 | ||
end_of_line = crlf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.{yml,yaml}] | ||
indent_style = space | ||
indent_size = 2 |
337 changes: 167 additions & 170 deletions
337
.github/workflows/sphinx_combined.yml → ...lows/_build_and_publish_documentation.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,170 +1,167 @@ | ||
name: Build and publish documentation in combined version (farn, dictIO, ospx) | ||
|
||
on: | ||
push: | ||
branches: | ||
- release | ||
- main | ||
|
||
env: | ||
DEFAULT_BRANCH: 'release' | ||
#SPHINXOPTS: '-W --keep-going -T' | ||
# ^-- If these SPHINXOPTS are enabled, then be strict about the builds and fail on any warnings | ||
|
||
jobs: | ||
build-and-publish-docs: | ||
name: Build and publish documentation in combined version (farn, dictIO, ospx) | ||
runs-on: ubuntu-latest | ||
steps: | ||
# Checkout farn (active branch) | ||
- name: Checkout farn (active branch) | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 1 | ||
lfs: true | ||
- name: prepare farn | ||
run: | | ||
cp -v -f README.md docs/source/README_farn.md | ||
cp -v -f CHANGELOG.md docs/source/CHANGELOG_farn.md | ||
sed -i '1 s/Changelog/farn/' docs/source/CHANGELOG_farn.md | ||
# Create temporary subfolders to hold the checked out sub-packages | ||
- name: Create temporary subfolders | ||
run: | | ||
mkdir dictIO | ||
mkdir ospx | ||
# Checkout dictIO (same branch as the one that triggered the workflow here in farn) | ||
- name: Checkout dictIO (same branch as in farn) | ||
uses: actions/checkout@v3 | ||
with: | ||
repository: 'dnv-opensource/dictIO' | ||
ref: ${{github.ref}} | ||
path: dictIO | ||
fetch-depth: 1 | ||
lfs: true | ||
- name: Prepare dictIO | ||
run: | | ||
rm -rf dictIO/.git/ | ||
cp -v -f dictIO/README.md dictIO/docs/source/README_dictIO.md | ||
cp -v -f dictIO/CHANGELOG.md dictIO/docs/source/CHANGELOG_dictIO.md | ||
sed -i '1 s/Changelog/dictIO/' dictIO/docs/source/CHANGELOG_dictIO.md | ||
# Checkout ospx (same branch as the one that triggered the workflow here in farn) | ||
- name: Checkout ospx (same branch as in farn) | ||
uses: actions/checkout@v3 | ||
with: | ||
repository: 'dnv-opensource/ospx' | ||
ref: ${{github.ref}} | ||
path: ospx | ||
fetch-depth: 1 | ||
lfs: true | ||
- name: Prepare ospx | ||
run: | | ||
rm -rf ospx/.git/ | ||
cp -v -f ospx/README.md ospx/docs/source/README_ospx.md | ||
cp -v -f ospx/CHANGELOG.md ospx/docs/source/CHANGELOG_ospx.md | ||
sed -i '1 s/Changelog/ospx/' ospx/docs/source/CHANGELOG_ospx.md | ||
# merge sub-packages into root | ||
- name: merge sub-packages | ||
run: | | ||
cp -v -n -r dictIO/* . | ||
cp -v -n -r ospx/* . | ||
# replace TOC files by its combined versions | ||
- name: replace TOC files | ||
run: | | ||
cp -v -f docs/source/combined/* docs/source | ||
rm -v -r docs/source/combined | ||
- name: Install Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.10' | ||
cache: 'pip' # cache pip dependencies | ||
- name: Install dependencies | ||
run: pip install -r requirements-dev.txt | ||
- name: Print debugging information | ||
run: | | ||
echo "github.ref:" ${{github.ref}} | ||
echo "github.event_name:" ${{github.event_name}} | ||
echo "github.head_ref:" ${{github.head_ref}} | ||
echo "github.base_ref:" ${{github.base_ref}} | ||
set -x | ||
git rev-parse --abbrev-ref HEAD | ||
git branch | ||
git branch -a | ||
git remote -v | ||
python -V | ||
pip list --not-required | ||
pip list | ||
# Build documentation | ||
- uses: ammaraskar/sphinx-problem-matcher@master | ||
- name: Build documentation | ||
run: | | ||
cd docs | ||
make html | ||
- name: Clone and cleanup gh-pages branch | ||
run: | | ||
set -x | ||
git fetch | ||
( git branch gh-pages remotes/origin/gh-pages && git clone . --branch=gh-pages _gh-pages/ ) || mkdir _gh-pages | ||
rm -rf _gh-pages/.git/ | ||
mkdir -p _gh-pages/branch/ | ||
# Delete orphaned branch-folders: | ||
# Go through each subfolder in _gh-pages/branch/ | ||
# If it relates to an orphaned branch, delete it. | ||
- name: Delete orphaned branch-folders | ||
run: | | ||
set -x | ||
for brdir in `ls _gh-pages/branch/` ; do | ||
brname=${brdir//--/\/} # replace '--' with '/' | ||
if ! git show-ref remotes/origin/$brname ; then | ||
echo "Removing $brdir" | ||
rm -r _gh-pages/branch/$brdir/ | ||
fi | ||
done | ||
# Copy documentation to _gh-pages/ (if push happened on release branch) | ||
- name: Copy documentation to _gh-pages/ | ||
if: | | ||
contains(github.ref, env.DEFAULT_BRANCH) | ||
run: | | ||
set -x | ||
# Delete everything under _gh-pages/ that is from the | ||
# primary branch deployment. Excludes the other branches | ||
# _gh-pages/branch-* paths, and not including | ||
# _gh-pages itself. | ||
find _gh-pages/ -mindepth 1 ! -path '_gh-pages/branch*' -delete | ||
rsync -a docs/build/html/ _gh-pages/ | ||
# Copy documentation to _gh-pages/branch/$brname (if push happened on any other branch) | ||
# ('/' gets replaced by '--') | ||
- name: Copy documentation to _gh-pages/branch/${{github.ref}} | ||
if: | | ||
!contains(github.ref, env.DEFAULT_BRANCH) | ||
run: | | ||
set -x | ||
#brname=$(git rev-parse --abbrev-ref HEAD) | ||
brname="${{github.ref}}" | ||
brname="${brname##refs/heads/}" | ||
brdir=${brname//\//--} # replace '/' with '--' | ||
rm -rf _gh-pages/branch/${brdir} | ||
rsync -a docs/build/html/ _gh-pages/branch/${brdir} | ||
# Add .nojekyll file | ||
- name: Add .nojekyll file | ||
run: touch _gh-pages/.nojekyll | ||
|
||
# Publish: Commit gh-pages branch and publish it to GitHub Pages | ||
- name: Publish documentation | ||
uses: peaceiris/actions-gh-pages@v3 | ||
with: | ||
publish_branch: gh-pages | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_dir: _gh-pages/ | ||
force_orphan: true | ||
name: Build and publish documentation in combined version (farn, dictIO, ospx) | ||
|
||
on: workflow_call | ||
|
||
env: | ||
DEFAULT_BRANCH: 'release' | ||
#SPHINXOPTS: '-W --keep-going -T' | ||
# ^-- If these SPHINXOPTS are enabled, then be strict about the builds and fail on any warnings | ||
|
||
jobs: | ||
build-and-publish-docs: | ||
name: Build and publish documentation in combined version (farn, dictIO, ospx) | ||
runs-on: ubuntu-latest | ||
steps: | ||
# Checkout farn (active branch) | ||
- name: Checkout farn (active branch) | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 1 | ||
lfs: true | ||
- name: prepare farn | ||
run: | | ||
cp -v -f README.md docs/source/README_farn.md | ||
cp -v -f CHANGELOG.md docs/source/CHANGELOG_farn.md | ||
sed -i '1 s/Changelog/farn/' docs/source/CHANGELOG_farn.md | ||
# Create temporary subfolders to hold the checked out sub-packages | ||
- name: Create temporary subfolders | ||
run: | | ||
mkdir dictIO | ||
mkdir ospx | ||
# Checkout dictIO (same branch as the one that triggered the workflow here in farn) | ||
- name: Checkout dictIO (same branch as in farn) | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: 'dnv-opensource/dictIO' | ||
ref: ${{github.ref}} | ||
path: dictIO | ||
fetch-depth: 1 | ||
lfs: true | ||
- name: Prepare dictIO | ||
run: | | ||
rm -rf dictIO/.git/ | ||
cp -v -f dictIO/README.md dictIO/docs/source/README_dictIO.md | ||
cp -v -f dictIO/CHANGELOG.md dictIO/docs/source/CHANGELOG_dictIO.md | ||
sed -i '1 s/Changelog/dictIO/' dictIO/docs/source/CHANGELOG_dictIO.md | ||
# Checkout ospx (same branch as the one that triggered the workflow here in farn) | ||
- name: Checkout ospx (same branch as in farn) | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: 'dnv-opensource/ospx' | ||
ref: ${{github.ref}} | ||
path: ospx | ||
fetch-depth: 1 | ||
lfs: true | ||
- name: Prepare ospx | ||
run: | | ||
rm -rf ospx/.git/ | ||
cp -v -f ospx/README.md ospx/docs/source/README_ospx.md | ||
cp -v -f ospx/CHANGELOG.md ospx/docs/source/CHANGELOG_ospx.md | ||
sed -i '1 s/Changelog/ospx/' ospx/docs/source/CHANGELOG_ospx.md | ||
# merge sub-packages into root | ||
- name: merge sub-packages | ||
run: | | ||
cp -v -n -r dictIO/* . | ||
cp -v -n -r ospx/* . | ||
# replace TOC files by its combined versions | ||
- name: replace TOC files | ||
run: | | ||
cp -v -f docs/source/combined/* docs/source | ||
rm -v -r docs/source/combined | ||
- name: Install Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.11' | ||
cache: 'pip' # cache pip dependencies | ||
- name: Install dependencies | ||
run: | | ||
pip install -r requirements-dev.txt | ||
- name: Print debugging information | ||
run: | | ||
echo "github.ref:" ${{github.ref}} | ||
echo "github.event_name:" ${{github.event_name}} | ||
echo "github.head_ref:" ${{github.head_ref}} | ||
echo "github.base_ref:" ${{github.base_ref}} | ||
set -x | ||
git rev-parse --abbrev-ref HEAD | ||
git branch | ||
git branch -a | ||
git remote -v | ||
python -V | ||
pip list --not-required | ||
pip list | ||
# Build documentation | ||
- uses: sphinx-doc/github-problem-matcher@master | ||
- name: Build documentation | ||
run: | | ||
cd docs | ||
make html | ||
- name: Clone and cleanup gh-pages branch | ||
run: | | ||
set -x | ||
git fetch | ||
( git branch gh-pages remotes/origin/gh-pages && git clone . --branch=gh-pages _gh-pages/ ) || mkdir _gh-pages | ||
rm -rf _gh-pages/.git/ | ||
mkdir -p _gh-pages/branch/ | ||
# Delete orphaned branch-folders: | ||
# Go through each subfolder in _gh-pages/branch/ | ||
# If it relates to an orphaned branch, delete it. | ||
- name: Delete orphaned branch-folders | ||
run: | | ||
set -x | ||
for brdir in `ls _gh-pages/branch/` ; do | ||
brname=${brdir//--/\/} # replace '--' with '/' | ||
if ! git show-ref remotes/origin/$brname ; then | ||
echo "Removing $brdir" | ||
rm -r _gh-pages/branch/$brdir/ | ||
fi | ||
done | ||
# Copy documentation to _gh-pages/ (if push happened on release branch) | ||
- name: Copy documentation to _gh-pages/ | ||
if: | | ||
contains(github.ref, env.DEFAULT_BRANCH) | ||
run: | | ||
set -x | ||
# Delete everything under _gh-pages/ that is from the | ||
# primary branch deployment. Excludes the other branches | ||
# _gh-pages/branch-* paths, and not including | ||
# _gh-pages itself. | ||
find _gh-pages/ -mindepth 1 ! -path '_gh-pages/branch*' -delete | ||
rsync -a docs/build/html/ _gh-pages/ | ||
# Copy documentation to _gh-pages/branch/$brname (if push happened on any other branch) | ||
# ('/' gets replaced by '--') | ||
- name: Copy documentation to _gh-pages/branch/${{github.ref}} | ||
if: | | ||
!contains(github.ref, env.DEFAULT_BRANCH) | ||
run: | | ||
set -x | ||
#brname=$(git rev-parse --abbrev-ref HEAD) | ||
brname="${{github.ref}}" | ||
brname="${brname##refs/heads/}" | ||
brdir=${brname//\//--} # replace '/' with '--' | ||
rm -rf _gh-pages/branch/${brdir} | ||
rsync -a docs/build/html/ _gh-pages/branch/${brdir} | ||
# Add .nojekyll file | ||
- name: Add .nojekyll file | ||
run: touch _gh-pages/.nojekyll | ||
|
||
# Publish: Commit gh-pages branch and publish it to GitHub Pages | ||
- name: Publish documentation | ||
uses: peaceiris/actions-gh-pages@v3 | ||
with: | ||
publish_branch: gh-pages | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_dir: _gh-pages/ | ||
force_orphan: true |
Oops, something went wrong.