Skip to content

Commit 4c74ca8

Browse files
committed
initial commit
0 parents  commit 4c74ca8

File tree

14 files changed

+1168
-0
lines changed

14 files changed

+1168
-0
lines changed

.github/workflows/ci.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
lint:
11+
name: Lint and Format
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Set up Python
17+
uses: actions/setup-python@v5
18+
with:
19+
python-version: "3.13"
20+
21+
- name: Install uv
22+
uses: astral-sh/setup-uv@v4
23+
with:
24+
enable-cache: true
25+
26+
- name: Install dependencies
27+
run: uv sync
28+
29+
- name: Run pre-commit hooks
30+
run: uv run pre-commit run --all-files
31+
32+
test:
33+
name: Test
34+
runs-on: ubuntu-latest
35+
steps:
36+
- uses: actions/checkout@v4
37+
38+
- name: Set up Python
39+
uses: actions/setup-python@v5
40+
with:
41+
python-version: "3.13"
42+
43+
- name: Install uv
44+
uses: astral-sh/setup-uv@v4
45+
with:
46+
enable-cache: true
47+
48+
- name: Install dependencies
49+
run: uv sync
50+
51+
- name: Run tests
52+
run: uv run pytest -v

.github/workflows/release.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Release
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
permissions:
8+
contents: write
9+
packages: write
10+
11+
jobs:
12+
release:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Set up Python
18+
uses: actions/setup-python@v5
19+
with:
20+
python-version: "3.13"
21+
22+
- name: Install uv
23+
uses: astral-sh/setup-uv@v4
24+
with:
25+
enable-cache: true
26+
27+
- name: Install dependencies
28+
run: uv sync
29+
30+
- name: Run tests
31+
run: uv run pytest -v
32+
33+
- name: Build Wasm
34+
run: |
35+
uv run componentize-py \
36+
--wit-path wit \
37+
--world tiff-predictor-2-python \
38+
componentize -p src app \
39+
-o tiff-predictor-2-python.wasm
40+
41+
- uses: oras-project/setup-oras@v1
42+
43+
- name: Log in to GHCR
44+
run: echo "${{ secrets.GITHUB_TOKEN }}" | oras login ghcr.io -u "${{ github.actor }}" --password-stdin
45+
46+
- name: Push OCI artifact to GHCR
47+
run: |
48+
oras push \
49+
ghcr.io/cylf-dev/tiff-predictor-2-python:${{ github.event.release.tag_name }} \
50+
--annotation "org.opencontainers.image.source=https://github.com/cylf-dev/tiff-predictor-2-python" \
51+
--annotation "org.opencontainers.image.description=TIFF Predictor=2 horizontal differencing codec (Wasm Component)" \
52+
--annotation "org.opencontainers.image.licenses=Apache-2.0" \
53+
--annotation "org.opencontainers.image.revision=${{ github.sha }}" \
54+
--annotation "org.opencontainers.image.version=${{ github.event.release.tag_name }}" \
55+
tiff-predictor-2-python.wasm:application/wasm
56+
57+
- name: Upload Wasm to release
58+
run: gh release upload "${{ github.event.release.tag_name }}" tiff-predictor-2-python.wasm
59+
env:
60+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
__pycache__/
2+
*.pyc
3+
.venv/
4+
.mypy_cache/
5+
.pytest_cache/
6+
7+
# componentize-py generated bindings and runtime stubs
8+
wit_world/
9+
componentize_py_async_support/
10+
componentize_py_runtime.pyi
11+
componentize_py_types.py
12+
poll_loop.py
13+
14+
# built Wasm component
15+
*.wasm
16+
17+
.vscode/

.markdownlint.jsonc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
// Disable line length — prose docs are more readable without hard wrapping
3+
"MD013": false,
4+
// Allow duplicate headings in different sections (e.g. repeated Pros/Cons)
5+
"MD024": { "siblings_only": true }
6+
}

.pre-commit-config.yaml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
repos:
2+
- repo: local
3+
hooks:
4+
- id: ruff_check
5+
name: ruff check
6+
entry: ruff check --force-exclude
7+
language: python
8+
types: [python]
9+
args: [--fix, --exit-non-zero-on-fix]
10+
require_serial: true
11+
- id: ruff_format
12+
name: ruff format
13+
entry: ruff format --force-exclude
14+
language: python
15+
types: [python]
16+
args: []
17+
require_serial: true
18+
- id: check-added-large-files
19+
name: Check for added large files
20+
entry: check-added-large-files
21+
language: python
22+
args: [--maxkb=2048]
23+
- id: check-toml
24+
name: Check Toml
25+
entry: check-toml
26+
language: python
27+
types: [toml]
28+
- id: check-yaml
29+
name: Check Yaml
30+
entry: check-yaml
31+
language: python
32+
types: [yaml]
33+
- id: end-of-file-fixer
34+
name: Fix End of Files
35+
entry: end-of-file-fixer
36+
language: python
37+
types: [text]
38+
- id: trailing-whitespace
39+
name: Trim Trailing Whitespace
40+
entry: trailing-whitespace-fixer
41+
language: python
42+
types: [text]
43+
- id: mypy
44+
name: mypy
45+
entry: mypy
46+
language: python
47+
types: [python]
48+
args: ["--ignore-missing-imports", "--scripts-are-modules"]
49+
require_serial: true
50+
- repo: https://github.com/DavidAnson/markdownlint-cli2
51+
rev: v0.21.0
52+
hooks:
53+
- id: markdownlint-cli2

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
4+
5+
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6+
7+
## [Unreleased]

0 commit comments

Comments
 (0)