From 6a6493e1e057d8fd48a821106fae1ad084a76d47 Mon Sep 17 00:00:00 2001 From: pulpbot Date: Wed, 7 Aug 2024 06:47:11 +0000 Subject: [PATCH] Update CI files [noissue] --- .github/template_gitref | 2 +- .github/workflows/ci.yml | 4 +++ .github/workflows/create-branch.yml | 2 +- .github/workflows/docs.yml | 54 ++++++++++++++++++++++++++++ .github/workflows/scripts/install.sh | 14 +++----- .github/workflows/scripts/script.sh | 10 +----- doc_requirements.txt | 14 ++------ template_config.yml | 5 +-- 8 files changed, 68 insertions(+), 37 deletions(-) create mode 100644 .github/workflows/docs.yml diff --git a/.github/template_gitref b/.github/template_gitref index 9e5cdc0294..b1d8419f4a 100644 --- a/.github/template_gitref +++ b/.github/template_gitref @@ -1 +1 @@ -2021.08.26-364-g6f9579c +2021.08.26-371-gc66a678 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c2f1f1a518..3ee81cdc81 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,6 +46,9 @@ jobs: run: | python .ci/scripts/check_requirements.py + docs: + uses: "./.github/workflows/docs.yml" + lint: uses: "./.github/workflows/lint.yml" @@ -84,6 +87,7 @@ jobs: - "check-commits" - "lint" - "test" + - "docs" if: "always()" steps: - name: "Collect needed jobs results" diff --git a/.github/workflows/create-branch.yml b/.github/workflows/create-branch.yml index a1b904249e..95368e7126 100644 --- a/.github/workflows/create-branch.yml +++ b/.github/workflows/create-branch.yml @@ -33,7 +33,7 @@ jobs: - name: "Install python dependencies" run: | echo ::group::PYDEPS - pip install bump2version jinja2 pyyaml packaging + pip install bump2version jinja2 pyyaml packaging requests echo ::endgroup:: - name: "Setting secrets" diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 0000000000..e455b1a0e6 --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,54 @@ +# WARNING: DO NOT EDIT! +# +# This file was generated by plugin_template, and is managed by it. Please use +# './plugin-template --github pulpcore' to update this file. +# +# For more info visit https://github.com/pulp/plugin_template + +--- +name: "Docs" +on: + workflow_call: + +jobs: + test: + if: "endsWith(github.base_ref, 'main')" + runs-on: "ubuntu-20.04" + defaults: + run: + working-directory: "pulpcore" + steps: + - uses: "actions/checkout@v4" + with: + fetch-depth: 1 + path: "pulpcore" + - uses: "actions/setup-python@v5" + with: + python-version: "3.11" + - name: "Setup cache key" + run: | + git ls-remote https://github.com/pulp/pulp-docs main | tee pulp-docs-main-sha + - uses: "actions/cache@v4" + with: + path: "~/.cache/pip" + key: ${{ runner.os }}-pip-${{ hashFiles('pulp-docs-main-sha') }} + restore-keys: | + ${{ runner.os }}-pip- + - name: "Install python dependencies" + run: | + echo ::group::PYDEPS + pip install -r doc_requirements.txt + echo ::endgroup:: + - name: "Build changelog" + run: | + towncrier build --yes --version 4.0.0.ci + - name: "Build docs" + run: | + pulp-docs build + + no-test: + if: "!endsWith(github.base_ref, 'main')" + runs-on: "ubuntu-20.04" + steps: + - run: | + echo "Skip docs testing on non-main branches." diff --git a/.github/workflows/scripts/install.sh b/.github/workflows/scripts/install.sh index 5b6a0ce813..70d246c2fa 100755 --- a/.github/workflows/scripts/install.sh +++ b/.github/workflows/scripts/install.sh @@ -21,19 +21,15 @@ PLUGIN_SOURCE="./pulpcore/dist/pulpcore-${PLUGIN_VERSION}-py3-none-any.whl" export PULP_API_ROOT="/pulp/" PIP_REQUIREMENTS=("pulp-cli") -if [[ "$TEST" = "docs" || "$TEST" = "publish" ]] +if [[ "$TEST" = "publish" ]] then - PIP_REQUIREMENTS+=("-r" "doc_requirements.txt") PIP_REQUIREMENTS+=("psycopg2-binary") fi pip install ${PIP_REQUIREMENTS[*]} -if [[ "$TEST" != "docs" ]] -then - PULP_CLI_VERSION="$(pip freeze | sed -n -e 's/pulp-cli==//p')" - git clone --depth 1 --branch "$PULP_CLI_VERSION" https://github.com/pulp/pulp-cli.git ../pulp-cli -fi +PULP_CLI_VERSION="$(pip freeze | sed -n -e 's/pulp-cli==//p')" +git clone --depth 1 --branch "$PULP_CLI_VERSION" https://github.com/pulp/pulp-cli.git ../pulp-cli cd .ci/ansible/ if [ "$TEST" = "s3" ]; then @@ -137,9 +133,7 @@ if [ "${PULP_API_ROOT:-}" ]; then fi pulp config create --base-url https://pulp --api-root "$PULP_API_ROOT" --username "admin" --password "password" -if [[ "$TEST" != "docs" ]]; then - cp ~/.config/pulp/cli.toml "${REPO_ROOT}/../pulp-cli/tests/cli.toml" -fi +cp ~/.config/pulp/cli.toml "${REPO_ROOT}/../pulp-cli/tests/cli.toml" ansible-playbook build_container.yaml ansible-playbook start_container.yaml diff --git a/.github/workflows/scripts/script.sh b/.github/workflows/scripts/script.sh index bd3c0c9e0e..3f8f102d37 100755 --- a/.github/workflows/scripts/script.sh +++ b/.github/workflows/scripts/script.sh @@ -18,7 +18,7 @@ source .github/workflows/scripts/utils.sh export POST_SCRIPT=$PWD/.github/workflows/scripts/post_script.sh export FUNC_TEST_SCRIPT=$PWD/.github/workflows/scripts/func_test_script.sh -# Needed for both starting the service and building the docs. +# Needed for starting the service # Gets set in .github/settings.yml, but doesn't seem to inherited by # this script. export DJANGO_SETTINGS_MODULE=pulpcore.app.settings @@ -26,14 +26,6 @@ export PULP_SETTINGS=$PWD/.ci/ansible/settings/settings.py export PULP_URL="https://pulp" -if [[ "$TEST" = "docs" ]]; then - if [[ "$GITHUB_WORKFLOW" == "Core CI" ]]; then - towncrier build --yes --version 4.0.0.ci - fi - pulp-docs build - exit -fi - REPORTED_STATUS="$(pulp status)" echo "machine pulp diff --git a/doc_requirements.txt b/doc_requirements.txt index d7fcb90c07..efc7f6b49b 100644 --- a/doc_requirements.txt +++ b/doc_requirements.txt @@ -1,18 +1,8 @@ # WARNING: DO NOT EDIT! # # This file was generated by plugin_template, and is managed by it. Please use -# './plugin-template --docs pulpcore' to update this file. +# './plugin-template --github pulpcore' to update this file. # # For more info visit https://github.com/pulp/plugin_template --r requirements.txt towncrier - -# Legacy docs -plantuml -sphinx~=7.1.2 -sphinx-rtd-theme==1.3.0 -sphinxcontrib-jquery -sphinxcontrib-openapi -mistune<4.0.0 -Jinja2<3.2 -# Extra requirements +pulp-docs @ git+https://github.com/pulp/pulp-docs@main diff --git a/template_config.yml b/template_config.yml index a11ecdba31..6a2d52d7f6 100644 --- a/template_config.yml +++ b/template_config.yml @@ -1,7 +1,7 @@ # This config represents the latest values used when running the plugin-template. Any settings that # were not present before running plugin-template have been added with their default values. -# generated with plugin_template@2021.08.26-364-g6f9579c +# generated with plugin_template@2021.08.26-371-gc66a678 api_root: /pulp/ black: true @@ -12,7 +12,6 @@ check_stray_pulpcore_imports: false ci_base_image: ghcr.io/pulp/pulp-ci-centos9 ci_env: {} ci_trigger: '{pull_request: {branches: [''*'']}}' -ci_update_docs: false cli_package: pulp-cli cli_repo: https://github.com/pulp/pulp-cli.git core_import_allowed: [] @@ -21,9 +20,7 @@ deploy_client_to_rubygems: true deploy_to_pypi: true disabled_redis_runners: - s3 -doc_requirements_from_pulpcore: false docker_fixtures: true -docs_test: false flake8: true flake8_ignore: - ./pulpcore/app/protobuf/*