Skip to content
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

Fix(ci): testing workflow and pre-commit #10

Merged
merged 8 commits into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 0 additions & 21 deletions .github/workflows/lint.yml

This file was deleted.

14 changes: 14 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: pre-commit

on:
pull_request:
push:
branches: [main]

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- uses: pre-commit/[email protected]
25 changes: 17 additions & 8 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:

jobs:
test:
name: Test on ${{ matrix.os }} with Python ${{ matrix.python-version }}
runs-on: "${{ matrix.os }}"
defaults:
run:
Expand All @@ -21,17 +22,25 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: Setup Micromamba
uses: mamba-org/provision-with-micromamba@main
with:
python_version: ${{ matrix.python_version }}
cache-downloads: true
cache-env: true
environment-file: ./environment.yml
fetch-depth: 0

- name: Setup MiniConda
uses: conda-incubator/setup-miniconda@v3
with:
activate-environment: cht_cyclones
auto-update-conda: true
channels: conda-forge

- name: Create environment
shell: bash -el {0}
run: |
conda create -n cht_cyclones python=${{ matrix.python-version }} -y

- name: Install test dependencies
run: |
pip install -e ".[tests]"
conda run -n cht_cyclones pip install -e ".[tests]"

- name: Test with pytest
run: |
pytest tests
conda run -n cht_cyclones pytest tests
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ dmypy.json
# Cython debug symbols
cython_debug/

# Ruff
# Ruff
.ruff_cache/
# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
Expand Down
24 changes: 24 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: check-case-conflict
- id: trailing-whitespace
- id: check-toml
- id: check-merge-conflict
- id: check-added-large-files
- id: check-merge-conflict
- id: trailing-whitespace
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.5
hooks:
- id: ruff
args: ['--fix', --exit-non-zero-on-fix]
- id: ruff-format

- repo: https://github.com/crate-ci/typos
rev: v1.23.6
hooks:
- id: typos
2 changes: 2 additions & 0 deletions .typos.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[default.extend-words]
# Ignore false-positives
waring = "waring"
fo = "fo"
pn = "pn"
2 changes: 1 addition & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
"charliermarsh.ruff",
"ms-python.black-formatter"
]
}
}
15 changes: 11 additions & 4 deletions cht_cyclones/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,14 @@

__version__ = "1.0.2"

from .tropical_cyclone_refactored import TropicalCyclone
from .track_database import CycloneTrackDatabase
from .track_dataset import CycloneTrackDataset
from .track_selector import track_selector
from cht_cyclones.track_database import CycloneTrackDatabase
from cht_cyclones.track_dataset import CycloneTrackDataset
from cht_cyclones.track_selector import track_selector
from cht_cyclones.tropical_cyclone_refactored import TropicalCyclone

__all__ = [
"CycloneTrackDatabase",
"CycloneTrackDataset",
"track_selector",
"TropicalCyclone",
]
Loading
Loading