Skip to content

Commit

Permalink
Update github actions (#993)
Browse files Browse the repository at this point in the history
Update github actions for codeblock checker in the docs
  • Loading branch information
jverre authored Jan 7, 2025
1 parent ec38f6c commit e5bbc69
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 11 deletions.
41 changes: 33 additions & 8 deletions .github/workflows/documentation_codeblock_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,44 @@ on:
options:
- 'false'
- 'true'
schedule:
- cron: '0 0 * * *' # Run once a day at midnight UTC
pull_request:
paths:
- 'apps/opik-documentation/documentation/docs/*.md'
- 'apps/opik-documentation/documentation/docs/*.mdx'
- 'apps/opik-documentation/documentation/docs/**/*.md'
- 'apps/opik-documentation/documentation/docs/**/*.mdx'

jobs:
collect_test_paths:
runs-on: ubuntu-latest
outputs:
test_paths: ${{ steps.paths.outputs.paths }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Fetch all history for git diff

- id: paths
working-directory: apps/opik-documentation/documentation
run: |
# Collect both directories and markdown files in root
(
ls -d docs/*/ 2>/dev/null;
find docs -maxdepth 1 -type f -name "*.md"
) | jq --raw-input --slurp --compact-output 'split("\n")[:-1]' >> ${GITHUB_OUTPUT}
# Get list of changed files in docs directory
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
# For pull requests, compare with base branch
echo "paths=$(
git diff --name-only origin/${{ github.base_ref }} |
grep -E '^apps/opik-documentation/documentation/docs/.*\.(md|mdx)$' |
sed 's|apps/opik-documentation/documentation/||' |
jq -R -s -c 'split("\n")[:-1]'
)" >> $GITHUB_OUTPUT
else
# For manual runs and scheduled runs, check all files
echo "paths=$(
(
ls -d docs/*/ 2>/dev/null;
find docs -maxdepth 1 -type f -name "*.md" -o -name "*.mdx"
) | jq -R -s -c 'split("\n")[:-1]'
)" >> $GITHUB_OUTPUT
fi
test:
needs: collect_test_paths
Expand All @@ -44,14 +65,18 @@ jobs:
python-version: '3.10'

- name: Install dependencies
working-directory: apps/opik-documentation/documentation
run: |
python -m pip install --upgrade pip
pip install pytest
pip install -r requirements.txt
if [ "${{ github.event.inputs.install_opik }}" = "true" ]; then
pip install -e .
fi
- name: Run tests
working-directory: apps/opik-documentation/documentation
run: |
pytest ${{ matrix.path }} -v
if [ -n "${{ matrix.path }}" ]; then
pytest ${{ matrix.path }} -v --suppress-no-test-exit-code
fi
5 changes: 4 additions & 1 deletion apps/opik-documentation/documentation/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
jupyter
jupyter
markdown-analysis
pytest-asyncio
pytest-custom_exit_code
3 changes: 1 addition & 2 deletions apps/opik-documentation/documentation/sidebars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ const sidebars: SidebarsConfig = {
"tracing/log_distributed_traces",
"tracing/annotate_traces",
"tracing/cost_tracking",
"tracing/production_monitoring",
"tracing/sdk_configuration",
"tracing/export_data",
{
Expand Down Expand Up @@ -116,7 +115,7 @@ const sidebars: SidebarsConfig = {
type: "category",
label: "Production",
collapsed: true,
items: ["production/gateway"],
items: ["production/gateway", "production/production_monitoring"],
},
{
type: "category",
Expand Down

0 comments on commit e5bbc69

Please sign in to comment.