Skip to content

nightly

nightly #1425

Workflow file for this run

# THIS FILE IS PART OF THE CYLC WORKFLOW ENGINE.
# Copyright (C) NIWA & British Crown (Met Office) & Contributors.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Deploy a new version of the documentation or rebuild an existing one.
# Note: This action deletes its previous commits so the nightly build history
# is not preserved and does not require housekeeping.
name: nightly
on:
workflow_dispatch:
schedule:
- cron: '35 0 * * *'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
jobs:
set-meta-releases:
# read the meta-release versions from the branches.json file
runs-on: ubuntu-latest
timeout-minutes: 2
outputs:
list: ${{ steps.set-meta-releases.outputs.meta-releases }}
dict: ${{ steps.set-meta-releases.outputs.meta-releases-dict }}
steps:
- id: set-meta-releases
uses: cylc/release-actions/set-meta-releases@v1
deploy:
needs: set-meta-releases
runs-on: ubuntu-latest
timeout-minutes: 10
defaults:
run:
# use login shell for conda activation
shell: bash -leo pipefail {0}
strategy:
# run one job per meta-release
matrix:
meta_release: ${{ fromJson(needs.set-meta-releases.outputs.list) }}
# don't stop if one job fails
fail-fast: false
# only run one job at a time
max-parallel: 1
env:
META_DICT: ${{ needs.set-meta-releases.outputs.dict }}
steps:
- name: configure python
uses: actions/setup-python@v5
with:
python-version: '3.9'
- name: checkout cylc-doc
uses: actions/checkout@v4
with:
ref: ${{ fromJson(env.META_DICT)[matrix.meta_release]['cylc/cylc-doc'] }}
path: docs
- name: install dependencies
uses: ./docs/.github/actions/install-dependencies
- name: install cylc-doc
run: pip install ./docs/
- name: install libs to document
id: install-libs
uses: cylc/release-actions/install-cylc-components@v1
with:
meta_release: ${{ matrix.meta_release }}
cylc_flow: true
cylc_flow_opts: 'main_loop-log_data_store,main_loop-log_db,main_loop-log_main_loop,main_loop-log_memory'
cylc_uiserver: true
cylc_uiserver_opts: ''
cylc_rose: true
cylc_rose_opts: ''
metomi_rose: true
metomi_rose_opts: ''
- name: checkout gh-pages branch
uses: actions/checkout@v4
with:
ref: gh-pages
path: gh-pages
fetch-depth: 0 # all history (unfortunately all branches too)
- name: install gh-pages
run: |
DOCS="${{ github.workspace }}/docs" \
PAGE="${{ github.workspace }}/gh-pages" \
cd "$DOCS"
rm -r doc
ln -s "$PAGE" doc
- name: configure git
uses: cylc/release-actions/configure-git@v1
- name: remove previous nightly build
id: remove-prev-build
working-directory: gh-pages
continue-on-error: true
run: |
echo "::group::History before rebase: (you can still fetch these commits for recovery)"
git log --oneline --graph --no-abbrev-commit gh-pages
echo "::endgroup::"
echo "[command]git rebase -i --root"
# drop all "-nightly build-" commits which didn't come from this workflow run
EDITOR="sed -i '/-nightly build ${GITHUB_RUN_ID}-/! s/pick \(.* -nightly build\)/drop \1/'" \
git rebase -i --root
# if versions have been added/removed since the last build, we will
# get conflicts on the versions.json file, so need to rebuild it
- name: fix rebase conflict
if: steps.remove-prev-build.outcome == 'failure'
working-directory: gh-pages
run: |
git diff --diff-filter=U
echo "[command]../docs/bin/version . write > versions.json"
../docs/bin/version . write > versions.json
echo "[command]git add versions.json"
git add versions.json
echo "[command]git rebase --continue"
EDITOR=: git rebase --continue
- name: build docs
run: |
version="nightly:${{ matrix.meta_release}}.$(isodatetime --utc -f %Y-%m-%d)"
builddir="nightly_${{ matrix.meta_release }}"
make -C docs \
html \
linkcheck \
SPHINXOPTS="-Wn --keep-going -A sidebar_version_name=${version}" \
STABLE=false \
LATEST=false \
BUILDDIR="doc/$builddir" \
FORCE_COLOR=true
git -C gh-pages add "$builddir" 'versions.json'
- name: debug - pip list
if: failure()
run: pip list
- name: push changes
working-directory: gh-pages
run: |
git status
git commit -m "-nightly build ${GITHUB_RUN_ID}-"
git push --force-with-lease origin gh-pages