Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 100 additions & 0 deletions .github/actions/classify-changes/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: Classify Changes
description: Classify Gym changes as full, server-only, or docs-only

inputs:
base-ref:
description: Base commit or ref used to determine changed files
required: false
default: ""
force-run-all:
description: Run the full suite without inspecting changed files
required: false
default: "false"

outputs:
run_full:
description: Whether to run the full test suite
value: ${{ steps.classify.outputs.run_full }}
run_servers:
description: Whether to run only changed server tests
value: ${{ steps.classify.outputs.run_servers }}
docs_only:
description: Whether all changed files are documentation-classified files
value: ${{ steps.classify.outputs.docs_only }}
server_all_changed_files:
description: Changed files belonging to server paths
value: ${{ steps.changed-files.outputs.server_all_changed_files }}

runs:
using: composite
steps:
- name: Detect changed files
id: changed-files
if: inputs.force-run-all != 'true'
uses: step-security/changed-files@3dbe17c78367e7d60f00d78ae6781a35be47b4a1 # v45.0.1
with:
base_sha: ${{ inputs.base-ref }}
# 'files' input enables global other_changed_files_count for uncategorized files.
files: |
**.md
fern/**
LICENSE
resources_servers/**
responses_api_agents/**
responses_api_models/**
benchmarks/**
files_yaml: |
doc:
- '**.md'
- fern/**
- LICENSE
- benchmarks/**
server:
- resources_servers/**
- responses_api_agents/**
- responses_api_models/**

- name: Classify changes
id: classify
shell: bash -e -u -o pipefail {0}
env:
DOC_CHANGED: ${{ steps.changed-files.outputs.doc_any_changed }}
FORCE_RUN_ALL: ${{ inputs.force-run-all }}
OTHER_COUNT: ${{ steps.changed-files.outputs.other_changed_files_count }}
SERVER_CHANGED: ${{ steps.changed-files.outputs.server_any_changed }}
run: |
if [[ "$FORCE_RUN_ALL" == "true" || "${OTHER_COUNT:-0}" -gt 0 ]]; then
run_full=true
run_servers=false
docs_only=false
elif [[ "$SERVER_CHANGED" == "true" ]]; then
run_full=false
run_servers=true
docs_only=false
else
run_full=false
run_servers=false
docs_only=true
fi

echo "run_full=$run_full" >> "$GITHUB_OUTPUT"
echo "run_servers=$run_servers" >> "$GITHUB_OUTPUT"
echo "docs_only=$docs_only" >> "$GITHUB_OUTPUT"

echo "Changed files: docs=${DOC_CHANGED:-false}, servers=${SERVER_CHANGED:-false}, other=${OTHER_COUNT:-0}"
echo "Classification: run_full=$run_full, run_servers=$run_servers, docs_only=$docs_only"
119 changes: 119 additions & 0 deletions .github/actions/test-template/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: Test Template
description: Run a Gym CPU or GPU test script in the CI container

inputs:
script:
description: Path to the test script inside the Gym repository
required: true
test-type:
description: Test hardware type (cpu or gpu)
required: true
container-image:
description: Gym container image to use for the test
required: true
test-data-path:
description: Test data path selected by CI pre-flight
required: true

runs:
using: composite
steps:
- name: Run test
id: test
continue-on-error: true
shell: bash -e -u -o pipefail {0}
env:
CONTAINER_IMAGE: ${{ inputs.container-image }}
TEST_DATA_PATH: ${{ inputs.test-data-path }}
TEST_SCRIPT: ${{ inputs.script }}
TEST_TYPE: ${{ inputs.test-type }}
run: |
case "$TEST_TYPE" in
cpu)
gpu_args=()
;;
gpu)
gpu_args=(--runtime=nvidia --gpus all)
;;
*)
echo "Unsupported test type: $TEST_TYPE (expected cpu or gpu)"
exit 1
;;
esac

echo -e "\033[1;34m┌─ launching test ─────────────────────────────────────────────────────────┐\033[0m"
echo -e "\033[1;34m│ script : $TEST_SCRIPT\033[0m"
echo -e "\033[1;34m│ type : $TEST_TYPE\033[0m"
echo -e "\033[1;34m│ container : $CONTAINER_IMAGE\033[0m"
echo -e "\033[1;34m└──────────────────────────────────────────────────────────────────────────┘\033[0m"

docker pull "$CONTAINER_IMAGE"
docker run --rm \
"${gpu_args[@]}" \
--shm-size=64g \
--env TEST_DATA_PATH="$TEST_DATA_PATH" \
--volume "$TEST_DATA_PATH:$TEST_DATA_PATH" \
--entrypoint bash \
"$CONTAINER_IMAGE" \
-e -u -o pipefail "$TEST_SCRIPT"

- name: Report result
if: always()
shell: bash -e -u -o pipefail {0}
env:
CONTAINER_IMAGE: ${{ inputs.container-image }}
TEST_OUTCOME: ${{ steps.test.outcome }}
TEST_SCRIPT: ${{ inputs.script }}
TEST_TYPE: ${{ inputs.test-type }}
run: |
if [[ "$TEST_OUTCOME" == "success" ]]; then
status="PASSED"
symbol="✅"
echo -e "\033[1;32m╔══════════════════════════════════════════════════════════════════════════╗\033[0m"
echo -e "\033[1;32m║ ║\033[0m"
echo -e "\033[1;32m║ ✅ PASSED ║\033[0m"
echo -e "\033[1;32m║ $TEST_SCRIPT\033[0m"
echo -e "\033[1;32m║ ║\033[0m"
echo -e "\033[1;32m╚══════════════════════════════════════════════════════════════════════════╝\033[0m"
else
status="FAILED"
symbol="❌"
echo -e "\033[1;31m╔══════════════════════════════════════════════════════════════════════════╗\033[0m"
echo -e "\033[1;31m║ ║\033[0m"
echo -e "\033[1;31m║ ❌ FAILED ║\033[0m"
echo -e "\033[1;31m║ $TEST_SCRIPT\033[0m"
echo -e "\033[1;31m║ ║\033[0m"
echo -e "\033[1;31m╚══════════════════════════════════════════════════════════════════════════╝\033[0m"
fi

{
echo "### $symbol $TEST_SCRIPT — $status"
echo ""
echo "| Field | Value |"
echo "|---|---|"
echo "| Type | \`$TEST_TYPE\` |"
echo "| Image | \`$CONTAINER_IMAGE\` |"
} >> "$GITHUB_STEP_SUMMARY"

if [[ "$TEST_OUTCOME" == "success" ]]; then
echo "::notice title=Test result::$TEST_SCRIPT — PASSED"
exit 0
fi

echo "::error title=Test result::$TEST_SCRIPT — FAILED"
exit 1
Loading
Loading