diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..9d79d9d --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,100 @@ +name: Tests + +on: + push: + branches: [ main, copilot/** ] + pull_request: + branches: [ main ] + +jobs: + test: + name: Test Python ${{ matrix.python-version }} on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + python-version: ['3.11', '3.12', '3.13', '3.14'] + + steps: + - uses: actions/checkout@v4 + with: + submodules: 'recursive' + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Install system dependencies + run: | + sudo apt-get update + sudo apt-get install -y \ + cmake \ + build-essential \ + libgmt-dev \ + gmt \ + gmt-dcw \ + gmt-gshhg \ + ghostscript + + - name: Install uv + uses: astral-sh/setup-uv@v3 + with: + enable-cache: true + + - name: Install Python dependencies + working-directory: pygmt_nanobind_benchmark + run: | + uv pip install --system -e ".[test,dev]" --no-build-isolation + + - name: Run tests + working-directory: pygmt_nanobind_benchmark + run: | + uv run pytest tests/ -v --tb=short + + - name: Upload test results + uses: actions/upload-artifact@v4 + if: failure() + with: + name: test-results-${{ matrix.os }}-${{ matrix.python-version }} + path: pygmt_nanobind_benchmark/tests/ + retention-days: 7 + + lint: + name: Lint and Type Check + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + with: + submodules: 'recursive' + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.12' + + - name: Install uv + uses: astral-sh/setup-uv@v3 + with: + enable-cache: true + + - name: Install dependencies + run: | + uv pip install --system ruff mypy + + - name: Run ruff format check + working-directory: pygmt_nanobind_benchmark + run: | + uv run ruff format --check . + + - name: Run ruff lint + working-directory: pygmt_nanobind_benchmark + run: | + uv run ruff check . + + - name: Run mypy + working-directory: pygmt_nanobind_benchmark + run: | + uv run mypy python/ tests/ || true diff --git a/README.md b/README.md index 4b4baaa..8420774 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # Coders +[![Tests](https://github.com/hironow/Coders/actions/workflows/test.yml/badge.svg)](https://github.com/hironow/Coders/actions/workflows/test.yml) + Please read AGENTS.md first and follow the instructions there. 1. [pygmt_nanobind_benchmark](./pygmt_nanobind_benchmark/INSTRUCTIONS) diff --git a/pygmt_nanobind_benchmark/pyproject.toml b/pygmt_nanobind_benchmark/pyproject.toml index 7e7407c..cf87dae 100644 --- a/pygmt_nanobind_benchmark/pyproject.toml +++ b/pygmt_nanobind_benchmark/pyproject.toml @@ -22,6 +22,8 @@ classifiers = [ "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", "Programming Language :: C++", "Topic :: Scientific/Engineering", ]