Test MkDocs Workflow #150
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Test MkDocs Workflow | |
| on: | |
| schedule: | |
| - cron: '0 0 * * *' # Run daily at midnight | |
| workflow_dispatch: | |
| pull_request: | |
| branches: [ v1-master ] | |
| paths: | |
| - 'action.yml' | |
| - '.github/workflows/test-mkdocs-workflow.yml' | |
| jobs: | |
| test-default-parameters: | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, windows-latest, macos-latest] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout Action Repository | |
| uses: actions/checkout@v6 | |
| - name: Checkout Test Repository | |
| uses: actions/checkout@v6 | |
| with: | |
| repository: Reloaded-Project/Reloaded.MkDocsMaterial.Themes.R2 | |
| submodules: 'recursive' | |
| path: test-project | |
| - name: Test Default Parameters | |
| uses: ./ | |
| with: | |
| config-file: test-project/mkdocs.yml | |
| requirements: test-project/docs/requirements.txt | |
| checkout-current-repo: false | |
| publish-to-pages: false | |
| test-custom-mkdocs-version: | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, windows-latest, macos-latest] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout Action Repository | |
| uses: actions/checkout@v6 | |
| - name: Checkout Test Repository | |
| uses: actions/checkout@v6 | |
| with: | |
| repository: Reloaded-Project/Reloaded.MkDocsMaterial.Themes.R2 | |
| submodules: 'recursive' | |
| path: test-project | |
| - name: Test Custom MkDocs Version | |
| uses: ./ | |
| with: | |
| config-file: test-project/mkdocs.yml | |
| requirements: test-project/docs/requirements.txt | |
| mkdocs-version: '9.5.24' | |
| checkout-current-repo: false | |
| publish-to-pages: false | |
| test-custom-pre-build-command-bash: | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, windows-latest, macos-latest] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout Action Repository | |
| uses: actions/checkout@v6 | |
| - name: Checkout Test Repository | |
| uses: actions/checkout@v6 | |
| with: | |
| repository: Reloaded-Project/Reloaded.MkDocsMaterial.Themes.R2 | |
| submodules: 'recursive' | |
| path: test-project | |
| - name: Test Custom Pre-build Command (Bash) | |
| uses: ./ | |
| with: | |
| config-file: test-project/mkdocs.yml | |
| requirements: test-project/docs/requirements.txt | |
| pre-build-command: touch pre-build-bash-executed.txt | |
| pre-build-command-shell: bash | |
| checkout-current-repo: false | |
| publish-to-pages: false | |
| - name: Assert Pre-build Command Execution (Bash) | |
| shell: bash | |
| run: | | |
| if [ ! -f pre-build-bash-executed.txt ]; then | |
| echo "Pre-build command (Bash) did not execute successfully" | |
| exit 1 | |
| fi | |
| test-custom-pre-build-command-pwsh: | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, windows-latest, macos-latest] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout Action Repository | |
| uses: actions/checkout@v6 | |
| - name: Checkout Test Repository | |
| uses: actions/checkout@v6 | |
| with: | |
| repository: Reloaded-Project/Reloaded.MkDocsMaterial.Themes.R2 | |
| submodules: 'recursive' | |
| path: test-project | |
| - name: Test Custom Pre-build Command (PowerShell) | |
| uses: ./ | |
| with: | |
| config-file: test-project/mkdocs.yml | |
| requirements: test-project/docs/requirements.txt | |
| pre-build-command: New-Item -ItemType File -Path pre-build-pwsh-executed.txt | |
| pre-build-command-shell: pwsh | |
| checkout-current-repo: false | |
| publish-to-pages: false | |
| - name: Assert Pre-build Command Execution (PowerShell) | |
| shell: pwsh | |
| run: | | |
| if (-not (Test-Path -Path pre-build-pwsh-executed.txt)) { | |
| Write-Error "Pre-build command (PowerShell) did not execute successfully" | |
| exit 1 | |
| } | |
| test-custom-output-directory: | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, windows-latest, macos-latest] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout Action Repository | |
| uses: actions/checkout@v6 | |
| - name: Checkout Test Repository | |
| uses: actions/checkout@v6 | |
| with: | |
| repository: Reloaded-Project/Reloaded.MkDocsMaterial.Themes.R2 | |
| submodules: 'recursive' | |
| path: test-project | |
| - name: Test Custom Output Directory | |
| uses: ./ | |
| with: | |
| config-file: test-project/mkdocs.yml | |
| requirements: test-project/docs/requirements.txt | |
| output-directory: custom_site_dir | |
| checkout-current-repo: false | |
| publish-to-pages: false | |
| - name: Assert Custom Output Directory | |
| shell: bash | |
| run: | | |
| if [ ! -d custom_site_dir ] || [ -z "$(ls -A custom_site_dir)" ]; then | |
| echo "Custom output directory does not exist or is empty" | |
| exit 1 | |
| fi | |
| test-custom-requirements-path: | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, windows-latest, macos-latest] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout Action Repository | |
| uses: actions/checkout@v6 | |
| - name: Checkout Test Repository | |
| uses: actions/checkout@v6 | |
| with: | |
| repository: Reloaded-Project/Reloaded.MkDocsMaterial.Themes.R2 | |
| submodules: 'recursive' | |
| path: test-project | |
| - name: Copy Custom Requirements File | |
| shell: bash | |
| run: cp test-project/docs/requirements.txt test-project/docs/custom-requirements.txt | |
| - name: Test Custom Requirements Path | |
| uses: ./ | |
| with: | |
| config-file: test-project/mkdocs.yml | |
| requirements: test-project/docs/custom-requirements.txt | |
| checkout-current-repo: false | |
| publish-to-pages: false | |
| test-custom-config-file: | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, windows-latest, macos-latest] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout Action Repository | |
| uses: actions/checkout@v6 | |
| - name: Checkout Test Repository | |
| uses: actions/checkout@v6 | |
| with: | |
| repository: Reloaded-Project/Reloaded.MkDocsMaterial.Themes.R2 | |
| submodules: 'recursive' | |
| path: test-project | |
| - name: Copy Custom Config File | |
| shell: bash | |
| run: cp test-project/mkdocs.yml test-project/custom-mkdocs.yml | |
| - name: Test Custom Config File | |
| uses: ./ | |
| with: | |
| config-file: test-project/custom-mkdocs.yml | |
| requirements: test-project/docs/requirements.txt | |
| checkout-current-repo: false | |
| publish-to-pages: false | |
| test-publish-to-pages: | |
| # This can only be ran on a single OS, due to artifact name conflict. | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| steps: | |
| - name: Checkout Action Repository | |
| uses: actions/checkout@v6 | |
| - name: Checkout Test Repository | |
| uses: actions/checkout@v6 | |
| with: | |
| repository: Reloaded-Project/Reloaded.MkDocsMaterial.Themes.R2 | |
| submodules: 'recursive' | |
| path: test-project | |
| - name: Test Publish to Pages | |
| uses: ./ | |
| with: | |
| config-file: test-project/mkdocs.yml | |
| requirements: test-project/docs/requirements.txt | |
| publish-to-pages: true | |
| checkout-current-repo: false |