Skip to content

Commit

Permalink
ci: add pre-commit (#56)
Browse files Browse the repository at this point in the history
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
Glatzel and pre-commit-ci[bot] authored Oct 28, 2024
1 parent fa5b4b1 commit d875070
Show file tree
Hide file tree
Showing 19 changed files with 39 additions and 25 deletions.
8 changes: 4 additions & 4 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ coverage:
patch:
default:
target: 100%

comment:
behavior: new

component_management:
default_rules:
statuses:
Expand All @@ -18,9 +18,9 @@ component_management:
individual_components:
- component_id: arithmetic
name: arithmetic
paths:
paths:
- src/arithmetic/**
- component_id: audio
name: audio
paths:
paths:
- src/audio/**
9 changes: 3 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,12 @@ concurrency:
cancel-in-progress: true

jobs:
ruff-lint:
uses: Glatzel/py-template/.github/workflows/lint.yml@main

pytest-audio:
uses: Glatzel/py-template/.github/workflows/pytest.yml@main
strategy:
matrix:
os: [windows-latest]
with:
with:
name: test
machine: ${{matrix.os}}
pixi_python_env: audio
Expand All @@ -38,13 +35,13 @@ jobs:
test_args: --benchmark-max-time=0.00005 --benchmark-min-rounds=1 --benchmark-histogram=histogram/audio
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

pytest-arithmetic:
uses: Glatzel/py-template/.github/workflows/pytest.yml@main
strategy:
matrix:
os: [windows-latest]
with:
with:
name: test
machine: ${{matrix.os}}
pixi_python_env: arithmetic-cpu
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update-lockfile.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: update-lockfile
permissions:
permissions:
contents: write
pull-requests: write

Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ histogram
report.html
temp
draft
.coverage
.coverage
16 changes: 16 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-toml
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.7.1
hooks:
# Run the linter.
- id: ruff
# Run the formatter.
- id: ruff-format
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
[![Pixi Badge](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/prefix-dev/pixi/main/assets/badge/v0.json)](https://pixi.sh)
![Actions status](https://github.com/Glatzel/py-bench/actions/workflows/ci.yml/badge.svg?branch=main)
[![codecov](https://codecov.io/gh/Glatzel/py-bench/graph/badge.svg?token=B506P0V1BJ)](https://codecov.io/gh/Glatzel/py-bench)
[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/Glatzel/py-bench/main.svg)](https://results.pre-commit.ci/latest/github/Glatzel/py-bench/main)
2 changes: 1 addition & 1 deletion bench/arithmetic/broadcast1.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Set-Location $PSScriptRoot
Set-Location ..
Set-Location ..
pixi run -e arithmetic-gpu pytest "./src/arithmetic/test_broadcast1.py" --benchmark-autosave --benchmark-histogram=histogram/
pixi run -e arithmetic-gpu pytest "./src/arithmetic/test_broadcast1.py" --benchmark-autosave --benchmark-histogram=histogram/
2 changes: 1 addition & 1 deletion bench/arithmetic/broadcast2.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Set-Location $PSScriptRoot
Set-Location ..
Set-Location ..
pixi run -e arithmetic-gpu pytest "./src/arithmetic/test_broadcast2.py" --benchmark-autosave --benchmark-histogram=histogram/
pixi run -e arithmetic-gpu pytest "./src/arithmetic/test_broadcast2.py" --benchmark-autosave --benchmark-histogram=histogram/
2 changes: 1 addition & 1 deletion bench/arithmetic/datum_compense_loop.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Set-Location $PSScriptRoot
Set-Location ..
Set-Location ..
pixi run -e arithmetic-gpu pytest "./src/arithmetic/test_datum_compense_loop.py" --benchmark-autosave --benchmark-histogram=histogram/
pixi run -e arithmetic-gpu pytest "./src/arithmetic/test_datum_compense_loop.py" --benchmark-autosave --benchmark-histogram=histogram/
2 changes: 1 addition & 1 deletion bench/arithmetic/datum_compense_vector.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Set-Location $PSScriptRoot
Set-Location ..
Set-Location ..
pixi run -e arithmetic-gpu pytest "./src/arithmetic/test_datum_compense_vector.py" --benchmark-autosave --benchmark-histogram=histogram/
pixi run -e arithmetic-gpu pytest "./src/arithmetic/test_datum_compense_vector.py" --benchmark-autosave --benchmark-histogram=histogram/
2 changes: 1 addition & 1 deletion bench/arithmetic/fft.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Set-Location $PSScriptRoot
Set-Location ..
Set-Location ..
pixi run -e arithmetic-gpu pytest "./src/arithmetic/test_fft.py" --benchmark-autosave --benchmark-histogram=histogram/
pixi run -e arithmetic-gpu pytest "./src/arithmetic/test_fft.py" --benchmark-autosave --benchmark-histogram=histogram/
2 changes: 1 addition & 1 deletion bench/audio/amplitude_to_db.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Set-Location $PSScriptRoot
Set-Location ..
Set-Location ..
pixi run -e audio pytest "./src/audio/test_amplitude_to_db.py" --benchmark-autosave --benchmark-histogram=histogram/audio
pixi run -e audio pytest "./src/audio/test_amplitude_to_db.py" --benchmark-autosave --benchmark-histogram=histogram/audio
2 changes: 1 addition & 1 deletion bench/audio/audio_load.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Set-Location $PSScriptRoot
Set-Location ..
Set-Location ..
pixi run -e audio pytest "./src/audio/audio_load*.ps1" --benchmark-autosave --benchmark-histogram=histogram/audio
pixi run -e audio pytest "./src/audio/audio_load*.ps1" --benchmark-autosave --benchmark-histogram=histogram/audio
2 changes: 1 addition & 1 deletion bench/audio/channel_merge.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Set-Location $PSScriptRoot
Set-Location ..
Set-Location ..
pixi run -e audio pytest "./src/audio/test_channel_merge.py" --benchmark-autosave --benchmark-histogram=histogram/audio
pixi run -e audio pytest "./src/audio/test_channel_merge.py" --benchmark-autosave --benchmark-histogram=histogram/audio
2 changes: 1 addition & 1 deletion bench/audio/stft.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Set-Location $PSScriptRoot
Set-Location ..
Set-Location ..
pixi run -e audio pytest "./src/audio/test_stft" --benchmark-autosave --benchmark-histogram=histogram/audio
pixi run -e audio pytest "./src/audio/test_stft" --benchmark-autosave --benchmark-histogram=histogram/audio
2 changes: 1 addition & 1 deletion scripts/download_extra_audio.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ Set-Location $PSScriptRoot
Set-Location ..
aria2c -c -x16 -s16 -d "./external/Vision of Her" `
"http://download.oppodigital.com/hra/davidelias/03%20-%20David%20Elias%20-%20The%20Window%20-%20Vision%20of%20Her%20%2824-88.2%29.flac" `
-o "24-88.flac"
-o "24-88.flac"
2 changes: 1 addition & 1 deletion scripts/init_pixi_env.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ Set-Location $PSScriptRoot
Set-Location ..
pixi clean
pixi update
pixi install --all
pixi install --all
2 changes: 1 addition & 1 deletion scripts/ruff.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Set-Location $PSScriptRoot
Set-Location ..
pixi run ruff format
pixi run ruff check --fix
pixi run ruff check --fix
2 changes: 1 addition & 1 deletion scripts/test.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ pixi run pytest "./src" `
--benchmark-max-time=0.00005 `
--benchmark-min-rounds=1 `
--benchmark-histogram=histogram/audio `
--cov --cov-report=html
--cov --cov-report=html

0 comments on commit d875070

Please sign in to comment.