name: AI Engine CI on: push: branches: [main] pull_request: jobs: engine: runs-on: ubuntu-latest permissions: contents: read pull-requests: write steps: - name: Checkout code uses: actions/checkout@v4 - name: Install uv uses: astral-sh/setup-uv@v4 with: enable-cache: true - name: Set up JDK 25 uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0 with: java-version: "25" distribution: "temurin" - name: Setup Gradle uses: gradle/actions/setup-gradle@f29f5a9d7b09a7c6b29859002d29d24e1674c884 # v5.0.1 with: gradle-version: 9.3.1 - name: Install Task uses: go-task/setup-task@3be4020d41929789a01026e0e427a4321ce0ad44 # v2.0.0 - name: Regenerate tool models run: task engine:tool-models - name: Verify tool models are up to date run: | if ! git diff --exit-code engine/src/stirling/models/tool_models.py; then echo "tool_models.py is out of date." echo "Run 'task engine:tool-models' locally and commit the updated file." exit 1 fi - name: Run fixers run: task engine:fix - name: Verify fixes are committed id: fixer_changes run: | if ! git diff --quiet; then git --no-pager diff --stat echo "::error::There are issues with your Python code that will need to be fixed before they can be merged in. Run 'task engine:fix' to auto-fix what can be fixed automatically, then run 'task engine:check' to see what still needs fixing manually." exit 1 fi - name: Comment on fixer failures if: steps.fixer_changes.outcome == 'failure' && github.event_name == 'pull_request' continue-on-error: true uses: actions/github-script@v7 with: script: | const marker = ''; const body = [ marker, '### Engine Check Failed', '', 'There are issues with your Python code that will need to be fixed before they can be merged in.', '', 'Run `task engine:fix` to auto-fix what can be fixed automatically, then run `task engine:check` to see what still needs fixing manually.', ].join('\n'); const { data: comments } = await github.rest.issues.listComments({ owner: context.repo.owner, repo: context.repo.repo, issue_number: context.issue.number, }); const existing = comments.find(c => c.body.includes(marker)); if (existing) { await github.rest.issues.updateComment({ owner: context.repo.owner, repo: context.repo.repo, comment_id: existing.id, body, }); } else { await github.rest.issues.createComment({ owner: context.repo.owner, repo: context.repo.repo, issue_number: context.issue.number, body, }); } - name: Run linting run: task engine:lint - name: Run type checking run: task engine:typecheck - name: Run tests run: task engine:test