Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
56 changes: 56 additions & 0 deletions .github/workflows/flow-pull-request-formatting.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# SPDX-License-Identifier: Apache-2.0
name: "PR Formatting"
on:
pull_request_target:
types:
- assigned
- unassigned
- labeled
- unlabeled
- opened
- reopened
- edited
- converted_to_draft
- ready_for_review
- review_requested
- review_request_removed
- locked
- unlocked
- synchronize

defaults:
run:
shell: bash

permissions:
statuses: write

jobs:
title-check:
name: Title Check
runs-on: hedera-agent-linux-medium
steps:
- name: Harden Runner
uses: step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0
with:
egress-policy: audit

- name: Check PR Title
uses: step-security/conventional-pr-title-action@d47e8818876fa91d2010b65c4d699bb5f0d34d56 # v3.2.3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

assignee-check:
name: Assignee Check
runs-on: hedera-agent-linux-medium
steps:
- name: Harden Runner
uses: step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0
with:
egress-policy: audit

- name: Check Assignee
if: ${{ github.event.pull_request.assignees == null || github.event.pull_request.assignees[0] == null }}
run: |
echo "Assignee is not set. Failing the workflow."
exit 1
28 changes: 28 additions & 0 deletions .github/workflows/pr-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: PR Tests

on:
pull_request:
branches: [ main, "feat/75-tests-ci" ]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
branches: [ main, "feat/75-tests-ci" ]
branches:
- main
- feat/75-tests-ci

Prefer to list out the matrix values.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And will probably need to remove the feat/75-tests-ci branch before merging.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes that branch shouldn't be here, it was here just for testing


permissions:
contents: read

jobs:
unit-tests:
uses: ./.github/workflows/run-unit-tests.yml

integration-tests:
needs: [ unit-tests ]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer to list out the matrix values.

uses: ./.github/workflows/run-integration-tests.yml

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
uses: ./.github/workflows/run-integration-tests.yml
uses: ./.github/workflows/run-integration-tests.yml
with:
e2e-llm-provider: <SOME_VALUE>

secrets:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
LLM_API_KEY: ${{ secrets.OPENAI_API_KEY }}

ACCOUNT_ID: ${{ secrets.ACCOUNT_ID }}
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }}

e2e-tests:
needs: [ integration-tests ]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer to list out the matrix values.

uses: ./.github/workflows/run-e2e-tests.yml

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
uses: ./.github/workflows/run-e2e-tests.yml
uses: ./.github/workflows/run-e2e-tests.yml
with:
e2e-llm-provider: <SOME_VALUE>

secrets:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
LLM_API_KEY: ${{ secrets.OPENAI_API_KEY }}

ACCOUNT_ID: ${{ secrets.ACCOUNT_ID }}
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }}
77 changes: 77 additions & 0 deletions .github/workflows/run-e2e-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Run E2E Tests

on:
workflow_call:
inputs:
workdir:
description: Working directory
required: false
default: 'python'
type: string

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
type: string
type: string
e2e-llm-provider:
description: LLM provider for e2e tests
required: true/false
default: <SOME_VALUE> # please fill this in
type: string

secrets:
OPENAI_API_KEY:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
OPENAI_API_KEY:
LLM_API_KEY:

required: true
ACCOUNT_ID:
required: true
PRIVATE_KEY:
required: true

permissions:
contents: read

jobs:
e2e-tests:
runs-on: hedera-agent-linux-medium
env:
WORKDIR: python
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
LLM_API_KEY: ${{ secrets.OPENAI_API_KEY }}

ACCOUNT_ID: ${{ secrets.ACCOUNT_ID }}
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }}
E2E_LLM_PROVIDER: ${{ vars.E2E_LLM_PROVIDER }}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
E2E_LLM_PROVIDER: ${{ vars.E2E_LLM_PROVIDER }}
E2E_LLM_PROVIDER: ${{ inputs.e2e-llm-provider }}

this needs to be passed in as an input

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, I'll adjust that.
It was done in the same way as we have currently in the agent kit JS repo. Do you think it's worth changing it over there too to keep it consistent? @rbarker-dev

steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@df199fb7be9f65074067a9eb93f12bb4c5547cf2 # v2.13.3
with:
egress-policy: audit

- name: Checkout repository
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
with:
python-version: '3.11'

- name: Upgrade pip
run: pip install --upgrade pip pytest

- name: Install Poetry
uses: snok/install-poetry@76e04a911780d5b312d89783f7b1cd627778900a # v1.4.1
with:
version: 2.2.1
virtualenvs-create: true
virtualenvs-in-project: true
virtualenvs-path: .venv
installer-parallel: true

- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}

- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
working-directory: ${{ inputs.workdir }}
run: poetry install --no-interaction --no-root

- name: Run E2E tests (throttled)
working-directory: ${{ inputs.workdir }}
env:
TEST_DELAY_MS: '8000'
run: |
source .venv/bin/activate
pytest test/e2e/
78 changes: 78 additions & 0 deletions .github/workflows/run-integration-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Run Integration Tests

on:
workflow_call:
inputs:
workdir:
description: Working directory
required: false
default: 'python'
type: string
Comment on lines +6 to +10

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
workdir:
description: Working directory
required: false
default: 'python'
type: string
workdir:
description: Working directory
required: false
default: 'python'
type: string
e2e-llm-provider:
description: LLM Provider for E2E Integration Tests
required: true/false
default: <SOME_VALUE>
type: string

secrets:
OPENAI_API_KEY:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
OPENAI_API_KEY:
LLM_API_KEY:

required: true
ACCOUNT_ID:
required: true
PRIVATE_KEY:
required: true
outputs: {}

permissions:
contents: read

jobs:
integration-tests:
runs-on: hedera-agent-linux-medium
env:
WORKDIR: python
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
LLM_API_KEY: ${{ secrets.OPENAI_API_KEY }}

ACCOUNT_ID: ${{ secrets.ACCOUNT_ID }}
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }}
E2E_LLM_PROVIDER: ${{ vars.E2E_LLM_PROVIDER }}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
E2E_LLM_PROVIDER: ${{ vars.E2E_LLM_PROVIDER }}
E2E_LLM_PROVIDER: ${{ inputs.e2e-llm-provider }}

steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@df199fb7be9f65074067a9eb93f12bb4c5547cf2 # v2.13.3
with:
egress-policy: audit

- name: Checkout repository
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
with:
python-version: '3.11'

- name: Upgrade pip
run: pip install --upgrade pip pytest

- name: Install Poetry
uses: snok/install-poetry@76e04a911780d5b312d89783f7b1cd627778900a # v1.4.1
with:
version: 2.2.1
virtualenvs-create: true
virtualenvs-in-project: true
virtualenvs-path: .venv
installer-parallel: true

- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}

- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
working-directory: ${{ inputs.workdir }}
run: poetry install --no-interaction --no-root

- name: Run integration tests (throttled)
working-directory: ${{ inputs.workdir }}
env:
TEST_DELAY_MS: '8000'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
TEST_DELAY_MS: '8000'
TEST_DELAY_MS: '8000' # <Add a comment for why 8000ms sleep is required>

run: |
source .venv/bin/activate
pytest test/integration/
64 changes: 64 additions & 0 deletions .github/workflows/run-unit-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Run Unit Tests

on:
workflow_call:
inputs:
workdir:
description: Working directory
required: false
default: 'python'
type: string

permissions:
contents: read

jobs:
unit-tests:
runs-on: hedera-agent-linux-medium
env:
WORKDIR: python
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@df199fb7be9f65074067a9eb93f12bb4c5547cf2 # v2.13.3
with:
egress-policy: audit

- name: Checkout repository
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
with:
python-version: '3.11'

- name: Upgrade pip
run: pip install --upgrade pip pytest

- name: Install Poetry
uses: snok/install-poetry@76e04a911780d5b312d89783f7b1cd627778900a # v1.4.1
with:
version: 2.2.1
virtualenvs-create: true
virtualenvs-in-project: true
virtualenvs-path: .venv
installer-parallel: true

- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}

- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
working-directory: ${{ inputs.workdir }}
run: poetry install --no-interaction --no-root

- name: Run tests
working-directory: ${{ inputs.workdir }}
run: |
source .venv/bin/activate
pytest test/unit/
16 changes: 8 additions & 8 deletions python/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading