diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..4fc5448 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,39 @@ +name: Build + +on: + # push: + # branches: [main] + # pull_request: + # branches: [main] + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [3.12] + + # Skip CI if 'skip ci' is in the latest commit message (only relevant for push/pull_request triggers) + # if: "!contains(github.event.head_commit.message, 'skip ci')" + # Will add back on skipping for draft PRs too. + # if: | + # !contains(github.event.head_commit.message, 'skip ci') && + # (github.event_name != 'pull_request' || !github.event.pull_request.draft) + + steps: + - uses: actions/checkout@v6 + + - name: Setup UV and python version + uses: astral-sh/setup-uv@v7 + with: + version: "0.10.6" + python-version: ${{ matrix.python-version }} + + - name: Install dependencies + run: uv sync --group dev + + - name: Run tests + env: + TEST_DATA_DIR: ${{ github.workspace }}/tests/test_files + run: uv run pytest tests/ --cov=src --cov-report=html --cov-report=term-missing --cov-fail-under=80 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..d08821d --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,45 @@ +name: Lint + +on: + # pull_request: + # branches: [main] + workflow_dispatch: + +jobs: + ruff: + runs-on: ubuntu-latest + permissions: + contents: write + + steps: + - uses: actions/checkout@v6 + with: + ref: ${{ github.head_ref }} + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Install ruff + run: pip install ruff + + - name: Auto-fix with ruff + run: | + ruff check --fix . + ruff format . + + - name: Commit ruff fixes + uses: stefanzweifel/git-auto-commit-action@v5 + with: + commit_message: "Auto-commit ruff fixes [skip ci]" + commit_username: "Autoformatter" + commit_email: "actions@github.com" + + ty: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v6 + + - name: Setup UV and python version + uses: astral-sh/setup-uv@v7 + + - name: Run ty + run: uvx ty check src/ diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..65fd394 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,18 @@ +repos: + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.15.0 + hooks: + # Run the linter. + - id: ruff-check + args: [--verbose, --fix] + # Run the formatter. + - id: ruff-format + args: [--verbose] + + - repo: local + hooks: + - id: ty + name: ty check + entry: uv run ty check + language: system + types: [python] \ No newline at end of file