-
Notifications
You must be signed in to change notification settings - Fork 5
feat: add CI workflow for unit, integration and e2e tests #117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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 |
| 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" ] | ||||||||||
|
|
||||||||||
| permissions: | ||||||||||
| contents: read | ||||||||||
|
|
||||||||||
| jobs: | ||||||||||
| unit-tests: | ||||||||||
| uses: ./.github/workflows/run-unit-tests.yml | ||||||||||
|
|
||||||||||
| integration-tests: | ||||||||||
| needs: [ unit-tests ] | ||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
| secrets: | ||||||||||
| OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | ||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
| ACCOUNT_ID: ${{ secrets.ACCOUNT_ID }} | ||||||||||
| PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} | ||||||||||
|
|
||||||||||
| e2e-tests: | ||||||||||
| needs: [ integration-tests ] | ||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
| secrets: | ||||||||||
| OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | ||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
| ACCOUNT_ID: ${{ secrets.ACCOUNT_ID }} | ||||||||||
| PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} | ||||||||||
| 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 | ||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||
| secrets: | ||||||||||||||||
| OPENAI_API_KEY: | ||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||
| 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 }} | ||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||
| ACCOUNT_ID: ${{ secrets.ACCOUNT_ID }} | ||||||||||||||||
| PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} | ||||||||||||||||
| E2E_LLM_PROVIDER: ${{ vars.E2E_LLM_PROVIDER }} | ||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
this needs to be passed in as an input
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sure, I'll adjust that. |
||||||||||||||||
| 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/ | ||||||||||||||||
| 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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||||
| secrets: | ||||||||||||||||||||||||||||||||
| OPENAI_API_KEY: | ||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||||
| 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 }} | ||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||||
| ACCOUNT_ID: ${{ secrets.ACCOUNT_ID }} | ||||||||||||||||||||||||||||||||
| PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} | ||||||||||||||||||||||||||||||||
| E2E_LLM_PROVIDER: ${{ vars.E2E_LLM_PROVIDER }} | ||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||||
| 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' | ||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||
| source .venv/bin/activate | ||||||||||||||||||||||||||||||||
| pytest test/integration/ | ||||||||||||||||||||||||||||||||
| 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/ |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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-cibranch before merging.There was a problem hiding this comment.
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