Add Step-02 example agent: add a shell execution tool #3100
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow uses actions that are not certified by GitHub. | |
# They are provided by a third-party and are governed by | |
# separate terms of service, privacy policy, and support | |
# documentation. | |
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle | |
name: Checks | |
on: | |
push: | |
branches: [ "main", "develop" ] | |
pull_request: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
# Cancel only when the run is not on main or develop | |
cancel-in-progress: ${{ github.ref != 'refs/heads/main' || github.ref != 'refs/heads/develop' }} | |
env: | |
JAVA_VERSION: 17 | |
JAVA_DISTRIBUTION: 'corretto' | |
jobs: | |
compilation: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
steps: | |
- name: Configure Git | |
run: | | |
git config --global core.autocrlf input | |
- uses: actions/checkout@v5 | |
- name: Set up JDK ${{ env.JAVA_VERSION }} | |
uses: actions/setup-java@v5 | |
with: | |
java-version: ${{ env.JAVA_VERSION }} | |
distribution: ${{ env.JAVA_DISTRIBUTION }} | |
# Configure Gradle for optimal use in GitHub Actions, including caching of downloaded dependencies. | |
# See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v4 | |
- name: Assemble with Gradle Wrapper | |
run: ./gradlew assemble ktlintCheck | |
- name: TestClasses with Gradle Wrapper | |
run: ./gradlew jvmTestClasses jsTestClasses | |
docs: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
steps: | |
- name: Configure Git | |
run: | | |
git config --global core.autocrlf input | |
- uses: actions/checkout@v5 | |
# Using setup-python on CI to install Python might be faster than with uv (official uv recommendation) | |
- name: Set up Python | |
uses: actions/setup-python@v6 | |
with: | |
python-version-file: "./docs/.python-version" | |
- name: Install uv | |
uses: astral-sh/setup-uv@v6 | |
with: | |
version: "0.8.15" | |
enable-cache: true | |
- name: Build docs | |
working-directory: ./docs | |
run: | | |
uv sync --frozen --all-extras | |
uv run mkdocs build | |
tests: | |
runs-on: ${{ matrix.os }} | |
permissions: | |
contents: read | |
strategy: | |
matrix: | |
os: [ ubuntu-latest, windows-latest, macos-latest ] | |
steps: | |
- name: Configure Git | |
run: | | |
git config --global core.autocrlf input | |
- uses: actions/checkout@v5 | |
- name: Set up JDK ${{ env.JAVA_VERSION }} | |
uses: actions/setup-java@v5 | |
with: | |
java-version: ${{ env.JAVA_VERSION }} | |
distribution: ${{ env.JAVA_DISTRIBUTION }} | |
# Configure Gradle for optimal use in GitHub Actions, including caching of downloaded dependencies. | |
# See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v4 | |
- name: JvmTest with Gradle Wrapper and Kover coverage | |
if: matrix.os == 'ubuntu-latest' | |
run: |- | |
./gradlew jvmTest :koverBinaryReport --continue | |
- name: Check Split Packages | |
if: matrix.os == 'ubuntu-latest' && github.event.pull_request.draft == false | |
run: |- | |
./gradlew jvmJar && ./gradlew checkSplitPackages | |
- name: JvmTest with Gradle Wrapper | |
if: matrix.os != 'ubuntu-latest' | |
run: ./gradlew jvmTest --continue | |
- name: iosSimulatorArm64Test with Gradle Wrapper | |
if: matrix.os == 'macos-latest' && github.event.pull_request.draft == false && github.repository == 'jetbrains/koog' | |
run: ./gradlew linkIosSimulatorArm64 iosSimulatorArm64Test --continue | |
- name: Archive coverage data | |
if: matrix.os == 'ubuntu-latest' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: gradle-coverage-data.zip | |
path: .qodana/code-coverage | |
- name: Collect reports | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: reports-${{ matrix.os }} | |
path: | | |
**/build/reports/ | |
- name: Publish Test Report | |
uses: mikepenz/action-junit-report@v5 | |
if: ${{ !cancelled() }} # always run even if the previous step fails | |
with: | |
report_paths: '**/test-results/**/TEST-*.xml' | |
detailed_summary: true | |
flaky_summary: true | |
include_empty_in_summary: false | |
include_time_in_summary: true | |
annotate_only: true | |
qodana: | |
needs: [ tests ] | |
if: github.repository == 'jetbrains/koog' | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
pull-requests: write | |
checks: write | |
steps: | |
- uses: actions/checkout@v5 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} # to check out the actual pull request commit, not the merge commit | |
fetch-depth: 0 # a full history is required for pull request analysis | |
persist-credentials: false # https://github.com/orgs/community/discussions/151365 | |
# Add Java setup step | |
- name: Set up JDK ${{ env.JAVA_VERSION }} | |
uses: actions/setup-java@v5 | |
with: | |
java-version: ${{ env.JAVA_VERSION }} | |
distribution: ${{ env.JAVA_DISTRIBUTION }} | |
# Download the coverage data artifact | |
- name: Download coverage data | |
uses: actions/download-artifact@v4 | |
with: | |
name: gradle-coverage-data.zip | |
path: .qodana/code-coverage | |
- name: 'Qodana Scan' | |
uses: JetBrains/[email protected] | |
with: | |
pr-mode: false | |
args: --baseline,qodana.sarif.json | |
use-caches: true | |
cache-default-branch-only: true | |
env: | |
QODANA_TOKEN: ${{ secrets.QODANA_TOKEN_1399872884 }} | |
QODANA_ENDPOINT: 'https://qodana.cloud' | |
knit: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v5 | |
- uses: actions/setup-java@v5 | |
with: | |
distribution: ${{ env.JAVA_DISTRIBUTION }} | |
java-version: ${{ env.JAVA_VERSION }} | |
- uses: gradle/actions/setup-gradle@v4 | |
- name: Generate and verify code examples | |
run: | | |
echo "Starting knit generation..." | |
FILES_BEFORE_KNIT=$(find docs/src/ -name "*.kt" 2>/dev/null | wc -l || echo "0") | |
echo "Files before knit: $FILES_BEFORE_KNIT" | |
./gradlew :docs:knit | |
FILES_AFTER_KNIT=$(find docs/src/ -name "*.kt" 2>/dev/null | wc -l || echo "0") | |
echo "Files after knit: $FILES_AFTER_KNIT" | |
KNIT_GENERATED_FILES=$((FILES_AFTER_KNIT - FILES_BEFORE_KNIT)) | |
echo "Knit generated $KNIT_GENERATED_FILES files" | |
echo "Starting assemble..." | |
./gradlew :docs:assemble | |
dokka: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
steps: | |
- uses: actions/checkout@v5 | |
- name: Set up JDK ${{ env.JAVA_VERSION }} | |
uses: actions/setup-java@v5 | |
with: | |
java-version: ${{ env.JAVA_VERSION }} | |
distribution: 'temurin' | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v4 | |
- name: Verify Dokka | |
run: ./gradlew dokkaGenerate |