From 25e957c53543c6ffe03776bb4c7442c0c2384bde Mon Sep 17 00:00:00 2001 From: Kabir Khan Date: Fri, 4 Jul 2025 16:37:31 +0100 Subject: [PATCH] GitHub Actions workflow to run the TCK --- .github/workflows/build-and-test.yml | 3 +- .github/workflows/run-tck.yml | 100 +++++++++++++++++++++++++++ 2 files changed, 102 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/run-tck.yml diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index b16350da6..2b07352fe 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -21,5 +21,6 @@ jobs: java-version: '17' distribution: 'temurin' cache: maven - - name: Build with Maven + - name: Build with Maven and run tests run: mvn -B package --file pom.xml -fae + diff --git a/.github/workflows/run-tck.yml b/.github/workflows/run-tck.yml new file mode 100644 index 000000000..5e4365edc --- /dev/null +++ b/.github/workflows/run-tck.yml @@ -0,0 +1,100 @@ +name: Run TCK + +on: + # Handle all branches for now + push: + branches: + - main + pull_request: + branches: + - main + +env: + # Tag of the TCK + TCK_VERSION: 0.2.3 + # Tells astral-sh/setup-uv@v5 to not need a venv, and instead use system + UV_SYSTEM_PYTHON: 1 + # Version of uv + UV_VERSION: "0.7.19" + +# Only run the latest job +concurrency: + group: '${{ github.workflow }} @ ${{ github.head_ref || github.ref }}' + cancel-in-progress: true + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout a2a-java + uses: actions/checkout@v4 + with: + path: a2a-java + - name: Checkout a2a-tck + uses: actions/checkout@v4 + with: + repository: maeste/a2a-tck + path: a2a-tck + ref: ${{ env.TCK_VERSION }} + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + cache: maven + - name: Install uv + uses: astral-sh/setup-uv@v5 + with: + # Install a specific version of uv. + version: ${{ env.UV_VERSION }} + enable-cache: true + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version-file: "a2a-tck/pyproject.toml" + - name: Install Python requirements + run: uv pip install -e . + working-directory: a2a-tck + - name: Build with Maven, skipping tests + run: mvn -B install -DskipTests + working-directory: a2a-java + - name: Start Quarkus + run: mvn quarkus:dev & + working-directory: a2a-java/tck + - name: Wait for server to start + run: | + URL="http://localhost:9999/.well-known/agent.json" + EXPECTED_STATUS=200 + TIMEOUT=120 + RETRY_INTERVAL=2 + START_TIME=$(date +%s) + + while true; do + # Calculate elapsed time + CURRENT_TIME=$(date +%s) + ELAPSED_TIME=$((CURRENT_TIME - START_TIME)) + + # Check for timeout + if [ "$ELAPSED_TIME" -ge "$TIMEOUT" ]; then + echo "Timeout: Server did not respond with status $EXPECTED_STATUS within $TIMEOUT seconds." + exit 1 + fi + + # Get HTTP status code. || true is to reporting a failure to connect as an error + HTTP_STATUS=$(curl --output /dev/null --silent --write-out "%{http_code}" "$URL") || true + echo "STATUS: ${HTTP_STATUS}" + + # Check if we got the correct status code + if [ "$HTTP_STATUS" -eq "$EXPECTED_STATUS" ]; then + echo "Server is up! Received status $HTTP_STATUS after $ELAPSED_TIME seconds." + exit 0 + fi + + # Wait before retrying + echo "Server not ready (status: $HTTP_STATUS). Retrying in $RETRY_INTERVAL seconds..." + sleep "$RETRY_INTERVAL" + done + + - name: Run TCK + run: ./run_tck.py --category all --sut-url http://localhost:9999 + working-directory: a2a-tck