From 275c383d26dad3386a5b75cf399f8f7c31b2c51c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ezequiel=20P=C3=A1ssaro?= Date: Sat, 6 Nov 2021 03:13:34 -0300 Subject: [PATCH] doc build workflow restructure (#255) * doc build workflow restructure * trigger docs build --- .github/workflows/docs-build.yml | 112 ++++++++++++++++++++ .github/workflows/documentation-build.yml | 64 ----------- .github/workflows/documentation-preview.yml | 73 ------------- 3 files changed, 112 insertions(+), 137 deletions(-) create mode 100644 .github/workflows/docs-build.yml delete mode 100644 .github/workflows/documentation-build.yml delete mode 100644 .github/workflows/documentation-preview.yml diff --git a/.github/workflows/docs-build.yml b/.github/workflows/docs-build.yml new file mode 100644 index 000000000..260b0cd66 --- /dev/null +++ b/.github/workflows/docs-build.yml @@ -0,0 +1,112 @@ +# For more information about this pipeline, please refer to: +# https://tardis-sn.github.io/tardis/development/continuous_integration.html +# https://tardis-sn.github.io/tardis/development/documentation_preview.html + +name: docs + +on: + push: + branches: + - '*' + + workflow_dispatch: + +concurrency: + group: docs-${{ github.ref }} + cancel-in-progress: true + +env: + XUVTOP: /tmp/chianti + CHIANTI_DL_URL: https://download.chiantidatabase.org + CHIANTI_DB_VER: CHIANTI_v9.0.1_database.tar.gz + CMFGEN_DL_URL: http://kookaburra.phyast.pitt.edu/hillier/cmfgen_files + CMFGEN_DB_VER: atomic_data_15nov16.tar.gz + +jobs: + + build: + runs-on: ubuntu-latest + steps: + + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - uses: actions/cache@v2 + with: + path: ${{ env.XUVTOP }} + key: ${{ env.CHIANTI_DB_VER }} + id: chianti-cache + + - name: Download Chianti database + run: | + mkdir -p ${{ env.XUVTOP }} + wget -q ${{ env.CHIANTI_DL_URL }}/${{ env.CHIANTI_DB_VER }} -O ${{ env.XUVTOP }}/chianti.tar.gz + tar -zxf ${{ env.XUVTOP }}/chianti.tar.gz -C ${{ env.XUVTOP }} --warning=none + if: steps.chianti-cache.outputs.cache-hit != 'true' + + - uses: actions/cache@v2 + with: + path: /tmp/atomic + key: ${{ env.CMFGEN_DB_VER }} + id: cmfgen-cache + + - name: Download CMFGEN database + run: | + wget -q -U "Mozilla/4.0" ${{ env.CMFGEN_DL_URL }}/${{ env.CMFGEN_DB_VER }} -O /tmp/atomic.tar.gz + tar -zxf /tmp/atomic.tar.gz -C /tmp + if: steps.cmfgen-cache.outputs.cache-hit != 'true' + + - name: Setup environment + uses: conda-incubator/setup-miniconda@v2 + with: + miniforge-variant: Mambaforge + miniforge-version: latest + environment-file: carsus_env3.yml + activate-environment: carsus + use-mamba: true + + - name: Install package + shell: bash -l {0} + run: pip install -e . + + - name: Build documentation + shell: bash -l {0} + run: cd docs/; make html + + - name: Deploy main site + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_branch: gh-pages + publish_dir: docs/_build/html + force_orphan: true + if: github.ref == 'refs/heads/master' + + - name: Get branch name + run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" + id: get_branch_name + + # Branch deploy is only available on forks, and requires at least one of + # these conditions to be met: + # + # - branch name contains the word `doc(s)`. + # - commit message includes the a valid tag. + # - the workflow is triggered manually. + + - name: Deploy branch site + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_branch: gh-pages + publish_dir: docs/_build/html + destination_dir: branch/${{ steps.get_branch_name.outputs.branch }} + force_orphan: false + if: github.repository_owner != 'tardis-sn' && + github.ref != 'refs/heads/master' && ( + github.event_name == 'workflow_dispatch' || + contains(github.ref, 'doc') || + contains(github.event.head_commit.message, '[build docs]') || + contains(github.event.head_commit.message, '[build_docs]') || + contains(github.event.head_commit.message, '[build doc]') || + contains(github.event.head_commit.message, '[build_doc]')) diff --git a/.github/workflows/documentation-build.yml b/.github/workflows/documentation-build.yml deleted file mode 100644 index 259ba3f19..000000000 --- a/.github/workflows/documentation-build.yml +++ /dev/null @@ -1,64 +0,0 @@ -name: docs - -on: - push: - branches: - - master - - schedule: - - cron: '10 0 * * 0' - - workflow_dispatch: # Manual trigger - -env: - XUVTOP: /tmp/chianti - CHIANTI_DB_VERSION: 9.0.1 - CHIANTI_DATA_URL: https://download.chiantidatabase.org - CMFGEN_DATA_URL: http://kookaburra.phyast.pitt.edu/hillier/cmfgen_files/atomic_data_15nov16.tar.gz - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - - name: Download Chianti database - run: | - mkdir ${{ env.XUVTOP }} - wget -q $CHIANTI_DB_URL -O ${{ env.XUVTOP }}/chianti_db.tar.gz - tar -zxvf ${{ env.XUVTOP }}/chianti_db.tar.gz -C ${{ env.XUVTOP }} - env: - CHIANTI_DB_URL: ${{ env.CHIANTI_DATA_URL }}/CHIANTI_v${{ env.CHIANTI_DB_VERSION }}_database.tar.gz - - - name: Download CMFGEN database - run: | - wget -q $CMFGEN_DATA_URL -O /tmp/atomic.tar.gz - tar -zxvf /tmp/atomic.tar.gz -C /tmp - - - name: Setup environment - uses: conda-incubator/setup-miniconda@v2 - with: - miniforge-variant: Mambaforge - miniforge-version: latest - environment-file: carsus_env3.yml - activate-environment: carsus - use-mamba: true - - - name: Install package - shell: bash -l {0} - run: python setup.py install - - - name: Build documentation - shell: bash -l {0} - run: cd docs/; make html - - - name: Deploy site - uses: peaceiris/actions-gh-pages@v3 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_branch: gh-pages - publish_dir: docs/_build/html - force_orphan: true diff --git a/.github/workflows/documentation-preview.yml b/.github/workflows/documentation-preview.yml deleted file mode 100644 index 23c7efd4e..000000000 --- a/.github/workflows/documentation-preview.yml +++ /dev/null @@ -1,73 +0,0 @@ -# For more information on how to use this pipeline please refer to: -# - https://tardis-sn.github.io/tardis/development/documentation_preview.html - -name: doc-preview - -on: - push: - -env: - XUVTOP: /tmp/chianti - CHIANTI_DB_VERSION: 9.0.1 - CHIANTI_DATA_URL: https://download.chiantidatabase.org - CMFGEN_DATA_URL: http://kookaburra.phyast.pitt.edu/hillier/cmfgen_files/atomic_data_15nov16.tar.gz - -jobs: - build: - - # This workflow will be triggered: - # - # 1. Only on forks, never on main repository. - # 2. If the branch name contains the word `doc`. - # 3. If the commit message includes the tag `[build docs]`. - - if: github.repository_owner != 'tardis-sn' && (contains(github.ref, 'doc') || contains(github.event.head_commit.message, '[build docs]')) - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - - name: Download Chianti database - run: | - mkdir ${{ env.XUVTOP }} - wget -q $CHIANTI_DB_URL -O ${{ env.XUVTOP }}/chianti_db.tar.gz - tar -zxvf ${{ env.XUVTOP }}/chianti_db.tar.gz -C ${{ env.XUVTOP }} - env: - CHIANTI_DB_URL: ${{ env.CHIANTI_DATA_URL }}/CHIANTI_v${{ env.CHIANTI_DB_VERSION }}_database.tar.gz - - - name: Download CMFGEN database - run: | - wget -q $CMFGEN_DATA_URL -O /tmp/atomic.tar.gz - tar -zxvf /tmp/atomic.tar.gz -C /tmp - - - name: Setup environment - uses: conda-incubator/setup-miniconda@v2 - with: - miniforge-variant: Mambaforge - miniforge-version: latest - environment-file: carsus_env3.yml - activate-environment: carsus - use-mamba: true - - - name: Install package - shell: bash -l {0} - run: python setup.py install - - - name: Build documentation - shell: bash -l {0} - run: cd docs/; make html - - - name: Extract branch name - shell: bash - run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" - id: extract_branch - - - name: Deploy site - uses: peaceiris/actions-gh-pages@v3 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_branch: gh-pages - publish_dir: docs/_build/html - destination_dir: branch/${{ steps.extract_branch.outputs.branch }}