From 0c740851f3edde7afd2791458abbbf966d8a20c4 Mon Sep 17 00:00:00 2001 From: VSlavik1 Date: Wed, 8 Apr 2026 11:32:16 +0000 Subject: [PATCH] init: integrate MusicOCR workspace base --- .github/workflows/backup.yml | 25 +++++++++++++++ .github/workflows/validate.yml | 44 +++++++++++++++++++++++++++ manifests/access_control.example.json | 31 +++++++++++++++++++ manifests/access_control.json | 4 +++ manifests/repo_manifest.json | 7 +++++ 5 files changed, 111 insertions(+) create mode 100644 .github/workflows/backup.yml create mode 100644 .github/workflows/validate.yml create mode 100644 manifests/access_control.example.json create mode 100644 manifests/access_control.json create mode 100644 manifests/repo_manifest.json diff --git a/.github/workflows/backup.yml b/.github/workflows/backup.yml new file mode 100644 index 0000000..57df627 --- /dev/null +++ b/.github/workflows/backup.yml @@ -0,0 +1,25 @@ +name: Backup Data Repo + +on: + workflow_dispatch: + schedule: + - cron: "0 2 * * *" + +jobs: + backup: + runs-on: ubuntu-latest + steps: + - name: Check out repository + uses: actions/checkout@v4 + with: + lfs: true + + - name: Create archive + run: | + tar -czf musicocr-data-repo.tgz projects campaigns manifests .gitattributes + + - name: Upload archive artifact + uses: actions/upload-artifact@v4 + with: + name: musicocr-data-repo-backup + path: musicocr-data-repo.tgz diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml new file mode 100644 index 0000000..677ec19 --- /dev/null +++ b/.github/workflows/validate.yml @@ -0,0 +1,44 @@ +name: Validate Data Repo + +on: + push: + workflow_dispatch: + +jobs: + validate: + runs-on: ubuntu-latest + steps: + - name: Check out repository + uses: actions/checkout@v4 + with: + lfs: true + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.11" + + - name: Validate JSON files + run: | + python - <<'PY' + import json + from pathlib import Path + + json_files = list(Path(".").rglob("*.json")) + bad = [] + for path in json_files: + try: + json.loads(path.read_text(encoding="utf-8")) + except Exception as exc: + bad.append(f"{path}: {exc}") + + if bad: + raise SystemExit("Invalid JSON files:\n" + "\n".join(bad)) + + print(f"Validated {len(json_files)} JSON files.") + PY + + - name: Check required top-level folders + run: | + test -d projects + test -d manifests diff --git a/manifests/access_control.example.json b/manifests/access_control.example.json new file mode 100644 index 0000000..799d4de --- /dev/null +++ b/manifests/access_control.example.json @@ -0,0 +1,31 @@ +{ + "schema_version": "1.0", + "users": { + "admin@example.org": { + "role": "admin", + "github_logins": ["komisla"], + "all_projects": true, + "can_create_projects": true + }, + "reviewer@example.org": { + "role": "viewer", + "projects": [ + { + "name": "Bach-Singet-dem-Herrn", + "access": "read" + } + ] + }, + "annotator@example.org": { + "role": "editor", + "projects": [ + { + "name": "Bach-Singet-dem-Herrn", + "access": "write", + "pages": [1, 2, 3], + "sections": ["alto", "tenor"] + } + ] + } + } +} diff --git a/manifests/access_control.json b/manifests/access_control.json new file mode 100644 index 0000000..ddf2249 --- /dev/null +++ b/manifests/access_control.json @@ -0,0 +1,4 @@ +{ + "schema_version": "1.0", + "users": {} +} \ No newline at end of file diff --git a/manifests/repo_manifest.json b/manifests/repo_manifest.json new file mode 100644 index 0000000..16b9dbd --- /dev/null +++ b/manifests/repo_manifest.json @@ -0,0 +1,7 @@ +{ + "schema_version": "1.0", + "repo_type": "musicocr_data_repo", + "projects_root": "projects", + "campaigns_root": "campaigns", + "access_control_file": "manifests/access_control.json" +}