Skip to content

Commit c69995f

Browse files
committed
Files Added
.github/workflows/ ├── ci.yml # Tests on Python 3.10-3.13, lint, format check ├── release.yml # Publish to PyPI on tags (v*) └── docs.yml # Deploy docs to GitHub Pages on push to main CONTRIBUTING.md # Simple dev setup guide Workflow Summary ┌──────────┬────────────────────────┬──────────────────────────────────────────────┐ │ Workflow │ Trigger │ Action │ ├──────────┼────────────────────────┼──────────────────────────────────────────────┤ │ CI │ Push/PR to main │ Run tests, lint, format check │ ├──────────┼────────────────────────┼──────────────────────────────────────────────┤ │ Release │ Tag v* │ Build & publish to PyPI (trusted publishing) │ ├──────────┼────────────────────────┼──────────────────────────────────────────────┤ │ Docs │ Push to main / release │ Build & deploy to GitHub Pages │ └──────────┴────────────────────────┴──────────────────────────────────────────────┘ Setup Required on GitHub 1. PyPI Trusted Publishing: Go to PyPI → Your Project → Publishing → Add GitHub as trusted publisher 2. GitHub Pages: Settings → Pages → Source: "Deploy from a branch" → Branch: gh-pages 3. Codecov (optional): Add CODECOV_TOKEN secret if you want coverage reports
1 parent 0766a08 commit c69995f

File tree

4 files changed

+150
-0
lines changed

4 files changed

+150
-0
lines changed

.github/workflows/ci.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
python-version: ["3.10", "3.11", "3.12", "3.13"]
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Install uv
20+
uses: astral-sh/setup-uv@v4
21+
22+
- name: Set up Python ${{ matrix.python-version }}
23+
run: uv python install ${{ matrix.python-version }}
24+
25+
- name: Install dependencies
26+
run: uv sync --extra dev
27+
28+
- name: Lint
29+
run: uv run ruff check .
30+
31+
- name: Format check
32+
run: uv run ruff format --check .
33+
34+
- name: Test
35+
run: uv run pytest --cov=xarray_plotly --cov-report=xml
36+
37+
- name: Upload coverage
38+
uses: codecov/codecov-action@v4
39+
if: matrix.python-version == '3.12'
40+
with:
41+
token: ${{ secrets.CODECOV_TOKEN }}
42+
fail_ci_if_error: false

.github/workflows/docs.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Docs
2+
3+
on:
4+
push:
5+
branches: [main]
6+
release:
7+
types: [published]
8+
9+
permissions:
10+
contents: write
11+
12+
jobs:
13+
docs:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Install uv
20+
uses: astral-sh/setup-uv@v4
21+
22+
- name: Install dependencies
23+
run: uv sync --extra docs
24+
25+
- name: Build docs
26+
run: uv run mkdocs build
27+
28+
- name: Deploy to GitHub Pages
29+
uses: peaceiris/actions-gh-pages@v4
30+
with:
31+
github_token: ${{ secrets.GITHUB_TOKEN }}
32+
publish_dir: ./site

.github/workflows/release.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
id-token: write # for trusted publishing
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Install uv
18+
uses: astral-sh/setup-uv@v4
19+
20+
- name: Build package
21+
run: uv build
22+
23+
- name: Publish to PyPI
24+
uses: pypa/gh-action-pypi-publish@release/v1

CONTRIBUTING.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Contributing to xarray_plotly
2+
3+
Thanks for your interest in contributing!
4+
5+
## Development Setup
6+
7+
```bash
8+
# Clone the repo
9+
git clone https://github.com/felix/xarray_plotly.git
10+
cd xarray_plotly
11+
12+
# Install with dev dependencies
13+
uv sync --extra dev
14+
15+
# Install pre-commit hooks
16+
uv run pre-commit install
17+
```
18+
19+
## Running Tests
20+
21+
```bash
22+
uv run pytest
23+
```
24+
25+
## Code Style
26+
27+
We use [ruff](https://github.com/astral-sh/ruff) for linting and formatting. Pre-commit hooks will run automatically, or you can run manually:
28+
29+
```bash
30+
uv run ruff check --fix .
31+
uv run ruff format .
32+
```
33+
34+
## Making Changes
35+
36+
1. Fork the repository
37+
2. Create a feature branch (`git checkout -b feature/my-feature`)
38+
3. Make your changes
39+
4. Run tests (`uv run pytest`)
40+
5. Commit your changes
41+
6. Push to your fork and open a Pull Request
42+
43+
## Releases
44+
45+
Releases are automated via GitHub Actions. To create a release:
46+
47+
1. Update version in `pyproject.toml` and `xarray_plotly/__init__.py`
48+
2. Commit: `git commit -m "Bump version to X.Y.Z"`
49+
3. Tag: `git tag vX.Y.Z`
50+
4. Push: `git push && git push --tags`
51+
52+
The CI will automatically publish to PyPI and deploy updated docs.

0 commit comments

Comments
 (0)