Skip to content

Commit f48ff36

Browse files
committed
Merge branch 'main' into test-result-delayed-upload-subproc
2 parents aabc8bc + 6e3e17b commit f48ff36

266 files changed

Lines changed: 46662 additions & 68062 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: 'Delete Python Docs (mike)'
2+
description: 'Set up Python, install docs dependencies, and delete a version from gh-pages with mike.'
3+
4+
inputs:
5+
version:
6+
description: "Version identifier to delete (mike's first positional arg)."
7+
required: true
8+
9+
runs:
10+
using: composite
11+
steps:
12+
- name: Set up Python
13+
uses: actions/setup-python@v5
14+
with:
15+
python-version: '3.11'
16+
17+
- name: Install docs dependencies
18+
shell: bash
19+
run: |
20+
cd python
21+
pip install -e .[docs-build]
22+
23+
- name: Fetch gh-pages branch
24+
shell: bash
25+
run: git fetch origin gh-pages --depth=1
26+
27+
- name: Configure Git
28+
shell: bash
29+
run: |
30+
git config --global user.name "github-actions[bot]"
31+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
32+
33+
- name: Delete with mike
34+
shell: bash
35+
env:
36+
VERSION: ${{ inputs.version }}
37+
run: |
38+
cd python
39+
echo "Deleting docs for: $VERSION"
40+
if mike list | grep -q "$VERSION"; then
41+
mike delete "$VERSION" --push
42+
echo "Successfully deleted docs for $VERSION"
43+
else
44+
echo "No docs found for $VERSION, nothing to delete"
45+
fi
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: 'Deploy Python Docs (mike)'
2+
description: 'Set up Python, install docs dependencies, and deploy the python/ docs to gh-pages with mike.'
3+
4+
inputs:
5+
version:
6+
description: "Version identifier to deploy under (mike's first positional arg)."
7+
required: true
8+
aliases:
9+
description: 'Space-separated aliases to point at this version (e.g., "latest"). Empty for none.'
10+
required: false
11+
default: ''
12+
hidden:
13+
description: 'Mark the version as hidden in the version selector. Must be "true" or "false".'
14+
required: false
15+
default: 'false'
16+
17+
runs:
18+
using: composite
19+
steps:
20+
- name: Set up Python
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version: '3.11'
24+
25+
- name: Install docs dependencies
26+
shell: bash
27+
run: |
28+
cd python
29+
pip install -e .[docs-build]
30+
31+
- name: Fetch gh-pages branch
32+
shell: bash
33+
run: git fetch origin gh-pages --depth=1
34+
35+
- name: Configure Git
36+
shell: bash
37+
run: |
38+
git config --global user.name "github-actions[bot]"
39+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
40+
41+
- name: Deploy with mike
42+
shell: bash
43+
env:
44+
VERSION: ${{ inputs.version }}
45+
ALIASES: ${{ inputs.aliases }}
46+
HIDDEN: ${{ inputs.hidden }}
47+
run: |
48+
cd python
49+
50+
if [[ "$HIDDEN" != "true" && "$HIDDEN" != "false" ]]; then
51+
echo "Error: 'hidden' must be 'true' or 'false', got '$HIDDEN'"
52+
exit 1
53+
fi
54+
55+
if [[ -z "$VERSION" ]]; then
56+
echo "Error: 'version' is required"
57+
exit 1
58+
fi
59+
60+
MIKE_ARGS=("$VERSION")
61+
for alias in $ALIASES; do
62+
MIKE_ARGS+=("$alias")
63+
done
64+
MIKE_ARGS+=(--push --update-aliases --prop-set "hidden=$HIDDEN")
65+
66+
echo "Running: mike deploy ${MIKE_ARGS[*]}"
67+
mike deploy "${MIKE_ARGS[@]}"

.github/workflows/python_build_docs.yml

Lines changed: 37 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,13 @@ jobs:
2222
runs-on: ubuntu-latest
2323
permissions:
2424
contents: write
25+
pull-requests: write
2526
steps:
2627
- name: Checkout code
2728
uses: actions/checkout@v4
2829
with:
2930
fetch-depth: 1
3031

31-
- name: Set up Python
32-
uses: actions/setup-python@v4
33-
with:
34-
python-version: '3.11'
35-
36-
- name: Install dependencies
37-
run: |
38-
cd python
39-
pip install -e .[docs-build]
40-
4132
- name: Extract version
4233
id: version
4334
run: |
@@ -56,21 +47,41 @@ jobs:
5647
echo "alias=$ALIAS" >> $GITHUB_OUTPUT
5748
echo "Dev deployment - Version: $VERSION, Alias: $ALIAS"
5849
59-
- name: Fetch gh-pages branch
60-
run: git fetch origin gh-pages --depth=1
50+
- name: Deploy docs
51+
uses: ./.github/actions/python-mike-deploy
52+
with:
53+
version: ${{ steps.version.outputs.alias }}
54+
hidden: 'true'
6155

62-
- name: Configure Git
63-
run: |
64-
git config --global user.name "github-actions[bot]"
65-
git config --global user.email "github-actions[bot]@users.noreply.github.com"
56+
- name: Comment docs preview link on PR
57+
if: github.event_name == 'pull_request'
58+
uses: actions/github-script@v7
59+
with:
60+
script: |
61+
const marker = '<!-- mike-docs-preview -->';
62+
const alias = '${{ steps.version.outputs.alias }}';
63+
const version = '${{ steps.version.outputs.version }}';
64+
const url = `https://sift-stack.github.io/sift/python/${alias}/`;
65+
const body = [
66+
marker,
67+
`**Python docs preview:** ${url}`,
68+
``,
69+
`Deployed from \`${version}\`. The link may take up to a minute to become live as GitHub Pages propagates.`,
70+
].join('\n');
6671
67-
- name: Deploy docs with mike
68-
run: |
69-
cd python
70-
# Deploy dev/PR docs with hidden property to hide from version dropdown
71-
mike deploy ${{ steps.version.outputs.alias }} --push --update-aliases --prop-set hidden=true
72-
env:
73-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
72+
const { owner, repo } = context.repo;
73+
const issue_number = context.issue.number;
74+
75+
const { data: comments } = await github.rest.issues.listComments({
76+
owner, repo, issue_number, per_page: 100,
77+
});
78+
const existing = comments.find(c => c.body && c.body.includes(marker));
79+
80+
if (existing) {
81+
await github.rest.issues.updateComment({ owner, repo, comment_id: existing.id, body });
82+
} else {
83+
await github.rest.issues.createComment({ owner, repo, issue_number, body });
84+
}
7485
7586
cleanup_docs:
7687
if: github.event.action == 'closed'
@@ -83,36 +94,7 @@ jobs:
8394
with:
8495
fetch-depth: 1
8596

86-
- name: Set up Python
87-
uses: actions/setup-python@v4
88-
with:
89-
python-version: '3.11'
90-
91-
- name: Install dependencies
92-
run: |
93-
cd python
94-
pip install -e .[docs-build]
95-
96-
- name: Fetch gh-pages branch
97-
run: git fetch origin gh-pages --depth=1
98-
99-
- name: Configure Git
100-
run: |
101-
git config --global user.name "github-actions[bot]"
102-
git config --global user.email "github-actions[bot]@users.noreply.github.com"
103-
10497
- name: Delete PR docs
105-
run: |
106-
cd python
107-
PR_ALIAS="pr-${{ github.event.number }}"
108-
echo "Deleting docs for: $PR_ALIAS"
109-
110-
# Check if the PR docs exist before trying to delete
111-
if mike list | grep -q "$PR_ALIAS"; then
112-
mike delete "$PR_ALIAS" --push
113-
echo "Successfully deleted docs for $PR_ALIAS"
114-
else
115-
echo "No docs found for $PR_ALIAS, nothing to delete"
116-
fi
117-
env:
118-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
98+
uses: ./.github/actions/python-mike-delete
99+
with:
100+
version: pr-${{ github.event.number }}

.github/workflows/python_ci.yaml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,14 @@ jobs:
9090
run: |
9191
pytest -m "not integration"
9292
93-
- name: Pytest Integration Tests
94-
env:
95-
SIFT_GRPC_URI: ${{ vars.SIFT_GRPC_URI }}
96-
SIFT_REST_URI: ${{ vars.SIFT_REST_URI }}
97-
SIFT_API_KEY: ${{ secrets.SIFT_API_KEY }}
98-
run: |
99-
pytest -m "integration"
93+
# Disabling integration tests that interact with Sift until a better solution is implemented
94+
# - name: Pytest Integration Tests
95+
# env:
96+
# SIFT_GRPC_URI: ${{ vars.SIFT_GRPC_URI }}
97+
# SIFT_REST_URI: ${{ vars.SIFT_REST_URI }}
98+
# SIFT_API_KEY: ${{ secrets.SIFT_API_KEY }}
99+
# run: |
100+
# pytest -m "integration"
100101

101102
- name: Sync Stubs Mypy
102103
working-directory: python/lib
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Delete Python Docs Version
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Version or alias to delete (e.g., v0.14, staging, pr-123). Irreversible.'
8+
required: true
9+
type: string
10+
11+
jobs:
12+
delete_docs:
13+
name: Delete Documentation
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: write
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 1
22+
23+
- name: Delete docs
24+
uses: ./.github/actions/python-mike-delete
25+
with:
26+
version: ${{ inputs.version }}
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: Redeploy Python Docs
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Version or custom alias to deploy under (e.g., v0.14, staging, preview). Leave empty to derive from the latest stable python/v*.*.* tag.'
8+
required: false
9+
type: string
10+
update_latest:
11+
description: 'Also update the "latest" alias'
12+
required: false
13+
default: true
14+
type: boolean
15+
hidden:
16+
description: 'Hide from the version dropdown. "auto" hides custom aliases and shows vX.Y versions.'
17+
required: false
18+
default: 'auto'
19+
type: choice
20+
options:
21+
- auto
22+
- 'true'
23+
- 'false'
24+
25+
jobs:
26+
redeploy_docs:
27+
name: Redeploy Documentation
28+
runs-on: ubuntu-latest
29+
permissions:
30+
contents: write
31+
steps:
32+
- name: Checkout code
33+
uses: actions/checkout@v4
34+
with:
35+
fetch-depth: 0
36+
37+
- name: Resolve version and visibility
38+
id: resolve
39+
env:
40+
INPUT_VERSION: ${{ inputs.version }}
41+
HIDDEN_INPUT: ${{ inputs.hidden }}
42+
run: |
43+
if [[ -n "$INPUT_VERSION" ]]; then
44+
VERSION="$INPUT_VERSION"
45+
echo "Using provided version: $VERSION"
46+
else
47+
LATEST_TAG=$(git tag -l 'python/v*' | grep -E '^python/v[0-9]+\.[0-9]+\.[0-9]+$' | sort -V | tail -n1 || true)
48+
if [[ -z "$LATEST_TAG" ]]; then
49+
echo "Error: No stable python/v*.*.* tag found. Provide the 'version' input."
50+
exit 1
51+
fi
52+
FULL_VERSION="${LATEST_TAG#python/}"
53+
if [[ "$FULL_VERSION" =~ ^v?([0-9]+)\.([0-9]+)\.[0-9]+$ ]]; then
54+
VERSION="v${BASH_REMATCH[1]}.${BASH_REMATCH[2]}"
55+
echo "Derived version from $LATEST_TAG: $VERSION"
56+
else
57+
echo "Error: Could not parse $LATEST_TAG"
58+
exit 1
59+
fi
60+
fi
61+
62+
case "$HIDDEN_INPUT" in
63+
auto)
64+
if [[ "$VERSION" =~ ^v[0-9]+\.[0-9]+$ ]]; then
65+
HIDDEN="false"
66+
else
67+
HIDDEN="true"
68+
fi
69+
echo "hidden=auto resolved to $HIDDEN for version $VERSION"
70+
;;
71+
true|false)
72+
HIDDEN="$HIDDEN_INPUT"
73+
;;
74+
*)
75+
echo "Error: unexpected hidden value '$HIDDEN_INPUT'"
76+
exit 1
77+
;;
78+
esac
79+
80+
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
81+
echo "hidden=$HIDDEN" >> "$GITHUB_OUTPUT"
82+
83+
- name: Deploy docs
84+
uses: ./.github/actions/python-mike-deploy
85+
with:
86+
version: ${{ steps.resolve.outputs.version }}
87+
aliases: ${{ inputs.update_latest && 'latest' || '' }}
88+
hidden: ${{ steps.resolve.outputs.hidden }}

0 commit comments

Comments
 (0)