Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

common: simplified pmem.io doc update #5818

Merged
merged 1 commit into from
Jul 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/workflows/pmem.io_doc_update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Update the PMDK documentation on pmem.io
name: pmem.io

on:
workflow_dispatch:
push:
paths:
- 'doc/**'

jobs:
doc_update:
if: github.ref_name == 'master' || startsWith(github.ref_name, 'stable-')
name: doc update
runs-on: ubuntu-latest
steps:
- name: Clone the git repo
uses: actions/checkout@v3

- name: Install dependencies
run: sudo apt-get install libndctl-dev libdaxctl-dev pandoc

- name: Auto doc update
env:
DOC_UPDATE_GITHUB_TOKEN: ${{ secrets.DOC_UPDATE_GITHUB_TOKEN }}
TARGET_BRANCH: ${{ github.ref_name }}
WORKDIR: .
run: utils/run-doc-update.sh
7 changes: 0 additions & 7 deletions utils/docker/build-CI.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,6 @@ if [[ -f $CI_FILE_SKIP_BUILD_PKG_CHECK ]]; then BUILD_PACKAGE_CHECK=n; else BUIL
if [ -z "$NDCTL_ENABLE" ]; then ndctl_enable=; else ndctl_enable="--env NDCTL_ENABLE=$NDCTL_ENABLE"; fi
if [[ $UBSAN -eq 1 ]]; then for x in C CPP LD; do declare EXTRA_${x}FLAGS=-fsanitize=undefined; done; fi

# Only run auto doc update on push events on "upstream" repo
if [[ "${CI_EVENT_TYPE}" != "push" || "${CI_REPO_SLUG}" != "${GITHUB_REPO}" ]]; then
AUTO_DOC_UPDATE=0
echo "Skipping auto doc update"
fi

# Check if we are running on a CI (GitHub Actions)
[ -n "$GITHUB_ACTIONS" ] && CI_RUN="YES" || CI_RUN="NO"

Expand All @@ -75,7 +69,6 @@ docker run --rm --name=$containerName -i \
$DNS_SETTING \
--env http_proxy=$http_proxy \
--env https_proxy=$https_proxy \
--env AUTO_DOC_UPDATE=$AUTO_DOC_UPDATE \
--env CC=$PMDK_CC \
--env CXX=$PMDK_CXX \
--env VALGRIND=$VALGRIND \
Expand Down
7 changes: 0 additions & 7 deletions utils/docker/run-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,3 @@ make -j1 pycheck
echo ""
echo "## Running make source"
make -j$(nproc) DESTDIR=/tmp source

# Create PR with generated docs
if [ "${AUTO_DOC_UPDATE}" == "1" ]; then
echo ""
echo "## Running auto doc update"
./utils/docker/run-doc-update.sh
fi
26 changes: 12 additions & 14 deletions utils/docker/run-doc-update.sh → utils/run-doc-update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
# Copyright 2019-2023, Intel Corporation

#
# run-doc-update.sh - is called inside a Docker container to build docs in the current repository,
# it checks if current branch is a 'valid' one (to only publish "merged" content, not from a PR),
# and it creates a pull request with an update of our docs (on 'main' branch of pmem.github.io repo).
# run-doc-update.sh - builds docs and creates a pull request with an update to
# the pmem.github.io repository. The only supported branches are master
# and stable-*.
#
set -e

Expand All @@ -31,21 +31,19 @@ ARTIFACTS_DIR=$(mktemp -d -t ARTIFACTS-XXX)
ORIGIN="https://${DOC_UPDATE_GITHUB_TOKEN}@github.com/${BOT_NAME}/${PAGES_REPO_NAME}"
UPSTREAM="https://github.com/${USER_NAME}/${PAGES_REPO_NAME}"

# Only 'master' or 'stable-*' branches are valid; determine docs location dir on gh-pages branch
TARGET_BRANCH=${CI_BRANCH}
if [[ "${TARGET_BRANCH}" == "master" ]]; then
# Determine docs location dir on gh-pages branch
case $TARGET_BRANCH in
master)
TARGET_DOCS_DIR="master"
elif [[ ${TARGET_BRANCH} == stable-* ]]; then
;;
stable-*)
TARGET_DOCS_DIR=v$(echo ${TARGET_BRANCH} | cut -d"-" -f2 -s)
else
echo "Skipping docs build, this script should be run only on master or stable-* branches."
;;
*)
echo "ERROR: This script should be run only on master or stable-* branches."
echo "TARGET_BRANCH is set to: \'${TARGET_BRANCH}\'."
exit 0
fi
if [ -z "${TARGET_DOCS_DIR}" ]; then
echo "ERROR: Target docs location for branch: ${TARGET_BRANCH} is not set."
exit 1
fi
esac

pushd ${WORKDIR}/doc
echo "Build docs and copy man & web md"
Expand Down
Loading