-
Notifications
You must be signed in to change notification settings - Fork 2
ci: add codspeed benchmarks #104
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 1 commit
bc84125
1cb7ecd
5aead11
bdd9609
35f1402
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,11 +6,11 @@ env: | |
|
|
||
| on: | ||
| push: | ||
| branches: [main, ci/*, dependabot/*, renovate/*] | ||
| branches: [ main, ci/*, dependabot/*, renovate/* ] | ||
| tags: | ||
| - "v*.*.*" | ||
| pull_request: | ||
| branches: [main] | ||
| branches: [ main ] | ||
|
|
||
| concurrency: | ||
| group: ${{ github.head_ref || github.run_id }} | ||
|
|
@@ -57,7 +57,7 @@ jobs: | |
|
|
||
| tests: | ||
| name: 🔬 ${{ matrix.session.job_name }} | ||
| needs: [pre, generate-jobs-tests] | ||
| needs: [ pre, generate-jobs-tests ] | ||
| if: github.ref_type == 'tag' || needs.pre.outputs.should_skip != 'true' | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
|
|
@@ -119,9 +119,42 @@ jobs: | |
| name: test-results-${{ matrix.session.session }} | ||
| path: junit-${{ matrix.session.session }}.xml | ||
|
|
||
| benchmarks: | ||
| name: 📈 Run benchmarks | ||
| needs: [ tests, generate-jobs-tests ] | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v5 | ||
|
|
||
| - name: Pip and nox cache | ||
| id: cache | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: | | ||
| ~/.cache | ||
| key: | ||
| ${{ runner.os }}-benchmarks-${{ env.pythonLocation }}-${{ hashFiles('**/uv.lock') }} }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-benchmarks-${{ env.pythonLocation }} | ||
|
|
||
| - name: Setup mise | ||
| uses: jdx/mise-action@v3 | ||
| with: | ||
| cache: true | ||
| log_level: debug | ||
|
|
||
| - name: Run the benchmarks | ||
| uses: CodSpeedHQ/action@v4 | ||
|
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. security (yaml.github-actions.security.third-party-action-not-pinned-to-commit-sha): An action sourced from a third-party repository on GitHub is not pinned to a full length commit SHA. Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps mitigate the risk of a bad actor adding a backdoor to the action's repository, as they would need to generate a SHA-1 collision for a valid Git object payload. Source: opengrep |
||
| with: | ||
| mode: instrumentation | ||
| run: mise run test:benchmarks | ||
| token: ${{ secrets.CODSPEED_TOKEN }} # optional for public repos | ||
|
|
||
|
|
||
| upload-coverage: | ||
| name: 🆙 Upload Coverage | ||
| needs: [tests, generate-jobs-tests] | ||
| needs: [ tests, generate-jobs-tests ] | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
|
|
@@ -155,7 +188,7 @@ jobs: | |
|
|
||
| upload-test-results: | ||
| name: 📊 Upload test results | ||
| needs: [tests, generate-jobs-tests] | ||
| needs: [ tests, generate-jobs-tests ] | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| matrix: | ||
|
|
@@ -208,6 +241,7 @@ jobs: | |
| - pre | ||
| - tests | ||
| - lint | ||
| - benchmarks | ||
| steps: | ||
| - name: Mark workflow as failed if lint or test did not pass or were cancelled | ||
| if: contains(fromJson('["failure", "cancelled"]'), needs.tests.result) || contains(fromJson('["failure", "cancelled"]'), needs.lint.result) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -192,3 +192,5 @@ mise.local.toml | |
| .windsurf | ||
|
|
||
| CLAUDE.md | ||
|
|
||
| .codspeed | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,94 @@ | ||
| from __future__ import annotations | ||
|
|
||
| from tests.integration.fixtures import ( | ||
| aiosqlite_engine, | ||
| any_query, | ||
| any_session, | ||
| async_engine, | ||
| async_mutation, | ||
| async_query, | ||
| async_session, | ||
| asyncmy_engine, | ||
| asyncpg_engine, | ||
| before_create_all_statements, | ||
| config, | ||
| db_features, | ||
| dialect, | ||
| engine, | ||
| fx_metadata, | ||
| mapper, | ||
| no_session_query, | ||
| postgis_service, | ||
| postgres_database_service, | ||
| psycopg_async_engine, | ||
| psycopg_engine, | ||
| query_tracker, | ||
| raw_arrays, | ||
| raw_colors, | ||
| raw_date_times, | ||
| raw_farms, | ||
| raw_fruits, | ||
| raw_geo, | ||
| raw_geo_flipped, | ||
| raw_groups, | ||
| raw_intervals, | ||
| raw_json, | ||
| raw_topics, | ||
| raw_users, | ||
| seed_db_async, | ||
| seed_db_sync, | ||
| seed_insert_statements, | ||
| session, | ||
| sqlite_engine, | ||
| sync_mutation, | ||
| sync_query, | ||
| ) | ||
|
|
||
| from .fixtures import fx_strawchemy_mysql, fx_strawchemy_postgresql, fx_strawchemy_sqlite | ||
|
|
||
| __all__ = ( | ||
| "aiosqlite_engine", | ||
| "any_query", | ||
| "any_session", | ||
| "async_engine", | ||
| "async_mutation", | ||
| "async_query", | ||
| "async_session", | ||
| "asyncmy_engine", | ||
| "asyncpg_engine", | ||
| "before_create_all_statements", | ||
| "config", | ||
| "db_features", | ||
| "dialect", | ||
| "engine", | ||
| "fx_metadata", | ||
| "fx_strawchemy_mysql", | ||
| "fx_strawchemy_postgresql", | ||
| "fx_strawchemy_sqlite", | ||
| "mapper", | ||
| "no_session_query", | ||
| "postgis_service", | ||
| "postgres_database_service", | ||
| "psycopg_async_engine", | ||
| "psycopg_engine", | ||
| "query_tracker", | ||
| "raw_arrays", | ||
| "raw_colors", | ||
| "raw_date_times", | ||
| "raw_farms", | ||
| "raw_fruits", | ||
| "raw_geo", | ||
| "raw_geo_flipped", | ||
| "raw_groups", | ||
| "raw_intervals", | ||
| "raw_json", | ||
| "raw_topics", | ||
| "raw_users", | ||
| "seed_db_async", | ||
| "seed_db_sync", | ||
| "seed_insert_statements", | ||
| "session", | ||
| "sqlite_engine", | ||
| "sync_mutation", | ||
| "sync_query", | ||
| ) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| from __future__ import annotations | ||
|
|
||
| import pytest | ||
| from strawchemy import Strawchemy | ||
|
|
||
|
|
||
| @pytest.fixture(name="strawchemy_postgresql") | ||
| def fx_strawchemy_postgresql() -> Strawchemy: | ||
| return Strawchemy("postgresql") | ||
|
|
||
|
|
||
| @pytest.fixture(name="strawchemy_sqlite") | ||
| def fx_strawchemy_sqlite() -> Strawchemy: | ||
| return Strawchemy("sqlite") | ||
|
|
||
|
|
||
| @pytest.fixture(name="strawchemy_mysql") | ||
| def fx_strawchemy_mysql() -> Strawchemy: | ||
| return Strawchemy("mysql") |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| from __future__ import annotations | ||
|
|
||
| from typing import TYPE_CHECKING | ||
|
|
||
| import pytest | ||
| from pytest_lazy_fixtures import lf | ||
|
|
||
| from tests.integration.models import User | ||
|
|
||
| if TYPE_CHECKING: | ||
| from strawchemy import Strawchemy | ||
|
|
||
|
|
||
| @pytest.mark.benchmark(group="schema") | ||
| @pytest.mark.parametrize("strawchemy", [lf("strawchemy_postgresql"), lf("strawchemy_sqlite"), lf("strawchemy_mysql")]) | ||
| def test_build_user_type(strawchemy: Strawchemy) -> None: | ||
| strawchemy.type(User, include="all", override=True)(type("UserType", (), {})) |
Uh oh!
There was an error while loading. Please reload this page.