Skip to content

Commit

Permalink
Merge pull request #1 from andnp/main
Browse files Browse the repository at this point in the history
chore: setup project infrastructure
  • Loading branch information
panahiparham authored Sep 5, 2024
2 parents 3d7ae97 + 458d10c commit 2d8f6be
Show file tree
Hide file tree
Showing 8 changed files with 234 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file

version: 2
updates:
- package-ecosystem: "pip" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"

groups:
python-deps:
applies-to: version-updates
patterns:
- "*"
41 changes: 41 additions & 0 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Benchmark
on:
push:
branches:
- main

permissions:
contents: write
deployments: write

jobs:
benchmark:
name: Run pytest-benchmark
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: "3.11"
cache: 'pip'

- name: Run benchmark
run: |
python -m venv .venv
source .venv/bin/activate
pip install uv
uv pip compile --extra=dev pyproject.toml -o requirements.txt
uv pip sync requirements.txt
echo PATH=$PATH >> $GITHUB_ENV
pytest --benchmark-json output.json
- name: Store benchmark result
uses: benchmark-action/github-action-benchmark@v1
with:
name: Python Benchmark with pytest-benchmark
tool: 'pytest'
output-file-path: output.json
github-token: ${{ secrets.GITHUB_TOKEN }}
auto-push: true
40 changes: 40 additions & 0 deletions .github/workflows/pr_benchmark.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Benchmark
on:
pull_request:
branches: [ main ]

jobs:
benchmark:
name: Run pytest-benchmark
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: "3.11"
cache: 'pip'

- name: Run benchmark
run: |
python -m venv .venv
source .venv/bin/activate
pip install uv
uv pip compile --extra=dev pyproject.toml -o requirements.txt
uv pip sync requirements.txt
echo PATH=$PATH >> $GITHUB_ENV
pytest --benchmark-json output.json
- name: Store benchmark result
uses: benchmark-action/github-action-benchmark@v1
with:
name: Python Benchmark with pytest-benchmark
tool: 'pytest'
output-file-path: output.json
github-token: ${{ secrets.GITHUB_TOKEN }}
alert-threshold: '130%'
comment-on-alert: true
summary-always: true
fail-on-alert: true
alert-comment-cc-users: '@andnp'
32 changes: 32 additions & 0 deletions .github/workflows/style.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Style

on:
pull_request:
branches: [ main ]

jobs:
check:
runs-on: ubuntu-latest
steps:
# setup the repository
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
cache: 'pip'

- run: |
python -m venv .venv
source .venv/bin/activate
pip install uv
uv pip compile --extra=dev pyproject.toml -o requirements.txt
uv pip sync requirements.txt
- run: echo "$PWD/.venv/bin" >> $GITHUB_PATH

# linting
- uses: chartboost/ruff-action@v1

# type checking
- uses: jakebailey/pyright-action@v2
with:
pylance-version: latest-release
43 changes: 43 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: PR Tests

on:
pull_request:
branches: [ main ]

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ["3.10", "3.11", "3.12"]

steps:
# setup the repository
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'

- run: |
python -m venv .venv
source .venv/bin/activate
pip install uv
uv pip compile --extra=dev pyproject.toml -o requirements.txt
uv pip sync requirements.txt
- run: echo "$PWD/.venv/bin" >> $GITHUB_PATH

- run: pytest tests/ --junitxml=junit/test-results-${{ matrix.os }}-${{ matrix.python-version }}.xml --cov=recommence --cov-report=html:coverage/cov-${{ matrix.os }}-${{ matrix.python-version }}.html

- name: Upload pytest test results
uses: actions/upload-artifact@v4
with:
name: pytest-results-${{ matrix.os }}-${{ matrix.python-version }}
path: |
junit/test-results-${{ matrix.os }}-${{ matrix.python-version }}.xml
coverage/cov-${{ matrix.os }}-${{ matrix.python-version }}.html
# Use always() to always run this step to publish test results when there are test failures
if: ${{ always() }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
requirements.txt
.python-version
13 changes: 13 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
repos:
- repo: https://github.com/commitizen-tools/commitizen
rev: v2.21.2
hooks:
- id: commitizen
stages:
- commit-msg
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.2.2
hooks:
# Run the linter.
- id: ruff
46 changes: 46 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
[tool]
[tool.commitizen]
name = "cz_conventional_commits"
version = "0.0.0"
tag_format = "$version"
version_files = ["pyproject.toml"]

[tool.ruff.lint]
select = ['F', 'E', 'W', 'B']
ignore = ['E501', 'E701']

[tool.pyright]
include = ['ml-experiment-definition']
venvPath = '.'
venv = '.venv'
typeCheckingMode = 'standard'
useLibraryCodeForTypes = true

[project]
name = "ml-experiment-definition"
version = "0.0.0"
description = ""
authors = [
{name = "Parham Panahi", email = "[email protected]"},
{name = "Andy Patterson", email = "[email protected]"},
]
dependencies = []
requires-python = ">=3.10,<3.13"
readme = "README.md"
license = {text = "MIT"}

classifiers = [
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
]

[project.optional-dependencies]
dev = [
"pip",
"ruff",
"pytest",
"pytest-cov",
"pyright",
"commitizen",
"pre-commit",
]

0 comments on commit 2d8f6be

Please sign in to comment.