Skip to content

Commit

Permalink
Deploy several documentations
Browse files Browse the repository at this point in the history
This PR adds the ability to deploy several documentations of Alt-Ergo.
The new documentation workflows work as follows:
- the workflow `build_doc` builds both sphinx and odoc documentations
  and merges them in a single artifact. This workflow is trigger after
  pushing on PR;
- while pushing on `next`, the new `gh-pages` workflow retrieves the
  previous artifact and deploy it in the directory `/dev` of the
  `gh-pages` branch;
- if we want to add a new release documentation, we have to do by hand
  using the target `doc` of our makefile and update the `index.mld` file
  of `gh-pages`.
  • Loading branch information
Halbaroth committed Jul 19, 2024
1 parent 6f843ce commit 665a9f7
Show file tree
Hide file tree
Showing 11 changed files with 91 additions and 407 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/build_doc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Build documentation

on: [push, pull_request]

permissions: write-all

env:
OCAML_DEFAULT_VERSION: 4.14.2
# Add OPAMYES=true to the environment, this is usefill to replace `-y` option
# in any opam call
OPAMYES: true

jobs:
build:
runs-on: ubuntu-latest
env:
OPAMWITHDOC: true

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Use OCaml ${{ env.OCAML_DEFAULT_VERSION }}
uses: ocaml/setup-ocaml@v3
with:
ocaml-compiler: ${{ env.OCAML_DEFAULT_VERSION }}
dune-cache: true

- name: Install dependencies
run: opam exec -- make deps

- name: Build odoc documentation
run: opam exec -- dune build @doc

- name: Build sphinx documentation
uses: ammaraskar/sphinx-action@master
with:
docs-folder: "docs/sphinx_docs/"
pre-build-command: "su runner"
build-command: "sphinx-build . -W -b html ../../_build/sphinx_docs"

- name: Debug
run: |
ls -l _build/default/_doc/_html
ls -l _build/sphinx_docs
id
- name: Copy odoc documentation
run: |
cp -Rf _build/default/_doc/_html/* _build/sphinx_docs/API
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: doc-artifact
path: ./_build/sphinx_docs
24 changes: 24 additions & 0 deletions .github/workflows/deploy_doc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Deploy Documentation

on:
push:
branches:
- next

jobs:
deploy:
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: doc-artifact
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
publish_dir: doc-artifact
destination_dir: dev
enable_jekyll: true
github_token: ${{ secrets.GITHUB_TOKEN }}
153 changes: 0 additions & 153 deletions .github/workflows/documentation.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- name: Build the distribution archive
run: opam exec -- dune-release distrib

- name: Upload the artefact
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: alt-ergo-${{github.sha}}.tbz
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ The following terms apply to all such contributions:

In addition to agreeing to the terms of the Alt-Ergo's [License], we ask our contributors to sign the [Contributor License Agreement (CLA)].

[License]: ../About/licenses/index
[License]: ../About/index
[Contributor License Agreement (CLA)]: https://www.ocamlpro.com/files/CLA-OCamlPro-corporate.txt

## Develop with Nix
Expand Down
19 changes: 4 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -157,26 +157,15 @@ uninstall: packages
# Documentation generation
# ========================

# Build the documentations
doc: odoc sphinx-doc

# Build the sphinx documentation
sphinx-doc:
# cp LICENSE.md $(SPHINX_DOC_DIR)/About/license.md
# cp -r licenses $(SPHINX_DOC_DIR)/About
$(SPHINXBUILD) "$(SPHINX_DOC_DIR)" "$(SPHINX_BUILD_DIR)"

# Build the odoc
odoc:
doc:
$(SPHINXBUILD) -W "$(SPHINX_DOC_DIR)" "$(SPHINX_BUILD_DIR)"
$(DUNE) build $(DUNE_FLAGS) @doc
cp -rf $(DEFAULT_DIR)/_doc/_html/* $(SPHINX_BUILD_DIR)/API

# Open the html doc generated by sphinx and odoc in browser
html: doc
mkdir -p $(SPHINX_BUILD_DIR)/odoc/dev
cp -r $(DEFAULT_DIR)/_doc/_html/* $(SPHINX_BUILD_DIR)/odoc/dev
xdg-open $(SPHINX_BUILD_DIR)/index.html

.PHONY: doc sphinx-doc odoc html
.PHONY: doc html

# ======================
# Javascript generation
Expand Down
Loading

0 comments on commit 665a9f7

Please sign in to comment.