-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: Add CodSpeed to follow lib performance
- Loading branch information
Showing
17 changed files
with
290 additions
and
88 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,8 @@ on: | |
- feat/* | ||
- hotfix/* | ||
- main | ||
# Allows CodSpeed to trigger backtest performance analysis in order to generate initial data | ||
workflow_dispatch: | ||
|
||
jobs: | ||
init: | ||
|
@@ -52,7 +54,8 @@ jobs: | |
# Run all test suites | ||
step: | ||
- static | ||
- unit | ||
- unit-simple | ||
- unit-codspeed | ||
# Run on all supported Python versions | ||
python-version: | ||
- "3.11" | ||
|
@@ -103,9 +106,25 @@ jobs: | |
- name: Configure environment variables | ||
run: echo "${{ secrets.DOTENV_UNIT_TESTS }}" > .env | ||
|
||
- name: Run tests | ||
- name: Run test servers (unit) | ||
if: ${{ contains(matrix.step, 'unit') }} | ||
run: make run-test-servers | ||
|
||
- name: Run tests (simple) | ||
if: ${{ !contains(matrix.step, 'codspeed') }} | ||
run: make test-${{ matrix.step }} version_full=${{ needs.init.outputs.VERSION_FULL }} | ||
|
||
- name: Run tests (CodSpeed) | ||
if: ${{ contains(matrix.step, 'codspeed') }} | ||
uses: CodSpeedHQ/[email protected] | ||
with: | ||
token: ${{ secrets.CODSPEED_TOKEN }} | ||
run: make test-${{ matrix.step }} version_full=${{ needs.init.outputs.VERSION_FULL }} | ||
|
||
- name: Kill test servers (unit) | ||
if: ${{ contains(matrix.step, 'unit') }} | ||
run: make kill-test-servers | ||
|
||
- name: Upload artifacts | ||
uses: actions/[email protected] | ||
if: always() | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -291,3 +291,9 @@ test-reports/ | |
# Local .env | ||
!.env.example | ||
.env.* | ||
|
||
# CodSpeed | ||
.codspeed/ | ||
|
||
# Test servers PIDs | ||
*.pid |
This file contains 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 file contains 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 file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import asyncio | ||
from contextlib import suppress | ||
from logging import getLogger | ||
|
||
from playwright.async_api import async_playwright | ||
|
||
CDP_PORT = 9222 | ||
|
||
logger = getLogger(__name__) | ||
|
||
|
||
async def run(): | ||
async with async_playwright() as p: | ||
# Launch Chromium in server mode with CDP enabled | ||
await p.chromium.launch( | ||
args=[ | ||
"--disable-gl-drawing-for-tests", | ||
f"--remote-debugging-port={CDP_PORT}", | ||
], | ||
channel="chromium", | ||
devtools=True, | ||
) | ||
logger.info(f"Chromium running with CDP enabled on localhost:{CDP_PORT}") | ||
|
||
# Wait indefinitely (or until the browser is closed) | ||
await asyncio.Future() | ||
|
||
|
||
if __name__ == "__main__": | ||
with suppress(KeyboardInterrupt): | ||
asyncio.run(run()) |
This file was deleted.
Oops, something went wrong.
This file contains 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 file contains 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 file contains 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 file contains 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 file contains 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
Oops, something went wrong.