Skip to content

fix issue

fix issue #139

name: Test mkdocs-deploy
on:
push:
permissions:
contents: write
pages: write
jobs:
test-pull-request-trigger:
name: Test Pull Request Trigger
runs-on: ubuntu-latest
strategy:
matrix:
package-manager: [pip, uv, pixi]
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup fake git remote for testing
uses: ./.github/workflows/test-helpers/setup-fake-remote
- name: Copy test fixture files (pip/uv)
if: matrix.package-manager != 'pixi'
run: |
cp tests/data/mkdocs-deploy/test-pull-request-pip-uv/pyproject.toml .
cp tests/data/mkdocs-deploy/test-pull-request-pip-uv/uv.lock .
cp tests/data/mkdocs-deploy/test-pull-request-pip-uv/mkdocs.yml .
cp -r tests/data/mkdocs-deploy/test-pull-request-pip-uv/docs .
- name: Copy test fixture files (pixi)
if: matrix.package-manager == 'pixi'
run: |
cp tests/data/mkdocs-deploy/test-pull-request-pixi/pyproject.toml .
cp tests/data/mkdocs-deploy/test-pull-request-pixi/pixi.lock .
cp tests/data/mkdocs-deploy/test-pull-request-pixi/mkdocs.yml .
cp -r tests/data/mkdocs-deploy/test-pull-request-pixi/docs .
# Generate pixi.lock if not present (for testing)
if [ ! -f tests/data/mkdocs-deploy/test-pull-request-pixi/pixi.lock ]; then
echo "Warning: pixi.lock not found, will be generated by pixi during setup"
else
cp tests/data/mkdocs-deploy/test-pull-request-pixi/pixi.lock .
fi
- name: Set install-groups for package manager
id: set-groups
run: |
if [ "${{ matrix.package-manager }}" = "pixi" ]; then
echo "groups=docs" >> $GITHUB_OUTPUT
else
echo "groups=groups: docs" >> $GITHUB_OUTPUT
fi
- name: Test MkDocs deploy for PR
uses: ./actions/mkdocs-deploy
with:
trigger: 'pull_request'
package-manager: ${{ matrix.package-manager }}
install-groups: ${{ steps.set-groups.outputs.groups }}
deploy-token: ${{ secrets.GITHUB_TOKEN }}
- name: Verify deployment command was attempted
run: |
echo "Deployment test completed for ${{ matrix.package-manager }}"
test-main-trigger:
name: Test Main Branch Trigger
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup fake git remote for testing
uses: ./.github/workflows/test-helpers/setup-fake-remote
- name: Copy test fixture files
run: |
cp tests/data/mkdocs-deploy/test-main-trigger/pyproject.toml .
cp tests/data/mkdocs-deploy/test-main-trigger/uv.lock .
cp tests/data/mkdocs-deploy/test-main-trigger/mkdocs.yml .
cp -r tests/data/mkdocs-deploy/test-main-trigger/docs .
- name: Test MkDocs deploy for main
uses: ./actions/mkdocs-deploy
with:
trigger: 'main'
package-manager: 'uv'
deploy-token: ${{ secrets.GITHUB_TOKEN }}
test-release-trigger:
name: Test Release Trigger
runs-on: ubuntu-latest
strategy:
matrix:
include:
- package-manager: uv
release-tag: "v1.0.0"
mike-alias: "latest"
- package-manager: pip
release-tag: "v2.0.0"
mike-alias: "stable"
- package-manager: pixi
release-tag: "v3.0.0"
mike-alias: "current"
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup fake git remote for testing
uses: ./.github/workflows/test-helpers/setup-fake-remote
- name: Copy test fixture files (pip/uv)
if: matrix.package-manager != 'pixi'
run: |
cp tests/data/mkdocs-deploy/test-release-trigger-pip-uv/pyproject.toml .
cp tests/data/mkdocs-deploy/test-release-trigger-pip-uv/mkdocs.yml .
cp tests/data/mkdocs-deploy/test-release-trigger-pip-uv/uv.lock .
cp -r tests/data/mkdocs-deploy/test-release-trigger-pip-uv/docs .
- name: Copy test fixture files (pixi)
if: matrix.package-manager == 'pixi'
run: |
cp tests/data/mkdocs-deploy/test-release-trigger-pixi/pyproject.toml .
cp tests/data/mkdocs-deploy/test-release-trigger-pixi/mkdocs.yml .
cp -r tests/data/mkdocs-deploy/test-release-trigger-pixi/docs .
# Generate pixi.lock if not present (for testing)
if [ ! -f tests/data/mkdocs-deploy/test-release-trigger-pixi/pixi.lock ]; then
echo "Warning: pixi.lock not found, will be generated by pixi during setup"
else
cp tests/data/mkdocs-deploy/test-release-trigger-pixi/pixi.lock .
fi
- name: Set install-groups for package manager
id: set-groups
run: |
if [ "${{ matrix.package-manager }}" = "pixi" ]; then
echo "groups=docs" >> $GITHUB_OUTPUT
else
echo "groups=groups: docs" >> $GITHUB_OUTPUT
fi
- name: Test MkDocs deploy for release
uses: ./actions/mkdocs-deploy
with:
trigger: 'release'
package-manager: ${{ matrix.package-manager }}
install-groups: ${{ steps.set-groups.outputs.groups }}
release-tag: ${{ matrix.release-tag }}
mike-alias: ${{ matrix.mike-alias }}
deploy-token: ${{ secrets.GITHUB_TOKEN }}
test-custom-configuration:
name: Test Custom Configuration
runs-on: ubuntu-latest
strategy:
matrix:
include:
# Test different install-groups formats with uv
- python-version: "3.11"
install-groups: "groups: docs"
package-manager: "uv"
- python-version: "3.12"
install-groups: "groups: docs dev"
package-manager: "uv"
- python-version: "3.12"
install-groups: "extras: docs"
package-manager: "uv"
# Test pip with different formats
- python-version: "3.11"
install-groups: "groups: docs"
package-manager: "pip"
- python-version: "3.12"
install-groups: "extras: docs"
package-manager: "pip"
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup fake git remote for testing
uses: ./.github/workflows/test-helpers/setup-fake-remote
- name: Copy test fixture files
run: |
cp tests/data/mkdocs-deploy/test-custom-configuration/pyproject.toml .
cp tests/data/mkdocs-deploy/test-custom-configuration/mkdocs.yml .
cp tests/data/mkdocs-deploy/test-custom-configuration/uv.lock .
cp -r tests/data/mkdocs-deploy/test-custom-configuration/docs .
- name: Test with custom configuration
uses: ./actions/mkdocs-deploy
with:
trigger: 'pull_request'
package-manager: ${{ matrix.package-manager }}
python-version: ${{ matrix.python-version }}
install-groups: ${{ matrix.install-groups }}
deploy-token: ${{ secrets.GITHUB_TOKEN }}
test-error-scenarios:
name: Test Error Scenarios
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Test without MkDocs configuration
id: no-mkdocs-test
continue-on-error: true
uses: ./actions/mkdocs-deploy
with:
trigger: 'pull_request'
package-manager: 'uv'
deploy-token: ${{ secrets.GITHUB_TOKEN }}
- name: Verify deployment fails without mkdocs.yml
if: steps.no-mkdocs-test.outcome != 'failure'
run: |
echo "ERROR: Deployment should fail without mkdocs.yml"
exit 1
- name: Copy test fixture files for missing docs dependencies test
run: |
cp tests/data/mkdocs-deploy/test-error-no-docs-deps/pyproject.toml .
cp tests/data/mkdocs-deploy/test-error-no-docs-deps/mkdocs.yml .
cp -r tests/data/mkdocs-deploy/test-error-no-docs-deps/docs .
- name: Test with missing docs dependencies
id: no-deps-test
continue-on-error: true
uses: ./actions/mkdocs-deploy
with:
trigger: 'main'
package-manager: 'uv'
install-groups: 'dev' # Wrong group, no mkdocs
deploy-token: ${{ secrets.GITHUB_TOKEN }}
- name: Verify deployment fails without mkdocs installed
if: steps.no-deps-test.outcome != 'failure'
run: |
echo "ERROR: Deployment should fail without mkdocs dependencies"
exit 1
- name: Test invalid trigger
id: invalid-trigger-test
continue-on-error: true
uses: ./actions/mkdocs-deploy
with:
trigger: 'invalid'
package-manager: 'uv'
deploy-token: ${{ secrets.GITHUB_TOKEN }}
- name: Verify invalid trigger handling
run: |
echo "Invalid trigger test completed"
test-git-configuration:
name: Test Git Configuration
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup fake git remote for testing
uses: ./.github/workflows/test-helpers/setup-fake-remote
- name: Copy test fixture files
run: |
cp tests/data/mkdocs-deploy/test-git-configuration/pyproject.toml .
cp tests/data/mkdocs-deploy/test-git-configuration/mkdocs.yml .
cp -r tests/data/mkdocs-deploy/test-git-configuration/docs .
- name: Clear git config to test action sets it
run: |
git config --global --unset user.name || true
git config --global --unset user.email || true
- name: Test git configuration
uses: ./actions/mkdocs-deploy
with:
trigger: 'pull_request'
package-manager: 'pip'
deploy-token: ${{ secrets.GITHUB_TOKEN }}
- name: Verify git was configured
run: |
git config --global user.name
git config --global user.email
test-package-manager-commands:
name: Test Package Manager Command Execution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup fake git remote for testing
uses: ./.github/workflows/test-helpers/setup-fake-remote
- name: Copy test fixture files
run: |
cp tests/data/mkdocs-deploy/test-package-manager-commands/pyproject.toml .
cp tests/data/mkdocs-deploy/test-package-manager-commands/mkdocs.yml .
cp -r tests/data/mkdocs-deploy/test-package-manager-commands/docs .
# Copy uv.lock if it exists
if [ -f tests/data/mkdocs-deploy/test-package-manager-commands/uv.lock ]; then
cp tests/data/mkdocs-deploy/test-package-manager-commands/uv.lock .
fi
# Copy pixi.lock if it exists
if [ -f tests/data/mkdocs-deploy/test-package-manager-commands/pixi.lock ]; then
cp tests/data/mkdocs-deploy/test-package-manager-commands/pixi.lock .
fi
- name: Test pip command execution
uses: ./actions/mkdocs-deploy
with:
trigger: 'pull_request'
package-manager: 'pip'
deploy-token: ${{ secrets.GITHUB_TOKEN }}
- name: Test uv command execution
uses: ./actions/mkdocs-deploy
with:
trigger: 'main'
package-manager: 'uv'
deploy-token: ${{ secrets.GITHUB_TOKEN }}
- name: Test pixi command execution
uses: ./actions/mkdocs-deploy
with:
trigger: 'release'
package-manager: 'pixi'
install-groups: 'docs'
release-tag: 'v1.0.0'
deploy-token: ${{ secrets.GITHUB_TOKEN }}
test-release-tag-resolution:
name: Test Release Tag Resolution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup fake git remote for testing
uses: ./.github/workflows/test-helpers/setup-fake-remote
- name: Copy test fixture files
run: |
cp tests/data/mkdocs-deploy/test-release-tag-resolution/pyproject.toml .
cp tests/data/mkdocs-deploy/test-release-tag-resolution/mkdocs.yml .
cp tests/data/mkdocs-deploy/test-release-tag-resolution/uv.lock .
cp -r tests/data/mkdocs-deploy/test-release-tag-resolution/docs .
- name: Test with explicit release tag
uses: ./actions/mkdocs-deploy
with:
trigger: 'release'
package-manager: 'uv'
release-tag: 'v4.5.6'
deploy-token: ${{ secrets.GITHUB_TOKEN }}
- name: Test without explicit release tag (simulated)
env:
GITHUB_EVENT_NAME: release
uses: ./actions/mkdocs-deploy
with:
trigger: 'release'
package-manager: 'uv'
deploy-token: ${{ secrets.GITHUB_TOKEN }}
test-default-install-groups:
name: Test Default install-groups Value
runs-on: ubuntu-latest
strategy:
matrix:
package-manager: [pip, uv, pixi]
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup fake git remote for testing
uses: ./.github/workflows/test-helpers/setup-fake-remote
- name: Copy test fixture files (pip/uv)
if: matrix.package-manager != 'pixi'
run: |
cp tests/data/mkdocs-deploy/test-pull-request-pip-uv/pyproject.toml .
cp tests/data/mkdocs-deploy/test-pull-request-pip-uv/mkdocs.yml .
cp tests/data/mkdocs-deploy/test-pull-request-pip-uv/uv.lock .
cp -r tests/data/mkdocs-deploy/test-pull-request-pip-uv/docs .
- name: Copy test fixture files (pixi)
if: matrix.package-manager == 'pixi'
run: |
cp tests/data/mkdocs-deploy/test-pull-request-pixi/pyproject.toml .
cp tests/data/mkdocs-deploy/test-pull-request-pixi/mkdocs.yml .
cp -r tests/data/mkdocs-deploy/test-pull-request-pixi/docs .
if [ -f tests/data/mkdocs-deploy/test-pull-request-pixi/pixi.lock ]; then
cp tests/data/mkdocs-deploy/test-pull-request-pixi/pixi.lock .
fi
- name: Set install-groups for package manager
id: set-groups
run: |
if [ "${{ matrix.package-manager }}" = "pixi" ]; then
echo "groups=docs" >> $GITHUB_OUTPUT
else
echo "groups=groups: docs" >> $GITHUB_OUTPUT
fi
- name: Test with default install-groups (groups docs)
uses: ./actions/mkdocs-deploy
with:
trigger: 'pull_request'
package-manager: ${{ matrix.package-manager }}
install-groups: ${{ steps.set-groups.outputs.groups }}
deploy-token: ${{ secrets.GITHUB_TOKEN }}
- name: Verify default behavior
run: |
echo "Default install-groups test completed for ${{ matrix.package-manager }}"
test-pixi-environment-parsing:
name: Test Pixi Environment Names
runs-on: ubuntu-latest
strategy:
matrix:
install-groups:
- "docs" # Direct environment name
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup fake git remote for testing
uses: ./.github/workflows/test-helpers/setup-fake-remote
- name: Copy test fixture files
run: |
cp tests/data/mkdocs-deploy/test-pull-request-pixi/pyproject.toml .
cp tests/data/mkdocs-deploy/test-pull-request-pixi/mkdocs.yml .
cp -r tests/data/mkdocs-deploy/test-pull-request-pixi/docs .
if [ -f tests/data/mkdocs-deploy/test-pull-request-pixi/pixi.lock ]; then
cp tests/data/mkdocs-deploy/test-pull-request-pixi/pixi.lock .
fi
- name: Test pixi with environment "${{ matrix.install-groups }}"
uses: ./actions/mkdocs-deploy
with:
trigger: 'pull_request'
package-manager: 'pixi'
install-groups: ${{ matrix.install-groups }}
deploy-token: ${{ secrets.GITHUB_TOKEN }}
- name: Verify environment succeeded
run: |
echo "Pixi environment test completed for: ${{ matrix.install-groups }}"
test-python-version-matrix:
name: Test Python Version Compatibility
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ "3.11", "3.12", "3.13"]
package-manager: [pip, uv]
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup fake git remote for testing
uses: ./.github/workflows/test-helpers/setup-fake-remote
- name: Copy test fixture files
run: |
cp tests/data/mkdocs-deploy/test-custom-configuration/pyproject.toml .
cp tests/data/mkdocs-deploy/test-custom-configuration/mkdocs.yml .
cp tests/data/mkdocs-deploy/test-custom-configuration/uv.lock .
cp -r tests/data/mkdocs-deploy/test-custom-configuration/docs .
- name: Test install-groups format "${{ matrix.install-groups }}"
uses: ./actions/mkdocs-deploy
with:
trigger: 'pull_request'
package-manager: ${{ matrix.package-manager }}
python-version: ${{ matrix.python-version }}
deploy-token: ${{ secrets.GITHUB_TOKEN }}
- name: Verify Python version
run: |
python --version
echo "Python ${{ matrix.python-version }} test completed for ${{ matrix.package-manager }}"
test-install-groups-variations:
name: Test install-groups Format Variations
runs-on: ubuntu-latest
strategy:
matrix:
include:
# Test groups prefix
- install-groups: "groups: docs"
package-manager: "uv"
- install-groups: "groups: docs dev"
package-manager: "uv"
- install-groups: "groups: docs test"
package-manager: "pip"
# Test extras prefix
- install-groups: "extras: docs"
package-manager: "uv"
- install-groups: "extras: docs"
package-manager: "pip"
# Test mixed
- install-groups: "groups: docs, extras: aws"
package-manager: "uv"
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup fake git remote for testing
uses: ./.github/workflows/test-helpers/setup-fake-remote
- name: Copy test fixture files
run: |
cp tests/data/mkdocs-deploy/test-custom-configuration/pyproject.toml .
cp tests/data/mkdocs-deploy/test-custom-configuration/mkdocs.yml .
cp tests/data/mkdocs-deploy/test-custom-configuration/uv.lock .
cp -r tests/data/mkdocs-deploy/test-custom-configuration/docs .
- name: Test install-groups format "${{ matrix.install-groups }}"
uses: ./actions/mkdocs-deploy
with:
trigger: 'pull_request'
package-manager: ${{ matrix.package-manager }}
install-groups: ${{ matrix.install-groups }}
deploy-token: ${{ secrets.GITHUB_TOKEN }}
- name: Verify format parsing
run: |
echo "install-groups format test completed: ${{ matrix.install-groups }}"