-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
[Dev docs] Clean up workflows and mike usage #3383
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
C-Achard
wants to merge
9
commits into
arash/dev_docs
Choose a base branch
from
cy/dev-docs-tweaks
base: arash/dev_docs
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+233
−154
Draft
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
6e0fca2
Link developer docs to external site
C-Achard 26b19a1
Refactor docs workflows with reusable Mike deploy
C-Achard 7026e8d
Prefix code workflow names in GitHub Actions
C-Achard f3c3f6b
Add composite action for dev-docs setup
C-Achard c3d95b0
Move workflow to correct location
C-Achard 3a78853
Fix typo
C-Achard 9bf5c23
Move workflow
C-Achard f99391c
Use git tag for version validation
C-Achard 08de589
Default to dev URL
C-Achard File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| name: Setup dev-docs environment | ||
| description: Install Python, system deps, and DeepLabCut dev-docs dependencies. | ||
|
|
||
| inputs: | ||
| python-version: | ||
| description: Python version to use. | ||
| required: false | ||
| default: "3.10" | ||
|
|
||
| install-system-deps: | ||
| description: Install system dependencies required by mkdocs-material social plugin. | ||
| required: false | ||
| default: "true" | ||
|
|
||
| runs: | ||
| using: composite | ||
| steps: | ||
| - name: Set up Python | ||
| uses: actions/setup-python@v6 | ||
| with: | ||
| python-version: ${{ inputs.python-version }} | ||
|
|
||
| - name: Install system dependencies for mkdocs-material social plugin | ||
| if: ${{ inputs.install-system-deps == 'true' }} | ||
| shell: bash | ||
| run: | | ||
| sudo apt-get update -qq | ||
| sudo apt-get install -y libcairo2-dev libfreetype6-dev libffi-dev \ | ||
| libjpeg-dev libpng-dev libz-dev | ||
|
|
||
| - name: Install dev-docs dependencies | ||
| shell: bash | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| python -m pip install ".[dev-docs]" |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,37 +1,33 @@ | ||
| name: Build dev-docs (mkdocs) | ||
| name: Docs / Build dev-docs | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| python-version: | ||
| description: "Python version used to build the dev docs." | ||
| description: Python version used to build the dev docs. | ||
| required: false | ||
| default: "3.10" | ||
| type: string | ||
|
|
||
| config-file: | ||
| description: MkDocs config file. | ||
| required: false | ||
| default: "dev-docs/mkdocs.yml" | ||
| type: string | ||
|
|
||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v6 | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v6 | ||
| - name: Set up dev-docs environment | ||
| uses: ./.github/actions/setup-dev-docs | ||
| with: | ||
| python-version: ${{ inputs.python-version }} | ||
|
C-Achard marked this conversation as resolved.
|
||
|
|
||
| - name: Install system dependencies for mkdocs-material social plugin | ||
| run: | | ||
| sudo apt-get update -qq | ||
| sudo apt-get install -y libcairo2-dev libfreetype6-dev libffi-dev \ | ||
| libjpeg-dev libpng-dev libz-dev | ||
|
|
||
| - name: Install dev-docs dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| python -m pip install ".[dev-docs]" | ||
|
|
||
| - name: Build dev docs | ||
| run: mkdocs build -v -f dev-docs/mkdocs.yml | ||
| - name: Build dev-docs | ||
| run: mkdocs build -v -f ${{ inputs.config-file }} | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| name: Build main docs (Jupyter Book) | ||
| name: Docs / Build main docs (Jupyter Book) | ||
|
|
||
| on: | ||
| workflow_call: | ||
|
|
||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| --- | ||
| name: Codespell | ||
| name: Code / Codespell | ||
|
|
||
| on: | ||
| push: | ||
|
|
||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,128 @@ | ||
| name: Docs / Deploy dev-docs with Mike | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| action: | ||
| description: "Mike action to perform: deploy or delete." | ||
| required: true | ||
| type: string | ||
|
|
||
| version_label: | ||
| description: "Version label to deploy/delete, e.g. main or 3.0." | ||
| required: true | ||
| type: string | ||
|
|
||
| aliases: | ||
| description: "Space-separated aliases to assign on deploy, e.g. latest." | ||
| required: false | ||
| default: "" | ||
| type: string | ||
|
|
||
| default_label: | ||
| description: "If non-empty, run mike set-default with this label after deploy." | ||
| required: false | ||
| default: "" | ||
| type: string | ||
|
|
||
| git_tag: | ||
| description: "Optional git tag whose deeplabcut package should be checked out before deploying." | ||
| required: false | ||
| default: "" | ||
| type: string | ||
|
|
||
| python-version: | ||
| description: Python version used for dev docs. | ||
| required: false | ||
| default: "3.10" | ||
| type: string | ||
|
|
||
| config-file: | ||
| description: MkDocs config file. | ||
| required: false | ||
| default: "dev-docs/mkdocs.yml" | ||
| type: string | ||
|
|
||
| deploy-prefix: | ||
| description: Mike deploy prefix. | ||
| required: false | ||
| default: "dev" | ||
| type: string | ||
|
|
||
| jobs: | ||
| mike: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
|
|
||
| steps: | ||
| - name: Validate inputs | ||
| shell: bash | ||
| run: | | ||
| case "${{ inputs.action }}" in | ||
| deploy|delete) | ||
| ;; | ||
| *) | ||
| echo "::error::Unsupported action '${{ inputs.action }}'. Expected 'deploy' or 'delete'." | ||
| exit 1 | ||
| ;; | ||
| esac | ||
|
Copilot marked this conversation as resolved.
|
||
|
|
||
| if [ "${{ inputs.action }}" = "deploy" ] && [ -z "${{ inputs.git_tag }}" ] && [ "${{ inputs.version_label }}" != "main" ]; then | ||
| echo "::error::git_tag is required when deploying non-'main' versions." | ||
| exit 1 | ||
| fi | ||
|
|
||
| - uses: actions/checkout@v6 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Check out tagged package source | ||
| if: inputs.git_tag != '' | ||
| shell: bash | ||
| run: | | ||
| git checkout "${{ inputs.git_tag }}" -- deeplabcut | ||
|
|
||
| - name: Set up dev-docs environment | ||
| uses: ./.github/actions/setup-dev-docs | ||
|
C-Achard marked this conversation as resolved.
|
||
| with: | ||
| python-version: ${{ inputs.python-version }} | ||
|
C-Achard marked this conversation as resolved.
|
||
|
|
||
| - name: Configure git for Mike | ||
| shell: bash | ||
| run: | | ||
| git config user.name "github-actions[bot]" | ||
| git config user.email "github-actions[bot]@users.noreply.github.com" | ||
|
|
||
| - name: Deploy dev-docs version | ||
| if: inputs.action == 'deploy' | ||
| shell: bash | ||
| run: | | ||
| if [ -n "${{ inputs.aliases }}" ]; then | ||
| mike deploy --push \ | ||
| --config-file "${{ inputs.config-file }}" \ | ||
| --deploy-prefix "${{ inputs.deploy-prefix }}" \ | ||
| --update-aliases \ | ||
| "${{ inputs.version_label }}" ${{ inputs.aliases }} | ||
| else | ||
| mike deploy --push \ | ||
| --config-file "${{ inputs.config-file }}" \ | ||
| --deploy-prefix "${{ inputs.deploy-prefix }}" \ | ||
| "${{ inputs.version_label }}" | ||
| fi | ||
|
|
||
| if [ -n "${{ inputs.default_label }}" ]; then | ||
| mike set-default --push \ | ||
| --config-file "${{ inputs.config-file }}" \ | ||
| --deploy-prefix "${{ inputs.deploy-prefix }}" \ | ||
| "${{ inputs.default_label }}" | ||
| fi | ||
|
|
||
| - name: Delete dev-docs version | ||
| if: inputs.action == 'delete' | ||
| shell: bash | ||
| run: | | ||
| mike delete --push \ | ||
| --config-file "${{ inputs.config-file }}" \ | ||
| --deploy-prefix "${{ inputs.deploy-prefix }}" \ | ||
| "${{ inputs.version_label }}" | ||
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| name: "Intelligent Python Testing" | ||
| name: Code / Intelligent Python Testing | ||
|
|
||
| on: | ||
| push: | ||
|
|
||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| name: Lockfile | ||
| name: Code / Lockfile | ||
|
|
||
| on: | ||
| pull_request: | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.