From 284b52f57c81d88462a284b4e4f7d6a6d2233bfb Mon Sep 17 00:00:00 2001 From: Anabelle Date: Tue, 15 Aug 2023 06:09:11 -0500 Subject: [PATCH 1/7] Fix broken links (#1756) Four links on the doc-site's homepage are 404'ing because their href/URI's fragment identifier is preceded with a /. Removal of the extra slash fixes. Closes: #1759 --- docs/index.markdown | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/index.markdown b/docs/index.markdown index 2aadc33ec..07dfdf927 100644 --- a/docs/index.markdown +++ b/docs/index.markdown @@ -28,7 +28,7 @@ Before you start using vagrant-libvirt, please make sure your Libvirt and QEMU installation is working correctly and you are able to create QEMU or KVM type virtual machines with `virsh` or `virt-manager`. -See [Requirements]({{ '/installation/#requirements' | relative_url }}) for guides and details. +See [Requirements]({{ '/installation#requirements' | relative_url }}) for guides and details. ## Installation @@ -59,11 +59,11 @@ See [Requirements]({{ '/installation/#requirements' | relative_url }}) for guide vagrant plugin install vagrant-libvirt ``` -If you encounter any errors during this process, check that you have installed all the prerequisites in [Requirements]({{ '/installation/#requirements' | relative_url }}). -If you still have issues, see [Troubleshooting]({{ '/troubleshooting/#installation-problems' | relative_url }}). +If you encounter any errors during this process, check that you have installed all the prerequisites in [Requirements]({{ '/installation#requirements' | relative_url }}). +If you still have issues, see [Troubleshooting]({{ '/troubleshooting#installation-problems' | relative_url }}). {: .info } -Installation varies based on your operating system or use of upstream vagrant. See our [guides]({{ '/installation/#guides' | relative_url }}) for OS-specific instructions. +Installation varies based on your operating system or use of upstream vagrant. See our [guides]({{ '/installation#guides' | relative_url }}) for OS-specific instructions. ## Initial Project Creation From 1ebfacf979870c2a96ca3733dbee94b3fdfee8bc Mon Sep 17 00:00:00 2001 From: Darragh Bailey Date: Tue, 15 Aug 2023 12:19:09 +0100 Subject: [PATCH 2/7] Adjust groups to reduce test dependencies (#1748) Switch around the groups defined in the Gemfile to allow execution without installing additional tools that are useful for development but not needed for testing or packaging. --- .github/workflows/integration-tests.yml | 34 +++++-------------- .../publish-documentation-preview.yml | 6 ++-- .github/workflows/unit-tests.yml | 31 ++++++----------- Gemfile | 5 +-- .../action/handle_storage_pool.rb | 3 ++ spec/unit/util/network_util_spec.rb | 2 ++ 6 files changed, 31 insertions(+), 50 deletions(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 26eb597b9..4a1c5bab3 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -13,6 +13,9 @@ jobs: matrix: ${{ steps.generate-matrix.outputs.matrix }} env: + # skip installing development group gems to save time + BUNDLE_WITHOUT: 'development' + BUNDLE_JOBS: 4 NOKOGIRI_USE_SYSTEM_LIBRARIES: true VAGRANT_VERSION: v2.2.14 @@ -27,20 +30,11 @@ jobs: libvirt-dev \ libz-dev \ ; - - uses: actions/cache@v3 - with: - path: vendor/bundle - key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} - restore-keys: | - ${{ runner.os }}-gems- - name: Set up Ruby uses: ruby/setup-ruby@v1 with: ruby-version: 2.6.6 - - name: Run bundler using cached path - run: | - bundle config path vendor/bundle - bundle install --jobs 4 --retry 3 + bundler-cache: true - name: Generate matrix id: generate-matrix run: | @@ -59,6 +53,9 @@ jobs: test_name: ${{ fromJSON(needs.generate-matrix.outputs.matrix) }} env: + # skip installing development group gems to save time + BUNDLE_WITHOUT: 'development' + BUNDLE_JOBS: 4 NOKOGIRI_USE_SYSTEM_LIBRARIES: true VAGRANT_VERSION: v2.2.14 @@ -91,26 +88,11 @@ jobs: # add user to group sudo usermod -a -G libvirt $USER - - uses: actions/cache@v3 - with: - path: vendor/bundle - key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} - restore-keys: | - ${{ runner.os }}-gems- - - uses: actions/cache@v3 - with: - path: ~/.vagrant.d/boxes - key: ${{ runner.os }}-${{ env.VAGRANT_VERSION }} - restore-keys: | - ${{ runner.os }}- - name: Set up Ruby uses: ruby/setup-ruby@v1 with: ruby-version: 2.6.6 - - name: Run bundler using cached path - run: | - bundle config path vendor/bundle - bundle install --jobs 4 --retry 3 + bundler-cache: true - name: Run tests run: | mkdir -p $HOME/.vagrant.d/ diff --git a/.github/workflows/publish-documentation-preview.yml b/.github/workflows/publish-documentation-preview.yml index 3aa141f60..31ecc626e 100644 --- a/.github/workflows/publish-documentation-preview.yml +++ b/.github/workflows/publish-documentation-preview.yml @@ -25,6 +25,9 @@ jobs: uses: ruby/setup-ruby@v1 with: ruby-version: 2.7 + bundler-cache: true + env: + BUNDLE_GEMFILE: ./docs/Gemfile - name: Install and Build 🔧 # don't allow a close to execute anything from the source code if: ${{ github.event.action == 'labeled' }} @@ -41,8 +44,7 @@ jobs: plugin_script_base_path: /${REPO_NAME}/pr-preview/pr-${PR_NUMBER} EOF - BUNDLE_GEMFILE=./docs/Gemfile bundle install - BUNDLE_GEMFILE=./docs/Gemfile bundle exec jekyll build --source docs/ --baseurl="/${REPO_NAME}/pr-preview/pr-${PR_NUMBER}" --destination build + bundle exec jekyll build --source docs/ --baseurl="/${REPO_NAME}/pr-preview/pr-${PR_NUMBER}" --destination build - name: Set action run: | event_type=$(jq -r ".action" "$GITHUB_EVENT_PATH") diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 68e4898c8..6e4892826 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -63,20 +63,6 @@ jobs: run: | sudo apt-get update sudo apt-get install libvirt-dev - - uses: actions/cache@v3 - with: - path: vendor/bundle - key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} - restore-keys: | - ${{ runner.os }}-gems- - - name: Set up Ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: ${{ matrix.ruby }} - - name: Set up rubygems - run: | - gem update --system --conservative || (gem i "rubygems-update:~>2.7" --no-document && update_rubygems) - gem update bundler --conservative - name: Ensure bundle uses https instead of insecure git run: | git config --global url."https://github.com/".insteadOf git://github.com/ @@ -92,17 +78,22 @@ jobs: cp .deps/libvirt-ruby/pkg/ruby-libvirt-*.gem vendor/bundle/ruby/3.0.0/cache/ # need the following to allow the local provided gem to be used instead of the # one from rubygems - bundle config set --local disable_checksum_validation true - - name: Run bundler using cached path - run: | - bundle config path vendor/bundle - bundle install --jobs 4 --retry 3 + echo "BUNDLE_DISABLE_CHECKSUM_VALIDATION=true" >> ${GITHUB_ENV} + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + bundler-cache: true env: + # skip installing development group gems to save time + BUNDLE_WITHOUT: 'development' + BUNDLE_JOBS: 4 VAGRANT_VERSION: ${{ matrix.vagrant }} - name: Run tests run: | - bundle exec rspec --color --format documentation + bundle exec parallel_test spec --type rspec env: + BUNDLE_WITHOUT: 'development' VAGRANT_VERSION: ${{ matrix.vagrant }} - name: Coveralls Parallel uses: coverallsapp/github-action@master diff --git a/Gemfile b/Gemfile index 667a86bd8..52c6376d0 100644 --- a/Gemfile +++ b/Gemfile @@ -2,7 +2,7 @@ source 'https://rubygems.org' -group :development do +group :test do # We depend on Vagrant for development, but we don't add it as a # gem dependency because we expect to be installed within the # Vagrant environment itself using `vagrant plugin`. @@ -46,10 +46,11 @@ group :plugins do gemspec end -group :test do +group :development do gem "test-prof", require: false gem "ruby-prof", ">= 0.17.0", require: false gem 'stackprof', '>= 0.2.9', require: false + gem 'rubocop', require: false end gem 'parallel_tests', group: [:development, :test], require: false diff --git a/lib/vagrant-libvirt/action/handle_storage_pool.rb b/lib/vagrant-libvirt/action/handle_storage_pool.rb index 28574160b..ee9f524fe 100644 --- a/lib/vagrant-libvirt/action/handle_storage_pool.rb +++ b/lib/vagrant-libvirt/action/handle_storage_pool.rb @@ -2,6 +2,9 @@ require 'log4r' +require 'vagrant-libvirt/util/erb_template' +require 'vagrant-libvirt/util/storage_util' + module VagrantPlugins module ProviderLibvirt module Action diff --git a/spec/unit/util/network_util_spec.rb b/spec/unit/util/network_util_spec.rb index 5eccf28f8..a7e13f376 100644 --- a/spec/unit/util/network_util_spec.rb +++ b/spec/unit/util/network_util_spec.rb @@ -1,5 +1,7 @@ # frozen_string_literal: true +require 'rexml/document' + require_relative '../../spec_helper' require 'vagrant-libvirt/util/network_util' From 13acc0500b22c6addac86d332082c83b2014e2c9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 15 Aug 2023 12:09:19 +0000 Subject: [PATCH 3/7] Bump JamesIves/github-pages-deploy-action from 4.4.2 to 4.4.3 (#1751) --- .github/workflows/publish-documentation-release.yml | 2 +- .github/workflows/publish-documentation.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish-documentation-release.yml b/.github/workflows/publish-documentation-release.yml index 80ab4b660..7f8c13895 100644 --- a/.github/workflows/publish-documentation-release.yml +++ b/.github/workflows/publish-documentation-release.yml @@ -34,7 +34,7 @@ jobs: BUNDLE_GEMFILE=./docs/Gemfile bundle install BUNDLE_GEMFILE=./docs/Gemfile bundle exec jekyll build --source docs/ --baseurl="/${REPO_NAME}/version/${VERSION}" --destination build - name: Deploy 🚀 - uses: JamesIves/github-pages-deploy-action@v4.4.2 + uses: JamesIves/github-pages-deploy-action@v4.4.3 with: branch: gh-pages folder: build diff --git a/.github/workflows/publish-documentation.yml b/.github/workflows/publish-documentation.yml index 22f5420dc..0a4efdc73 100644 --- a/.github/workflows/publish-documentation.yml +++ b/.github/workflows/publish-documentation.yml @@ -33,7 +33,7 @@ jobs: BUNDLE_GEMFILE=./docs/Gemfile bundle install BUNDLE_GEMFILE=./docs/Gemfile bundle exec jekyll build --source docs/ --destination build - name: Deploy 🚀 - uses: JamesIves/github-pages-deploy-action@v4.4.2 + uses: JamesIves/github-pages-deploy-action@v4.4.3 with: branch: gh-pages folder: build From 1783e762d59ace79a2f2f4db5e460e5a2a8f7592 Mon Sep 17 00:00:00 2001 From: Darragh Bailey Date: Wed, 16 Aug 2023 00:18:50 +0100 Subject: [PATCH 4/7] Revert "Bump JamesIves/github-pages-deploy-action from 4.4.2 to 4.4.3" (#1760) Reverts vagrant-libvirt/vagrant-libvirt#1751 --- .github/workflows/publish-documentation-release.yml | 2 +- .github/workflows/publish-documentation.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish-documentation-release.yml b/.github/workflows/publish-documentation-release.yml index 7f8c13895..80ab4b660 100644 --- a/.github/workflows/publish-documentation-release.yml +++ b/.github/workflows/publish-documentation-release.yml @@ -34,7 +34,7 @@ jobs: BUNDLE_GEMFILE=./docs/Gemfile bundle install BUNDLE_GEMFILE=./docs/Gemfile bundle exec jekyll build --source docs/ --baseurl="/${REPO_NAME}/version/${VERSION}" --destination build - name: Deploy 🚀 - uses: JamesIves/github-pages-deploy-action@v4.4.3 + uses: JamesIves/github-pages-deploy-action@v4.4.2 with: branch: gh-pages folder: build diff --git a/.github/workflows/publish-documentation.yml b/.github/workflows/publish-documentation.yml index 0a4efdc73..22f5420dc 100644 --- a/.github/workflows/publish-documentation.yml +++ b/.github/workflows/publish-documentation.yml @@ -33,7 +33,7 @@ jobs: BUNDLE_GEMFILE=./docs/Gemfile bundle install BUNDLE_GEMFILE=./docs/Gemfile bundle exec jekyll build --source docs/ --destination build - name: Deploy 🚀 - uses: JamesIves/github-pages-deploy-action@v4.4.3 + uses: JamesIves/github-pages-deploy-action@v4.4.2 with: branch: gh-pages folder: build From 06fa756b98f3a86254e3bd2cf2b17f2bd5829023 Mon Sep 17 00:00:00 2001 From: Darragh Bailey Date: Mon, 28 Aug 2023 20:41:36 +0100 Subject: [PATCH 5/7] Update publish docs workflows (#1762) Switch to standard workflow for building the documentation from pull requests and use a workflow call to trigger the deployment for write access. This should limit the ability to compromise documentation site from forked PRs while allow validation of dependency changes as well as more of the actions that impact the deploy. --- .github/workflows/build-docs/action.yml | 56 +++++++++ .../workflows/build-documentation-preview.yml | 39 ++++++ .github/workflows/deploy-docs-preview.yml | 116 ++++++++++++++++++ .github/workflows/deploy-docs.yml | 39 ++++++ .github/workflows/docker-image.yml | 4 + .github/workflows/integration-tests.yml | 4 + .../publish-documentation-preview-notify.yml | 25 ---- .../publish-documentation-preview.yml | 78 ------------ .../publish-documentation-release.yml | 35 +----- .github/workflows/publish-documentation.yml | 33 +---- .github/workflows/unit-tests.yml | 1 + 11 files changed, 266 insertions(+), 164 deletions(-) create mode 100644 .github/workflows/build-docs/action.yml create mode 100644 .github/workflows/build-documentation-preview.yml create mode 100644 .github/workflows/deploy-docs-preview.yml create mode 100644 .github/workflows/deploy-docs.yml delete mode 100644 .github/workflows/publish-documentation-preview-notify.yml delete mode 100644 .github/workflows/publish-documentation-preview.yml diff --git a/.github/workflows/build-docs/action.yml b/.github/workflows/build-docs/action.yml new file mode 100644 index 000000000..3be1d1817 --- /dev/null +++ b/.github/workflows/build-docs/action.yml @@ -0,0 +1,56 @@ +name: Build Docs +inputs: + extra-config: + required: false + type: string + target-folder: + require: false + type: string + +runs: + using: composite + steps: + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: 2.7 + + - name: Configure + shell: bash + env: + TARGET_FOLDER: ${{ inputs.target-folder }} + EXTRA_CONFIG: ${{ inputs.extra-config }} + run: | + [[ ${RUNNER_DEBUG:-0} -eq 1 ]] && set -x + + REPO_NAME=$(jq -r ".repository.name" "$GITHUB_EVENT_PATH") + + TEMP_CONFIG=$(mktemp) + # avoid look up of API as it doesn't work from within actions without exposing the GITHUB_TOKEN here which is a security risk + cat <> ${TEMP_CONFIG} + repository_nwo: ${GITHUB_REPOSITORY} + EOF + + if [[ -n "${TARGET_FOLDER}" ]] + then + echo "baseurl: /${REPO_NAME}/${TARGET_FOLDER}" >> ${TEMP_CONFIG} + fi + + # allow override of everything + cat <> ${TEMP_CONFIG} + ${EXTRA_CONFIG} + EOF + + echo "Adding additional config settings:" + cat ${TEMP_CONFIG} | tee docs/_config.yml + + - name: Install and Build + shell: bash + env: + BUNDLE_GEMFILE: ./docs/Gemfile + run: | + # TODO find a way for jekyll to perform this automatically + convert docs/_assets/images/logo.png -define icon:auto-resize=256,64,48,32,16 docs/favicon.ico + + bundle install + bundle exec jekyll build --source docs/ --destination build diff --git a/.github/workflows/build-documentation-preview.yml b/.github/workflows/build-documentation-preview.yml new file mode 100644 index 000000000..e3fe13c4b --- /dev/null +++ b/.github/workflows/build-documentation-preview.yml @@ -0,0 +1,39 @@ +name: Build Docs Preview +on: + pull_request: + types: + - closed + - opened + - reopened + - synchronize + paths: + - 'docs/**' + - '.github/workflows/build-documentation-preview.yml' + - '.github/workflows/build-docs/**' + +jobs: + build-docs: + runs-on: ubuntu-latest + steps: + - name: Checkout 🛎️ + uses: actions/checkout@v3 + + - name: Build docs 🔧 + if: github.event.action != 'closed' + uses: ./.github/workflows/build-docs + with: + target-folder: "pr-preview/pr-${{ github.event.number }}" + extra-config: | + plugin_script_base_path: "/${{ github.event.repository.name }}/pr-preview/pr-${{ github.event.number }}" + + - uses: actions/upload-artifact@v2 + if: github.event.action != 'closed' + with: + name: jekyll-docs + path: | + build/** + + - uses: actions/upload-artifact@v2 + with: + name: source-event + path: ${{ github.event_path }} diff --git a/.github/workflows/deploy-docs-preview.yml b/.github/workflows/deploy-docs-preview.yml new file mode 100644 index 000000000..bdbc8e9da --- /dev/null +++ b/.github/workflows/deploy-docs-preview.yml @@ -0,0 +1,116 @@ +name: Deploy Docs Preview +on: + workflow_run: + workflows: + - "Build Docs Preview" + types: + - completed + +permissions: + contents: write + pull-requests: write + +jobs: + deploy-preview: + concurrency: publish-gh-pages + runs-on: ubuntu-latest + if: github.event.workflow_run.event == 'pull_request' + steps: + - name: Checkout 🛎️ + uses: actions/checkout@v3 + + - name: 'Download artifact' + uses: dawidd6/action-download-artifact@v2 + with: + run_id: ${{github.event.workflow_run.id }} + + - name: Configure Settings + env: + SOURCE_EVENT_PATH: source-event/event.json + run: | + echo "Using ${SOURCE_EVENT_PATH} as event source" + + event_type=$(jq -r ".action" "$SOURCE_EVENT_PATH") + echo "event_type is $event_type" + case $event_type in + "opened" | "reopened" | "synchronize") + echo "action=deploy" >> $GITHUB_ENV + ;; + "closed") + echo "action=remove" >> $GITHUB_ENV + ;; + *) + echo "unknown event type $event_type; no action to take" + echo "action=none" >> $GITHUB_ENV + ;; + esac + + org=$(echo "$GITHUB_REPOSITORY" | cut -d "/" -f 1) + thirdleveldomain=$(echo "$GITHUB_REPOSITORY" | cut -d "/" -f 2) + + if [ ! -z "$customurl" ]; then + pagesurl="$customurl" + elif [ "${org}.github.io" == "$thirdleveldomain" ]; then + pagesurl="${org}.github.io" + else + pagesurl=$(echo "$GITHUB_REPOSITORY" | sed 's/\//.github.io\//') + fi + + echo "pagesurl=$pagesurl" >> $GITHUB_ENV + + echo "preview_branch=gh-pages" >> $GITHUB_ENV + + pr=$(jq -r ".number" "$SOURCE_EVENT_PATH") + echo "pr=${pr}" >> $GITHUB_ENV + echo "targetdir=pr-preview/pr-${pr}" >> $GITHUB_ENV + + echo "emptydir=$(mktemp -d)" >> $GITHUB_ENV + echo "datetime=$(date '+%Y-%m-%d %H:%M %Z')" >> $GITHUB_ENV + + - name: Deploy preview directory + if: env.action == 'deploy' + uses: JamesIves/github-pages-deploy-action@v4.4.1 + with: + branch: ${{ env.preview_branch }} + folder: jekyll-docs + target-folder: ${{ env.targetdir }} + commit-message: Deploy preview for PR ${{ env.pr }} 🛫 + force: false + + - name: Leave a comment after deployment + if: env.action == 'deploy' && env.deployment_status == 'success' + uses: marocchino/sticky-pull-request-comment@v2 + with: + number: ${{ env.pr }} + header: pr-preview + message: "\ + :rocket: Deployed preview to + https://${{ env.pagesurl }}/${{ env.targetdir }}/ + + on branch [`${{ env.preview_branch }}`](\ + ${{ github.server_url }}/${{ github.repository }}\ + /tree/${{ env.preview_branch }}) + at ${{ env.datetime }} + " + + - name: Remove preview directory + if: env.action == 'remove' + uses: JamesIves/github-pages-deploy-action@v4.4.1 + with: + branch: ${{ env.preview_branch }} + folder: ${{ env.emptydir }} + target-folder: ${{ env.targetdir }} + commit-message: Remove preview for PR ${{ env.pr }} 🛬 + force: false + + - name: Leave a comment after removal + if: env.action == 'remove' && env.deployment_status == 'success' + uses: marocchino/sticky-pull-request-comment@v2 + with: + number: ${{ env.pr }} + header: pr-preview + message: "\ + Preview removed because the pull request was closed. + + ${{ env.datetime }} + " diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml new file mode 100644 index 000000000..24020e5ed --- /dev/null +++ b/.github/workflows/deploy-docs.yml @@ -0,0 +1,39 @@ +name: Deploy Docs +on: + workflow_call: + inputs: + extra-config: + required: false + type: string + target-folder: + require: false + type: string + +permissions: + contents: write + +jobs: + build-and-deploy: + concurrency: publish-gh-pages + runs-on: ubuntu-latest + steps: + - name: Checkout 🛎️ + uses: actions/checkout@v3 + + - name: Build Docs 🔧 + uses: ./.github/workflows/build-docs + with: + target-folder: ${{ inputs.target-folder }} + extra-config: ${{ inputs.extra-config }} + + - name: Deploy 🚀 + uses: JamesIves/github-pages-deploy-action@v4.4.1 + with: + branch: gh-pages + folder: build + force: false + target-folder: ${{ inputs.target-folder }} + clean-exclude: | + pr-preview/ + version/ + diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index fc861a03c..58cfe6cbf 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -14,6 +14,10 @@ on: - reopened # for delete - closed + paths-ignore: + - 'docs/**' + - '.github/workflows/publish-documentation*' + - '.github/workflows/deploy-docs*' permissions: diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 4a1c5bab3..4c49981ee 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -5,6 +5,10 @@ on: branches: - main pull_request: + paths-ignore: + - 'docs/**' + - '.github/workflows/publish-documentation*' + - '.github/workflows/deploy-docs*' jobs: generate-matrix: diff --git a/.github/workflows/publish-documentation-preview-notify.yml b/.github/workflows/publish-documentation-preview-notify.yml deleted file mode 100644 index 242cfc2eb..000000000 --- a/.github/workflows/publish-documentation-preview-notify.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: Deploy Docs Preview Requires Label -on: - pull_request_target: - types: - - opened - - reopened - - synchronize - paths: - - 'docs/**' - -permissions: - pull-requests: write -jobs: - notify-label-required: - if: ${{ !contains(github.event.pull_request.labels.*.name, 'preview-docs') }} - runs-on: ubuntu-latest - steps: - - name: Comment on label required for docs preview deploy - uses: marocchino/sticky-pull-request-comment@v2 - with: - recreate: true - header: notify-label-required - message: |- - Maintainers: This PR updates the documentation, please review and apply - the label 'preview-docs' if satisfied it is safe to publish. diff --git a/.github/workflows/publish-documentation-preview.yml b/.github/workflows/publish-documentation-preview.yml deleted file mode 100644 index 31ecc626e..000000000 --- a/.github/workflows/publish-documentation-preview.yml +++ /dev/null @@ -1,78 +0,0 @@ -name: Deploy Docs Preview -on: - pull_request_target: - types: - - closed - - labeled - paths: - - 'docs/**' - -permissions: - contents: write - pull-requests: write -jobs: - build-and-deploy: - if: ${{ github.event.action == 'closed' || (github.event.action == 'labeled' && github.event.label.name == 'preview-docs') }} - concurrency: publish-gh-pages - runs-on: ubuntu-latest - steps: - - name: Checkout 🛎️ - uses: actions/checkout@v3 - with: - ref: ${{ github.event.pull_request.head.sha }} - - name: Set up Ruby - if: ${{ github.event.action == 'labeled' }} - uses: ruby/setup-ruby@v1 - with: - ruby-version: 2.7 - bundler-cache: true - env: - BUNDLE_GEMFILE: ./docs/Gemfile - - name: Install and Build 🔧 - # don't allow a close to execute anything from the source code - if: ${{ github.event.action == 'labeled' }} - run: | - PR_NUMBER=$(jq -r ".number" "$GITHUB_EVENT_PATH") - REPO_NAME=$(jq -r ".repository.name" "$GITHUB_EVENT_PATH") - - # TODO find a way for jekyll to perform this automatically - convert docs/_assets/images/logo.png -define icon:auto-resize=256,64,48,32,16 docs/favicon.ico - - # avoid look up of API as it doesn't work from within actions without exposing the GITHUB_TOKEN here which is a security risk - cat <> docs/_config.yml - repository_nwo: vagrant-libvirt/vagrant-libvirt - plugin_script_base_path: /${REPO_NAME}/pr-preview/pr-${PR_NUMBER} - EOF - - bundle exec jekyll build --source docs/ --baseurl="/${REPO_NAME}/pr-preview/pr-${PR_NUMBER}" --destination build - - name: Set action - run: | - event_type=$(jq -r ".action" "$GITHUB_EVENT_PATH") - echo "event_type is $event_type" - - case $event_type in - "labeled") - echo "action set to deploy" - echo "action=deploy" >> "$GITHUB_ENV" - ;; - "closed") - echo "action set to remove" - echo "action=remove" >> "$GITHUB_ENV" - ;; - *) - echo "unknown event type $event_type; no action to take" - echo "action=none" >> "$GITHUB_ENV" - ;; - esac - - name: Deploy preview - uses: rossjrw/pr-preview-action@v1 - with: - action: ${{ env.action }} - source-dir: ./build/ - preview-branch: gh-pages - umbrella-dir: pr-preview - - name: Remove label - uses: actions-ecosystem/action-remove-labels@v1 - if: ${{ always() }} - with: - labels: preview-docs diff --git a/.github/workflows/publish-documentation-release.yml b/.github/workflows/publish-documentation-release.yml index 80ab4b660..4d65a21de 100644 --- a/.github/workflows/publish-documentation-release.yml +++ b/.github/workflows/publish-documentation-release.yml @@ -1,4 +1,4 @@ -name: Deploy Docs Release +name: Publish Docs Release on: push: tags: @@ -9,38 +9,9 @@ permissions: jobs: build-and-deploy: - concurrency: ci-${{ github.ref }} runs-on: ubuntu-latest steps: - - name: Checkout 🛎️ - uses: actions/checkout@v3 - - name: Set up Ruby - uses: ruby/setup-ruby@v1 + - name: Deploy docs + uses: ./.github/workflows/deploy-docs.yml with: - ruby-version: 2.7 - - name: Install and Build 🔧 - run: | - VERSION=${{ github.ref_name }} - REPO_NAME=$(jq -r ".repository.name" "$GITHUB_EVENT_PATH") - - # TODO find a way for jekyll to perform this automatically - convert docs/_assets/images/logo.png -define icon:auto-resize=256,64,48,32,16 docs/favicon.ico - - # avoid look up of API as it doesn't work from within actions without exposing the GITHUB_TOKEN here which is a security risk - cat <> docs/_config.yml - repository_nwo: vagrant-libvirt/vagrant-libvirt - EOF - - BUNDLE_GEMFILE=./docs/Gemfile bundle install - BUNDLE_GEMFILE=./docs/Gemfile bundle exec jekyll build --source docs/ --baseurl="/${REPO_NAME}/version/${VERSION}" --destination build - - name: Deploy 🚀 - uses: JamesIves/github-pages-deploy-action@v4.4.2 - with: - branch: gh-pages - folder: build - clean: true - force: false target-folder: version/${{ github.ref_name }} - clean-exclude: | - pr-preview/ - version/ diff --git a/.github/workflows/publish-documentation.yml b/.github/workflows/publish-documentation.yml index 22f5420dc..c21d697ad 100644 --- a/.github/workflows/publish-documentation.yml +++ b/.github/workflows/publish-documentation.yml @@ -1,43 +1,18 @@ -name: Deploy Docs +name: Publish Docs on: push: branches: - main paths: - 'docs/**' + - .github/workflows/publish-documentation.yml permissions: contents: write jobs: build-and-deploy: - concurrency: ci-${{ github.ref }} runs-on: ubuntu-latest steps: - - name: Checkout 🛎️ - uses: actions/checkout@v3 - - name: Set up Ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: 2.7 - - name: Install and Build 🔧 - run: | - # TODO find a way for jekyll to perform this automatically - convert docs/_assets/images/logo.png -define icon:auto-resize=256,64,48,32,16 docs/favicon.ico - - # avoid look up of API as it doesn't work from within actions without exposing the GITHUB_TOKEN here which is a security risk - cat <> docs/_config.yml - repository_nwo: vagrant-libvirt/vagrant-libvirt - EOF - - BUNDLE_GEMFILE=./docs/Gemfile bundle install - BUNDLE_GEMFILE=./docs/Gemfile bundle exec jekyll build --source docs/ --destination build - - name: Deploy 🚀 - uses: JamesIves/github-pages-deploy-action@v4.4.2 - with: - branch: gh-pages - folder: build - clean: true - clean-exclude: | - pr-preview/ - version/ + - name: Deploy docs + uses: ./.github/workflows/deploy-docs.yml diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 6e4892826..8f4e96795 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -118,6 +118,7 @@ jobs: }} - name: Coveralls Finished uses: coverallsapp/github-action@master + if: contains(needs.*.result, 'skipped') == false with: github-token: ${{ secrets.github_token }} parallel-finished: true From 2cb600388b95bf5a4ddf19fd9fc835ff5634fac8 Mon Sep 17 00:00:00 2001 From: Darragh Bailey Date: Tue, 29 Aug 2023 16:03:48 +0100 Subject: [PATCH 6/7] Ensure extra docs config is appended (#1767) Use of tee requires the argument '-a' to append, as current behaviour will result in replacing the contents which is not intended. The config settings should be in addition to the configured values. --- .github/workflows/build-docs/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-docs/action.yml b/.github/workflows/build-docs/action.yml index 3be1d1817..c0bdf0113 100644 --- a/.github/workflows/build-docs/action.yml +++ b/.github/workflows/build-docs/action.yml @@ -42,7 +42,7 @@ runs: EOF echo "Adding additional config settings:" - cat ${TEMP_CONFIG} | tee docs/_config.yml + cat ${TEMP_CONFIG} | tee -a docs/_config.yml - name: Install and Build shell: bash From f5e22f8547e3bfc822f71a36de65fb88a77ecfe6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 29 Aug 2023 15:19:57 +0000 Subject: [PATCH 7/7] Bump commonmarker from 0.23.9 to 0.23.10 in /docs (#1758) --- docs/Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Gemfile.lock b/docs/Gemfile.lock index eed2b5e40..fd7ac36da 100644 --- a/docs/Gemfile.lock +++ b/docs/Gemfile.lock @@ -13,7 +13,7 @@ GEM execjs coffee-script-source (1.11.1) colorator (1.1.0) - commonmarker (0.23.9) + commonmarker (0.23.10) concurrent-ruby (1.2.0) dnsruby (1.61.9) simpleidn (~> 0.1)