From f0488b4989071e6e6629f11f51fb6a1501e759eb Mon Sep 17 00:00:00 2001 From: Jean-Marie Burel Date: Thu, 12 Nov 2020 11:56:57 +0000 Subject: [PATCH 01/13] add file to build doc in /docs --- workflow-templates/docs.properties.json | 8 ++++++++ workflow-templates/docs.yml | 21 +++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 workflow-templates/docs.properties.json create mode 100644 workflow-templates/docs.yml diff --git a/workflow-templates/docs.properties.json b/workflow-templates/docs.properties.json new file mode 100644 index 0000000..ad93915 --- /dev/null +++ b/workflow-templates/docs.properties.json @@ -0,0 +1,8 @@ +{ + "name": "Build Sphinx documentation", + "description": "Build Sphinx documentation contained in the /docs folder.", + "iconName": "python", + "categories": [ + "Python" + ] +} \ No newline at end of file diff --git a/workflow-templates/docs.yml b/workflow-templates/docs.yml new file mode 100644 index 0000000..4cd0da3 --- /dev/null +++ b/workflow-templates/docs.yml @@ -0,0 +1,21 @@ +# Builds the Sphinx documentation in the docs folder + +--- +name: docs + +on: + push: + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + - name: Sphinx install + run: pip install --upgrade sphinx + - name: Build doc + run: | + cd docs + make clean html linkcheck From e31dd2bd65c3dc74c46d1b93a4b815a9848131c1 Mon Sep 17 00:00:00 2001 From: Jean-Marie Burel Date: Thu, 12 Nov 2020 12:44:39 +0000 Subject: [PATCH 02/13] change name --- workflow-templates/docs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workflow-templates/docs.yml b/workflow-templates/docs.yml index 4cd0da3..04707b7 100644 --- a/workflow-templates/docs.yml +++ b/workflow-templates/docs.yml @@ -1,7 +1,7 @@ # Builds the Sphinx documentation in the docs folder --- -name: docs +name: sphinx on: push: From ea69fd1c2d87fce92dc54d71caac8af099d0a900 Mon Sep 17 00:00:00 2001 From: Jean-Marie Burel Date: Thu, 12 Nov 2020 12:45:16 +0000 Subject: [PATCH 03/13] rename files --- .../{docs.properties.json => sphinx.properties.json} | 0 workflow-templates/{docs.yml => sphinx.yml} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename workflow-templates/{docs.properties.json => sphinx.properties.json} (100%) rename workflow-templates/{docs.yml => sphinx.yml} (100%) diff --git a/workflow-templates/docs.properties.json b/workflow-templates/sphinx.properties.json similarity index 100% rename from workflow-templates/docs.properties.json rename to workflow-templates/sphinx.properties.json diff --git a/workflow-templates/docs.yml b/workflow-templates/sphinx.yml similarity index 100% rename from workflow-templates/docs.yml rename to workflow-templates/sphinx.yml From 11f9d4b6fa23fa75e232a98911b429d45e976369 Mon Sep 17 00:00:00 2001 From: Jean-Marie Burel Date: Thu, 12 Nov 2020 12:48:20 +0000 Subject: [PATCH 04/13] schedule build --- workflow-templates/sphinx.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/workflow-templates/sphinx.yml b/workflow-templates/sphinx.yml index 04707b7..cd36ac4 100644 --- a/workflow-templates/sphinx.yml +++ b/workflow-templates/sphinx.yml @@ -6,6 +6,8 @@ name: sphinx on: push: pull_request: + schedule: + - cron: '0 0 * * 0' jobs: build: From 26893c36785f4d7da3308f22a60de3592e1d84c7 Mon Sep 17 00:00:00 2001 From: Jean-Marie Burel Date: Thu, 12 Nov 2020 13:56:26 +0000 Subject: [PATCH 05/13] use work-directory --- workflow-templates/sphinx.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/workflow-templates/sphinx.yml b/workflow-templates/sphinx.yml index cd36ac4..af6c3c9 100644 --- a/workflow-templates/sphinx.yml +++ b/workflow-templates/sphinx.yml @@ -1,4 +1,5 @@ -# Builds the Sphinx documentation in the docs folder +# Builds the Sphinx documentation in the specified folder. +# Default is docs/ --- name: sphinx @@ -12,12 +13,14 @@ on: jobs: build: runs-on: ubuntu-latest + env: + docs-directory: ./docs steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 - name: Sphinx install run: pip install --upgrade sphinx - name: Build doc + working-directory: ${{ env.docs-directory }} run: | - cd docs make clean html linkcheck From 1c5f91000f01b793f4e8dd9f6833455427419b93 Mon Sep 17 00:00:00 2001 From: Jean-Marie Burel Date: Thu, 12 Nov 2020 14:03:22 +0000 Subject: [PATCH 06/13] use default dir --- workflow-templates/sphinx.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/workflow-templates/sphinx.yml b/workflow-templates/sphinx.yml index af6c3c9..c305d96 100644 --- a/workflow-templates/sphinx.yml +++ b/workflow-templates/sphinx.yml @@ -13,14 +13,14 @@ on: jobs: build: runs-on: ubuntu-latest - env: - docs-directory: ./docs + defaults: + run: + working-directory: ./docs steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 - name: Sphinx install run: pip install --upgrade sphinx - name: Build doc - working-directory: ${{ env.docs-directory }} run: | make clean html linkcheck From 99a1703e9afd01608de011dbe21c54667ecda06d Mon Sep 17 00:00:00 2001 From: Jean-Marie Burel Date: Thu, 12 Nov 2020 14:04:28 +0000 Subject: [PATCH 07/13] add line --- workflow-templates/sphinx.properties.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workflow-templates/sphinx.properties.json b/workflow-templates/sphinx.properties.json index ad93915..850ab2e 100644 --- a/workflow-templates/sphinx.properties.json +++ b/workflow-templates/sphinx.properties.json @@ -5,4 +5,4 @@ "categories": [ "Python" ] -} \ No newline at end of file +} From 7c7d096bac8387773792b6ed28f90c00142fc970 Mon Sep 17 00:00:00 2001 From: Jean-Marie Burel Date: Thu, 12 Nov 2020 18:03:53 +0000 Subject: [PATCH 08/13] use secrets to pass parameters --- workflow-templates/sphinx.yml | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/workflow-templates/sphinx.yml b/workflow-templates/sphinx.yml index c305d96..b79ee18 100644 --- a/workflow-templates/sphinx.yml +++ b/workflow-templates/sphinx.yml @@ -13,14 +13,31 @@ on: jobs: build: runs-on: ubuntu-latest - defaults: - run: - working-directory: ./docs + env: + directory_path: ${{ secrets.directory_path }} + check_link: ${{ secrets.check_link }} steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 - name: Sphinx install run: pip install --upgrade sphinx + - name: Set directory + run: echo "docs_dir=./docs" >> $GITHUB_ENV + if: ${{ env.directory_path == '' }} + - name: Set directory + run: echo "docs_dir="${{ env.directory_path }} >> $GITHUB_ENV + if: ${{ env.directory_path != '' }} + - name: Set linkcheck option + run: echo "link=true" >> $GITHUB_ENV + if: ${{ env.check_link == '' }} + - name: Set linkcheck option + run: echo "link=false" >> $GITHUB_ENV + if: ${{ env.check_link != '' }} - name: Build doc run: | - make clean html linkcheck + cd $docs_dir + if [ "$link" = true ]; then + make clean html linkcheck + else + make clean html + fi From 5ccac01b2bc2320c4b1dccc837dc2e9bdaab6890 Mon Sep 17 00:00:00 2001 From: Jean-Marie Burel Date: Thu, 12 Nov 2020 18:14:55 +0000 Subject: [PATCH 09/13] add doc --- workflow-templates/sphinx.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/workflow-templates/sphinx.yml b/workflow-templates/sphinx.yml index b79ee18..6118c5d 100644 --- a/workflow-templates/sphinx.yml +++ b/workflow-templates/sphinx.yml @@ -1,5 +1,8 @@ # Builds the Sphinx documentation in the specified folder. -# Default is docs/ +# Default values are docs/ for the directory where the Sphinx +# documentation is located and true to run linkcheck +# To pass a new folder, set directory_path to the folder path +# To disable linkcheck, set check_link to any value --- name: sphinx @@ -40,4 +43,4 @@ jobs: make clean html linkcheck else make clean html - fi + fi From fedf878f070ac24de36c21e719415a4716130c0f Mon Sep 17 00:00:00 2001 From: Jean-Marie Burel Date: Mon, 16 Nov 2020 18:56:02 +0000 Subject: [PATCH 10/13] remove usage of secrets --- workflow-templates/sphinx.yml | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/workflow-templates/sphinx.yml b/workflow-templates/sphinx.yml index 6118c5d..e31f4dd 100644 --- a/workflow-templates/sphinx.yml +++ b/workflow-templates/sphinx.yml @@ -17,8 +17,8 @@ jobs: build: runs-on: ubuntu-latest env: - directory_path: ${{ secrets.directory_path }} - check_link: ${{ secrets.check_link }} + directory_path: + check_link: true # set to false to remove linkcheck steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 @@ -30,16 +30,10 @@ jobs: - name: Set directory run: echo "docs_dir="${{ env.directory_path }} >> $GITHUB_ENV if: ${{ env.directory_path != '' }} - - name: Set linkcheck option - run: echo "link=true" >> $GITHUB_ENV - if: ${{ env.check_link == '' }} - - name: Set linkcheck option - run: echo "link=false" >> $GITHUB_ENV - if: ${{ env.check_link != '' }} - name: Build doc run: | cd $docs_dir - if [ "$link" = true ]; then + if [ "${{ env.check_link }}" = true ]; then make clean html linkcheck else make clean html From b2e19fada99ba8d2e1d66c9fe6990d6444fdcf01 Mon Sep 17 00:00:00 2001 From: Jean-Marie Burel Date: Wed, 18 Nov 2020 15:20:54 +0000 Subject: [PATCH 11/13] Simplify set directory step --- workflow-templates/sphinx.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/workflow-templates/sphinx.yml b/workflow-templates/sphinx.yml index e31f4dd..4a99999 100644 --- a/workflow-templates/sphinx.yml +++ b/workflow-templates/sphinx.yml @@ -25,11 +25,9 @@ jobs: - name: Sphinx install run: pip install --upgrade sphinx - name: Set directory - run: echo "docs_dir=./docs" >> $GITHUB_ENV - if: ${{ env.directory_path == '' }} - - name: Set directory - run: echo "docs_dir="${{ env.directory_path }} >> $GITHUB_ENV - if: ${{ env.directory_path != '' }} + run: | + VAR=${{ env.directory_path }} + echo "docs_dir="${VAR:-./docs} >> $GITHUB_ENV - name: Build doc run: | cd $docs_dir From f37bcce1b2ce7540f80aac89aae5d4fcba9fd9eb Mon Sep 17 00:00:00 2001 From: Jean-Marie Burel Date: Wed, 18 Nov 2020 15:23:00 +0000 Subject: [PATCH 12/13] fix layout --- workflow-templates/sphinx.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/workflow-templates/sphinx.yml b/workflow-templates/sphinx.yml index 4a99999..d1bc724 100644 --- a/workflow-templates/sphinx.yml +++ b/workflow-templates/sphinx.yml @@ -26,8 +26,8 @@ jobs: run: pip install --upgrade sphinx - name: Set directory run: | - VAR=${{ env.directory_path }} - echo "docs_dir="${VAR:-./docs} >> $GITHUB_ENV + VAR=${{ env.directory_path }} + echo "docs_dir="${VAR:-./docs} >> $GITHUB_ENV - name: Build doc run: | cd $docs_dir From bea60bb80896c27f9f37bf284cc2a19004b47045 Mon Sep 17 00:00:00 2001 From: Jean-Marie Burel Date: Tue, 1 Dec 2020 11:11:17 +0000 Subject: [PATCH 13/13] pass commands --- workflow-templates/sphinx.yml | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/workflow-templates/sphinx.yml b/workflow-templates/sphinx.yml index d1bc724..c0aea8a 100644 --- a/workflow-templates/sphinx.yml +++ b/workflow-templates/sphinx.yml @@ -2,7 +2,7 @@ # Default values are docs/ for the directory where the Sphinx # documentation is located and true to run linkcheck # To pass a new folder, set directory_path to the folder path -# To disable linkcheck, set check_link to any value +# Pass the arguments you wish to run, default command is make clean html linkcheck --- name: sphinx @@ -18,7 +18,7 @@ jobs: runs-on: ubuntu-latest env: directory_path: - check_link: true # set to false to remove linkcheck + sphinx_commands: clean html linkcheck # commands to run. Update accordingly steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 @@ -31,8 +31,4 @@ jobs: - name: Build doc run: | cd $docs_dir - if [ "${{ env.check_link }}" = true ]; then - make clean html linkcheck - else - make clean html - fi + make ${{ env.sphinx_commands }}