diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0da43e40..dc87bf40 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -31,3 +31,10 @@ jobs: with: plugin: foreman_theme_satellite foreman_version: ${{ matrix.foreman }} + + toc-check: + name: Check TOC + uses: ./.github/workflows/toc-check.yml + with: + plugin_repository: '' + plugin_version: '' diff --git a/.github/workflows/toc-check.yml b/.github/workflows/toc-check.yml new file mode 100644 index 00000000..6ece7bee --- /dev/null +++ b/.github/workflows/toc-check.yml @@ -0,0 +1,77 @@ +--- +name: Check TOC + +on: + workflow_call: + inputs: + plugin: + type: string + default: 'foreman_theme_satellite' + plugin_repository: + type: string + default: 'RedHatSatellite/foreman_theme_satellite' + plugin_version: + type: string + default: 'develop' + foreman_repository: + default: theforeman/foreman + type: string + foreman_version: + default: develop + type: string + documentation_toc_artifact: + description: >- + Caller artifact with toc.json and aliases.json (any layout under the artifact root). + When empty, skip download and /tmp/toc.json is not created here. + default: "" + type: string + +env: + BUNDLE_WITHOUT: "console:development:journald:libvirt" + +jobs: + verify-toc: + runs-on: ubuntu-latest + steps: + - name: Download documentation TOC + if: ${{ inputs.documentation_toc_artifact != '' }} + uses: actions/download-artifact@v8 + with: + name: ${{ inputs.documentation_toc_artifact }} + path: /tmp/documentation-toc-artifact + + - name: Check out Foreman + uses: actions/checkout@v6 + with: + repository: ${{ inputs.foreman_repository }} + ref: ${{ inputs.foreman_version }} + path: foreman + + - name: Check out plugin + uses: actions/checkout@v6 + with: + repository: ${{ inputs.plugin_repository }} + ref: ${{ inputs.plugin_version }} + path: ${{ inputs.plugin }} + + - name: Set up dependencies + run: | + echo 'gemspec name: "${{ inputs.plugin }}", path: "../${{ inputs.plugin }}"' >> foreman/bundler.d/foreman_theme_satellite.local.rb + + - name: Setup Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: '3.1' + bundler-cache: true + working-directory: foreman + + - name: Deploy TOC files + if: ${{ inputs.documentation_toc_artifact != '' }} + run: | + [ -f /tmp/documentation-toc-artifact/toc.json ] && cp /tmp/documentation-toc-artifact/toc.json ${{ inputs.plugin }}/test/fixtures/toc.json + [ -f /tmp/documentation-toc-artifact/aliases.json ] && cp /tmp/documentation-toc-artifact/aliases.json ${{ inputs.plugin }}/test/fixtures/aliases.json + + - name: Check TOC + working-directory: foreman + run: | + bundle exec rake foreman_theme_satellite:validate_docs diff --git a/lib/tasks/foreman_theme_satellite_tasks.rake b/lib/tasks/foreman_theme_satellite_tasks.rake index a5e484c7..cbd220bb 100644 --- a/lib/tasks/foreman_theme_satellite_tasks.rake +++ b/lib/tasks/foreman_theme_satellite_tasks.rake @@ -48,4 +48,3 @@ namespace :foreman_theme_satellite do end Rake::Task[:test].enhance ['test:foreman_theme_satellite'] -Rake::Task['test:foreman_theme_satellite'].enhance ['foreman_theme_satellite:validate_docs']