Skip to content

The agent engineering platform.

ci(infra): trace scheduled integration tests (#37615)

Mason Daughertybdd7f71a1b42
diff --git a/.github/workflows/_release.yml b/.github/workflows/_release.yml
index 0fbafcf748..097d60c271 100644
--- a/.github/workflows/_release.yml
+++ b/.github/workflows/_release.yml
@@ -116,7 +116,7 @@ jobs:
build:
name: πŸ“¦ Build distribution
if: github.ref == 'refs/heads/master' || inputs.dangerous-nonmaster-release
- environment: Scheduled testing
+ environment: Release
runs-on: ubuntu-latest
permissions:
contents: read
@@ -274,6 +274,7 @@ jobs:
needs:
- build
- release-notes
+ environment: Release
runs-on: ubuntu-latest
permissions:
contents: read
@@ -433,6 +434,7 @@ jobs:
- build
- release-notes
- pre-release-checks
+ environment: Release
runs-on: ubuntu-latest
permissions:
# This permission is used for trusted publishing:
@@ -475,6 +477,7 @@ jobs:
- release-notes
- test-pypi-publish
- pre-release-checks
+ environment: Release
runs-on: ubuntu-latest
permissions:
contents: read
@@ -638,6 +641,7 @@ jobs:
# - test-prior-published-packages-against-new-core
# Run if all needed jobs succeeded or were skipped (test-dependents only runs for core/langchain_v1)
if: ${{ !cancelled() && !failure() }}
+ environment: Release
runs-on: ubuntu-latest
permissions:
# This permission is used for trusted publishing:
@@ -685,6 +689,7 @@ jobs:
- publish
# Run if all needed jobs succeeded or were skipped
if: ${{ !cancelled() && !failure() }}
+ environment: Release
runs-on: ubuntu-latest
permissions:
# This permission is needed by `ncipollo/release-action` to
diff --git a/.github/workflows/integration_tests.yml b/.github/workflows/integration_tests.yml
index 6ca34bee12..00b01b79b9 100644
--- a/.github/workflows/integration_tests.yml
+++ b/.github/workflows/integration_tests.yml
@@ -128,6 +128,8 @@ jobs:
if: github.repository_owner == 'langchain-ai' || github.event_name != 'schedule'
name: "🐍 Python ${{ matrix.python-version }}: ${{ matrix.working-directory }}"
runs-on: ubuntu-latest
+ # Scopes LangSmith tracing credentials (and any other env-scoped secrets)
+ environment: "Scheduled testing"
needs: [compute-matrix]
timeout-minutes: 30
strategy:
@@ -212,6 +214,34 @@ jobs:
;;
esac
+ - name: "🧾 Build LangSmith Metadata"
+ # GHA expression values flow through intermediate env vars (injection
+ # hardening) and jq -nc builds the JSON, so quotes/newlines in any
+ # field can't corrupt the payload.
+ env:
+ GH_SHA: ${{ github.sha }}
+ GH_RUN_ID: ${{ github.run_id }}
+ GH_RUN_ATTEMPT: ${{ github.run_attempt }}
+ GH_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
+ GH_WORKFLOW: ${{ github.workflow }}
+ GH_EVENT: ${{ github.event_name }}
+ GH_REF: ${{ github.ref }}
+ WORKING_DIRECTORY: ${{ matrix.working-directory }}
+ PYTHON_VERSION: ${{ matrix.python-version }}
+ run: |
+ metadata=$(jq -nc \
+ --arg github_sha "$GH_SHA" \
+ --arg github_run_id "$GH_RUN_ID" \
+ --arg github_run_attempt "$GH_RUN_ATTEMPT" \
+ --arg github_run_url "$GH_RUN_URL" \
+ --arg github_workflow "$GH_WORKFLOW" \
+ --arg github_event "$GH_EVENT" \
+ --arg github_ref "$GH_REF" \
+ --arg working_directory "$WORKING_DIRECTORY" \
+ --arg python_version "$PYTHON_VERSION" \
+ '{github_sha: $github_sha, github_run_id: $github_run_id, github_run_attempt: $github_run_attempt, github_run_url: $github_run_url, github_workflow: $github_workflow, github_event: $github_event, github_ref: $github_ref, working_directory: $working_directory, python_version: $python_version}')
+ echo "LANGSMITH_METADATA=$metadata" >> "$GITHUB_ENV"
+
- name: "πŸš€ Run Integration Tests"
# WARNING: All secrets below are available to every matrix job regardless of
# which package is being tested. This is intentional for simplicity, but means
@@ -219,6 +249,12 @@ jobs:
env:
LANGCHAIN_TESTS_USER_AGENT: ${{ secrets.LANGCHAIN_TESTS_USER_AGENT }}
+ # Route traces to one project with GitHub run metadata so failures link back to the originating Actions run.
+ LANGSMITH_TRACING: "true"
+ LANGSMITH_API_KEY: ${{ secrets.LANGSMITH_API_KEY }}
+ LANGSMITH_PROJECT: ${{ vars.LANGSMITH_PROJECT || 'scheduled-testing-py' }}
+ LANGSMITH_TAGS: "github-actions,${{ matrix.working-directory }},python-${{ matrix.python-version }},sha-${{ github.sha }}"
+
AI21_API_KEY: ${{ secrets.AI21_API_KEY }}
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
ANTHROPIC_FILES_API_IMAGE_ID: ${{ secrets.ANTHROPIC_FILES_API_IMAGE_ID }}