Skip to content

Commit

Permalink
cicd: add actions
Browse files Browse the repository at this point in the history
  • Loading branch information
dynobo committed Jun 24, 2024
1 parent eb761bf commit f511ee0
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 0 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Test
on: [push, pull_request]

concurrency:
group: cicd-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
name: Test
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: pip install '.[dev]'
- name: Format
run: ruff format --check .
- name: Lint
run: ruff check .
- name: Type
run: mypy
- name: Test
run: pytest
- name: Upload test charts
if: always()
uses: actions/upload-artifact@v4
with:
name: test-charts
path: tests/*.jpg
if-no-files-found: warn
retention-days: 14
publish:
name: Build & Publish
needs: test
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
permissions:
# Used to authenticate to PyPI via OIDC.
# Used to sign the release's artifacts with sigstore-python.
id-token: write
# Used to attach signing artifacts to the published release.
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.9"
- name: Install build deps
run: pip install --upgrade build
- name: Build Python package
run: python -m build
- name: Publish to PyPi
uses: pypa/gh-action-pypi-publish@release/v1
with:
verbose: true
print-hash: true
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ classifiers = [
]
dependencies = ["matplotlib", "numpy", "scipy", "statsmodels"]
optional-dependencies = { dev = [
"build",
"linearmodels",
"mypy",
"notebook",
Expand All @@ -48,6 +49,8 @@ files = ["lmdiag/**/*.py", "tests/**/*.py"]
exclude = ["build/"]
follow_imports = "skip"
ignore_missing_imports = true
# ONHOLD: Remove cache_dir once https://github.com/python/mypy/issues/17396 is fixed
cache_dir = "/dev/null"

[tool.ruff]
target-version = "py39"
Expand Down

0 comments on commit f511ee0

Please sign in to comment.