Skip to content
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
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @nauticalab/nauticalab
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
32 changes: 32 additions & 0 deletions .github/workflows/_license-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: License check

on:
workflow_call:
inputs:
branch:
description: 'Branch to check out'
required: false
type: string
default: ''

jobs:
license-check:
name: License check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ inputs.branch != '' && inputs.branch || github.sha }}

- name: Install uv
uses: astral-sh/setup-uv@v5

- name: Install dependencies
run: uv sync --locked --dev

- name: Check dependency licenses
run: >-
uv run pip-licenses
--allow-only="MIT;Apache-2.0;Apache 2.0;Apache Software License;BSD-2-Clause;BSD-3-Clause;BSD License;BSD;ISC;LGPL-3.0-only;MPL-2.0;Mozilla Public License;Python-2.0;PSF-2.0;Python Software Foundation License;Unlicense"
--partial-match
23 changes: 23 additions & 0 deletions .github/workflows/release-sync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Linear release sync

on:
push:
branches:
- main

jobs:
sync:
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Sync Linear release
uses: linear/linear-release-action@c0cb8354a362c24c6d3e0948f37fd66d07588e3f # v0
with:
access_key: ${{ secrets.LINEAR_ACCESS_KEY }}
command: sync
216 changes: 216 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,216 @@
name: Release

on:
workflow_dispatch:
inputs:
version:
description: 'Release version (e.g. 0.1.0 or v0.1.0 — leading v is stripped automatically)'
required: true
type: string
branch:
description: 'Branch to cut the release from (defaults to main)'
required: false
type: string
default: main

jobs:
validate-branch:
name: Validate release branch
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Check branch exists on origin
env:
GH_TOKEN: ${{ github.token }}
BRANCH: ${{ inputs.branch }}
run: |
ENCODED_BRANCH="${BRANCH//\//%2F}"
if ! gh api "repos/${{ github.repository }}/branches/${ENCODED_BRANCH}" --silent 2>/dev/null; then
echo "::error::Branch '${BRANCH}' does not exist. Check for typos."
exit 1
fi
echo "Branch '${BRANCH}' confirmed."

test:
name: Test (Python ${{ matrix.python-version }})
needs: [validate-branch]
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: true
matrix:
python-version: ["3.11", "3.12"]
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
fetch-depth: 0
ref: ${{ inputs.branch }}

- name: Install uv
uses: astral-sh/setup-uv@e58605a9b6da7c637471fab8847a5e5a6b8df081 # v5

- name: Install dependencies
run: uv sync --locked --dev --python ${{ matrix.python-version }}

- name: Lint
run: uv run --python ${{ matrix.python-version }} ruff check src tests

- name: Format check
run: uv run --python ${{ matrix.python-version }} ruff format --check src tests

- name: Type check
run: uv run --python ${{ matrix.python-version }} basedpyright

- name: Run tests
run: uv run --python ${{ matrix.python-version }} pytest --tb=short -q

license-check:
needs: [validate-branch]
uses: ./.github/workflows/_license-check.yml
with:
branch: ${{ inputs.branch }}

build:
name: Build distribution
needs: [test, license-check]
runs-on: ubuntu-latest
timeout-minutes: 20
permissions:
contents: write
outputs:
version: ${{ steps.normalize.outputs.version }}
steps:
- name: Normalize version
id: normalize
run: |
VERSION="${{ inputs.version }}"
VERSION="${VERSION#v}"
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"

- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
fetch-depth: 0
ref: ${{ inputs.branch }}

- name: Configure git identity
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"

- name: Create local release tag
run: git tag "v${{ steps.normalize.outputs.version }}"

- name: Install uv
uses: astral-sh/setup-uv@e58605a9b6da7c637471fab8847a5e5a6b8df081 # v5

- name: Build wheel and sdist
run: uv build

- name: Guard against duplicate tag
run: |
if git ls-remote --tags origin "refs/tags/v${{ steps.normalize.outputs.version }}" | grep -q .; then
echo "::error::Tag v${{ steps.normalize.outputs.version }} already exists on origin. Aborting."
exit 1
fi

- name: Push release tag
run: git push origin "v${{ steps.normalize.outputs.version }}"

- name: Upload dist artifact
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: dist
path: dist/
if-no-files-found: error

publish-testpypi:
name: Publish → TestPyPI
needs: build
runs-on: ubuntu-latest
timeout-minutes: 10
environment:
name: testpypi
url: https://test.pypi.org/p/orcapod-types
permissions:
id-token: write
steps:
- name: Install uv
uses: astral-sh/setup-uv@e58605a9b6da7c637471fab8847a5e5a6b8df081 # v5

- name: Download dist artifact
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: dist
path: dist/

- name: Publish to TestPyPI
run: uv publish --publish-url https://test.pypi.org/legacy/ dist/*

publish-pypi:
name: Publish → PyPI
needs: [build, publish-testpypi]
runs-on: ubuntu-latest
timeout-minutes: 10
environment:
name: pypi
url: https://pypi.org/p/orcapod-types
permissions:
id-token: write
contents: write
steps:
- name: Install uv
uses: astral-sh/setup-uv@e58605a9b6da7c637471fab8847a5e5a6b8df081 # v5

- name: Download dist artifact
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: dist
path: dist/

- name: Publish to PyPI
run: uv publish dist/*

- name: Create GitHub Release
uses: softprops/action-gh-release@3bb12739c298aeb8a4eeaf626c5b8d85266b0e65 # v2.6.2
with:
tag_name: "v${{ needs.build.outputs.version }}"
generate_release_notes: true
files: dist/*

linear-sync:
name: Sync Linear release
needs: build
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
fetch-depth: 0
- name: Sync Linear release
uses: linear/linear-release-action@c0cb8354a362c24c6d3e0948f37fd66d07588e3f # v0
with:
access_key: ${{ secrets.LINEAR_ACCESS_KEY }}
command: sync
version: "v${{ needs.build.outputs.version }}"

linear-complete:
name: Complete Linear release
needs: [build, publish-pypi, linear-sync]
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
fetch-depth: 0
- name: Complete Linear release
uses: linear/linear-release-action@c0cb8354a362c24c6d3e0948f37fd66d07588e3f # v0
with:
access_key: ${{ secrets.LINEAR_ACCESS_KEY }}
command: complete
version: "v${{ needs.build.outputs.version }}"
67 changes: 67 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Run Tests

on:
push:
branches: [main]
pull_request:
workflow_dispatch:

jobs:
license-check:
uses: ./.github/workflows/_license-check.yml

test:
needs: license-check
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11", "3.12"]

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install uv
uses: astral-sh/setup-uv@v5

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: uv sync --locked --dev --python ${{ matrix.python-version }}

- name: Lint
run: uv run ruff check src tests

- name: Format check
run: uv run ruff format --check src tests

- name: Type check
run: uv run basedpyright

- name: Run tests
run: uv run pytest -v --cov=src --cov-report=term-missing --cov-report=xml

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5

dependency-review:
name: Dependency review
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v4

- name: Dependency review
uses: actions/dependency-review-action@v4
with:
deny-licenses: >-
GPL-2.0-only, GPL-2.0-or-later,
GPL-3.0-only, GPL-3.0-or-later,
AGPL-3.0-only, AGPL-3.0-or-later,
LGPL-2.0-only, LGPL-2.0-or-later,
LGPL-2.1-only, LGPL-2.1-or-later,
LGPL-3.0-only, LGPL-3.0-or-later
41 changes: 41 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Python
__pycache__/
*.py[cod]
*$py.class
*.so
.Python
build/
dist/
*.egg-info/
.eggs/
*.egg

# Virtual environments
.venv/
venv/
ENV/
env/

# uv
.uv/

# Testing
.pytest_cache/
.coverage
coverage.xml
htmlcov/
.tox/

# Type checking
.pyright/
.mypy_cache/

# IDE
.idea/
.vscode/
*.swp
*.swo
.DS_Store

# Hatch version file (generated)
src/orcapod_types/_version.py
Loading
Loading