Skip to content

Commit

Permalink
merge master
Browse files Browse the repository at this point in the history
  • Loading branch information
soumik12345 committed Oct 8, 2024
2 parents 1d8bddf + 6bf8642 commit 81f0a6a
Show file tree
Hide file tree
Showing 1,118 changed files with 18,676 additions and 12,636 deletions.
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1 @@
weave/frontend/** linguist-generated=true
weave_query/weave_query/frontend/** linguist-generated=true
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
* @wandb/weave-team
weave-js/src/common @wandb/fe-infra-reviewers
weave-js/src/components @wandb/fe-infra-reviewers @wandb/weave-team
weave-js/src/assets @wandb/fe-infra-reviewers @wandb/weave-team
88 changes: 88 additions & 0 deletions .github/workflows/check-which-tests-to-run.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: Check which tests to run

on:
workflow_call:
outputs:
weave_query_tests:
value: ${{ jobs.check.outputs.weave_query_tests }}
weave_js_tests:
value: ${{ jobs.check.outputs.weave_js_tests }}
trace_server_tests:
value: ${{ jobs.check.outputs.trace_server_tests }}

env:
WEAVE_QUERY_PATHS: 'weave_query/'
WEAVE_JS_PATHS: 'weave-js/'
TRACE_SERVER_PATHS: 'weave/trace_server/'
# Everything else is implicitly trace SDK

jobs:
check:
runs-on: ubuntu-latest
outputs:
weave_query_tests: ${{ steps.weave_query.outputs.run_tests }}
weave_js_tests: ${{ steps.weave_js.outputs.run_tests }}
trace_server_tests: ${{ steps.trace_server.outputs.run_tests }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
fetch-tags: true
ref: ${{ github.head_ref }}
- name: Get changed files
run: |
# Fetch all branches
git fetch --all
# Determine the base branch and current commit
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
# For pull requests
BASE_BRANCH="${{ github.base_ref }}"
CURRENT_COMMIT="${{ github.event.pull_request.head.sha }}"
else
# For pushes
BASE_BRANCH=$(git remote show origin | sed -n '/HEAD branch/s/.*: //p')
CURRENT_COMMIT="${{ github.sha }}"
fi
echo "Base branch is $BASE_BRANCH"
# Find the common ancestor
MERGE_BASE=$(git merge-base origin/$BASE_BRANCH $CURRENT_COMMIT)
# Get changed files
changed_files=$(git diff --name-only $MERGE_BASE $CURRENT_COMMIT)
echo "Changed files:"
echo "$changed_files"
echo "changed_files<<EOF" >> $GITHUB_ENV
echo "$changed_files" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- id: weave_query
name: Weave Query Checks
run: |
for path in ${{ env.WEAVE_QUERY_PATHS }}; do
if echo "$changed_files" | grep -q "$path"; then
echo "run_tests=true" >> $GITHUB_OUTPUT
exit 0
fi
done
echo "run_tests=false" >> $GITHUB_OUTPUT
- id: weave_js
name: Weave JS Checks
run: |
for path in ${{ env.WEAVE_JS_PATHS }}; do
if echo "$changed_files" | grep -q "$path"; then
echo "run_tests=true" >> $GITHUB_OUTPUT
exit 0
fi
done
echo "run_tests=false" >> $GITHUB_OUTPUT
- id: trace_server
name: Weave Trace Server Checks
run: |
for path in ${{ env.TRACE_SERVER_PATHS }}; do
if echo "$changed_files" | grep -q "$path"; then
echo "run_tests=true" >> $GITHUB_OUTPUT
exit 0
fi
done
echo "run_tests=false" >> $GITHUB_OUTPUT
2 changes: 1 addition & 1 deletion .github/workflows/cla.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ jobs:
# branch should not be protected
branch: "cla"
# cannot use teams due to: https://github.com/contributor-assistant/github-action/issues/100
allowlist: actions-user, altay, bdytx5, dannygoldstein, davidwallacejackson, jamie-rasmussen, jlzhao27, jo-fang, jwlee64, laxels, morganmcg1, nickpenaranda, scottire, shawnlewis, staceysv, tssweeney, vanpelt, vwrj, wandbmachine
allowlist: actions-user, altay, andrewtruong, bdytx5, dannygoldstein, davidwallacejackson, jamie-rasmussen, jlzhao27, jo-fang, jwlee64, laxels, morganmcg1, nickpenaranda, scottire, shawnlewis, staceysv, tssweeney, vanpelt, vwrj, wandbmachine, [email protected]
7 changes: 5 additions & 2 deletions .github/workflows/notify-wandb-core.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@ name: Notify wandb/core
on:
push:
branches:
- "**"
- '**'
workflow_dispatch:

jobs:
check-which-tests-to-run:
uses: ./.github/workflows/check-which-tests-to-run.yaml
notify-wandb-core:
needs: check-which-tests-to-run
runs-on: ubuntu-latest
steps:
- name: Repository dispatch
Expand All @@ -19,4 +22,4 @@ jobs:
token: ${{ secrets.WANDB_CORE_ACCESS_TOKEN }}
repository: wandb/core
event-type: weave-package-updated
client-payload: '{"ref_name": "${{ github.ref_name }}", "sha": "${{ github.sha }}"}'
client-payload: '{"ref_name": "${{ github.ref_name }}", "sha": "${{ github.sha }}", "run_weave_js_tests": ${{ needs.check-which-tests-to-run.outputs.weave_js_tests }}, "run_weave_query_tests": ${{ needs.check-which-tests-to-run.outputs.weave_query_tests }}, "run_trace_server_tests": ${{ needs.check-which-tests-to-run.outputs.trace_server_tests }}}'
6 changes: 3 additions & 3 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
workflow_dispatch:
inputs:
is_test:
description: "Use Test Pypi"
description: 'Use Test Pypi'
required: true
type: boolean
default: true
Expand All @@ -24,11 +24,11 @@ jobs:
fetch-depth: 0
- uses: actions/setup-node@v1
with:
node-version: "18.x"
node-version: '18.x'
- run: |
pip install build twine
./build_dist.py
if [[ -n "$(git status weave/frontend/sha1.txt --porcelain)" ]]
if [[ -n "$(git status weave_query/weave_query/frontend/sha1.txt --porcelain)" ]]
then
echo "::error cannot publish release, commited SHA does not match build SHA"
exit 1
Expand Down
98 changes: 72 additions & 26 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,45 +12,66 @@ on:
push:

jobs:
check-which-tests-to-run:
uses: ./.github/workflows/check-which-tests-to-run.yaml

# ==== Query Service Jobs ====
build-container-query-service:
name: Build Legacy (Query Service) test container
timeout-minutes: 30
runs-on: [self-hosted, builder]
# runs-on: ubuntu-latest
outputs:
build_needed: ${{ steps.build_check.outputs.build_needed }}
env:
REGISTRY: us-east4-docker.pkg.dev/weave-support-367421/weave-images
needs: check-which-tests-to-run

# if: github.ref == 'refs/heads/master' || needs.check-which-tests-to-run.outputs.weave_query_tests
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 2

- name: Check if build is needed
id: build_check
run: |
if [[ "${{ github.ref }}" == "refs/heads/master" || "${{ needs.check-which-tests-to-run.outputs.weave_query_tests }}" == "true" ]]; then
echo "Build is needed"
echo "build_needed=true" >> $GITHUB_OUTPUT
else
echo "Build is not needed"
echo "build_needed=false" >> $GITHUB_OUTPUT
fi
- name: Login to Docker Hub
if: steps.build_check.outputs.build_needed == 'true'
uses: docker/login-action@v2
with:
registry: us-east4-docker.pkg.dev
username: _json_key
password: ${{ secrets.gcp_sa_key }}

# this script is hardcoded to build for linux/amd64
- name: Prune docker cache
if: steps.build_check.outputs.build_needed == 'true'
run: docker system prune -f
- name: Build legacy (query sevice) unit test image
run: python3 weave/docker/docker_build.py build_deps weave-test-python-query-service builder . weave/legacy/Dockerfile.ci.test

- name: Build legacy (query service) unit test image
if: steps.build_check.outputs.build_needed == 'true'
run: python3 weave/docker/docker_build.py build_deps weave-test-python-query-service builder . weave_query/Dockerfile.ci.test

test-query-service:
name: Legacy (Query Service) Python unit tests
timeout-minutes: 15 # do not raise! running longer than this indicates an issue with the tests. fix there.
needs:
- check-which-tests-to-run
- build-container-query-service
# runs-on: [self-hosted, gke-runner]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
job_num: [0, 1]
# runs-on: ubuntu-latest
container: us-east4-docker.pkg.dev/weave-support-367421/weave-images/weave-test-python-query-service:${{ github.sha }}
container: ${{ needs.build-container-query-service.outputs.build_needed == 'true' && format('us-east4-docker.pkg.dev/weave-support-367421/weave-images/weave-test-python-query-service:{0}', github.sha) || null }}
services:
wandbservice:
image: us-central1-docker.pkg.dev/wandb-production/images/local-testcontainer:master
Expand All @@ -65,14 +86,25 @@ jobs:
- '8083:8083'
- '9015:9015'
options: --health-cmd "curl --fail http://localhost:8080/healthz || exit 1" --health-interval=5s --health-timeout=3s
outputs:
tests_should_run: ${{ steps.test_check.outputs.tests_should_run }}
steps:
# - uses: datadog/[email protected]
# with:
# api_key: ${{ secrets.DD_API_KEY }}
- uses: actions/checkout@v2
- name: Check if tests should run
id: test_check
run: |
if [[ "${{ github.ref }}" == "refs/heads/master" || "${{ needs.check-which-tests-to-run.outputs.weave_query_tests }}" == "true" ]]; then
echo "Tests should run"
echo "tests_should_run=true" >> $GITHUB_OUTPUT
else
echo "Tests should not run"
echo "tests_should_run=false" >> $GITHUB_OUTPUT
fi
- name: Verify wandb server is running
if: steps.test_check.outputs.tests_should_run == 'true'
run: curl -s http://wandbservice:8080/healthz
- name: Run Legacy (Query Service) Python Unit Tests
if: steps.test_check.outputs.tests_should_run == 'true'
env:
DD_SERVICE: weave-python
DD_ENV: ci
Expand All @@ -82,15 +114,13 @@ jobs:
WEAVE_SERVER_DISABLE_ECOSYSTEM: 1
run: |
source /root/venv/bin/activate && \
pip install 'dspy-ai==2.4.13' && \
pip install pydantic -U && \
cd weave && \
cd weave_query && \
pytest \
--job-num=${{ matrix.job_num }} \
--timeout=90 \
--ddtrace \
--durations=5 \
./legacy
.
test-query-service-matrix-check: # This job does nothing and is only used for the branch protection
if: always()
Expand All @@ -110,16 +140,30 @@ jobs:
weavejs-lint-compile:
name: WeaveJS Lint and Compile
runs-on: ubuntu-latest
# runs-on: [self-hosted, gke-runner]
needs:
- check-which-tests-to-run
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Check if lint and compile should run
id: check_run
run: |
if [[ "${{ github.ref }}" == "refs/heads/master" || "${{ needs.check-which-tests-to-run.outputs.weave_js_tests }}" == "true" ]]; then
echo "Lint and compile should run"
echo "should_lint_and_compile=true" >> $GITHUB_OUTPUT
else
echo "Lint and compile should not run"
echo "should_lint_and_compile=false" >> $GITHUB_OUTPUT
fi
- uses: actions/setup-node@v1
if: steps.check_run.outputs.should_lint_and_compile == 'true'
with:
node-version: '18.x'
- run: |
- name: Run WeaveJS Lint and Compile
if: steps.check_run.outputs.should_lint_and_compile == 'true'
run: |
set -e
cd weave-js
yarn install --frozen-lockfile
Expand All @@ -143,12 +187,13 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox
- name: Run tox
run: tox -e lint
pip install nox uv
- name: Run nox
run: nox -e lint

trace-tests:
name: Trace tox tests
name: Trace nox tests
timeout-minutes: 10
runs-on: ubuntu-latest
strategy:
matrix:
Expand All @@ -160,7 +205,7 @@ jobs:
'12',
#
]
tox-shard:
nox-shard:
[
'trace',
'trace_server',
Expand All @@ -170,6 +215,7 @@ jobs:
'dspy',
'groq',
'google_ai_studio',
'instructor',
'langchain',
'litellm',
'llamaindex',
Expand Down Expand Up @@ -207,27 +253,27 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox
- name: Run tox (Clickhouse Only)
pip install nox uv
- name: Run nox (Clickhouse Only)
env:
WEAVE_SENTRY_ENV: ci
CI: 1
WB_SERVER_HOST: http://wandbservice
WF_CLICKHOUSE_HOST: weave_clickhouse
WF_CLICKHOUSE_HOST: localhost
WEAVE_SERVER_DISABLE_ECOSYSTEM: 1
run: |
tox -e ${{ matrix.tox-shard }}-py${{ matrix.python-version-major }}${{ matrix.python-version-minor }} -- \
nox -e "tests-${{ matrix.python-version-major }}.${{ matrix.python-version-minor }}(shard='${{ matrix.nox-shard }}')" -- \
-m "weave_client and not skip_clickhouse_client" \
--weave-server=clickhouse
- name: Run tox
- name: Run nox
env:
WEAVE_SENTRY_ENV: ci
CI: 1
WB_SERVER_HOST: http://wandbservice
WF_CLICKHOUSE_HOST: weave_clickhouse
WEAVE_SERVER_DISABLE_ECOSYSTEM: 1
run: |
tox -e ${{ matrix.tox-shard }}-py${{ matrix.python-version-major }}${{ matrix.python-version-minor }}
nox -e "tests-${{ matrix.python-version-major }}.${{ matrix.python-version-minor }}(shard='${{ matrix.nox-shard }}')" -- -n4
trace-tests-matrix-check: # This job does nothing and is only used for the branch protection
if: always()

Expand Down
Loading

0 comments on commit 81f0a6a

Please sign in to comment.