chore: more spring cleaning and refactoring
This commit is contained in:
6
.github/workflows/ci.yml
vendored
6
.github/workflows/ci.yml
vendored
@@ -47,13 +47,13 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
python-version: "3.11"
|
python-version: "3.11"
|
||||||
|
|
||||||
- name: Run make release
|
- name: Run make build
|
||||||
run: make release
|
run: make build
|
||||||
|
|
||||||
- name: Check for uncommitted changes
|
- name: Check for uncommitted changes
|
||||||
run: |
|
run: |
|
||||||
if [ -n "$(git diff --name-only)" ]; then
|
if [ -n "$(git diff --name-only)" ]; then
|
||||||
echo "Generated files are out of date. Run 'make release' and commit the results."
|
echo "Generated files are out of date. Run 'make build' and commit the results."
|
||||||
echo ""
|
echo ""
|
||||||
echo "Changed files:"
|
echo "Changed files:"
|
||||||
git diff --name-only
|
git diff --name-only
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ cd Obtainium-Emulation-Pack
|
|||||||
# Make your changes to src/applications.json (or use make add-app)
|
# Make your changes to src/applications.json (or use make add-app)
|
||||||
make validate # check for structural errors
|
make validate # check for structural errors
|
||||||
make test # verify configs resolve to real APKs
|
make test # verify configs resolve to real APKs
|
||||||
make release # normalize, regenerate README, build release JSONs
|
make build # normalize, regenerate README, build release JSONs
|
||||||
```
|
```
|
||||||
|
|
||||||
## Project Structure
|
## Project Structure
|
||||||
@@ -64,7 +64,7 @@ This will:
|
|||||||
|
|
||||||
> **Tip:** To find the package ID, open the app in Obtainium - the package ID is displayed directly below the source URL (e.g., `com.example.android`).
|
> **Tip:** To find the package ID, open the app in Obtainium - the package ID is displayed directly below the source URL (e.g., `com.example.android`).
|
||||||
|
|
||||||
After running, execute `make release` to regenerate all files.
|
After running, execute `make build` to regenerate all files.
|
||||||
|
|
||||||
### Option B: Manual Add (For complex configs or non-GitHub sources)
|
### Option B: Manual Add (For complex configs or non-GitHub sources)
|
||||||
|
|
||||||
@@ -119,7 +119,7 @@ Add a `meta` object to customize how the app appears:
|
|||||||
```bash
|
```bash
|
||||||
make validate # check for structural errors
|
make validate # check for structural errors
|
||||||
make test # verify your app config resolves to a real APK
|
make test # verify your app config resolves to a real APK
|
||||||
make release # normalize, regenerate README, build release JSONs
|
make build # normalize, regenerate README, build release JSONs
|
||||||
```
|
```
|
||||||
|
|
||||||
## CI
|
## CI
|
||||||
@@ -128,13 +128,13 @@ Pull requests and pushes to `main` are checked by GitHub Actions:
|
|||||||
|
|
||||||
1. **Validate** - runs `make validate` (structural checks, regex syntax, source types)
|
1. **Validate** - runs `make validate` (structural checks, regex syntax, source types)
|
||||||
2. **Live Test** - runs `make test` (verifies all app configs resolve to real APKs)
|
2. **Live Test** - runs `make test` (verifies all app configs resolve to real APKs)
|
||||||
3. **Check Generated Files** - runs `make release` and fails if generated files are out of date
|
3. **Check Generated Files** - runs `make build` and fails if generated files are out of date
|
||||||
|
|
||||||
All three must pass before merging.
|
All three must pass before merging.
|
||||||
|
|
||||||
## Pre-Commit Checklist
|
## Pre-Commit Checklist
|
||||||
|
|
||||||
Before committing, run `make test` and `make release`, then verify:
|
Before committing, run `make test` and `make build`, then verify:
|
||||||
|
|
||||||
- [ ] `make test` passes (all app configs resolve to downloadable APKs)
|
- [ ] `make test` passes (all app configs resolve to downloadable APKs)
|
||||||
- [ ] `obtainium-emulation-pack-latest.json` has been updated
|
- [ ] `obtainium-emulation-pack-latest.json` has been updated
|
||||||
@@ -154,7 +154,7 @@ Before committing, run `make test` and `make release`, then verify:
|
|||||||
| `make test` | Live-test all app configs resolve to downloadable APKs |
|
| `make test` | Live-test all app configs resolve to downloadable APKs |
|
||||||
| `make test-app APP=name` | Live-test a single app by name (partial match) |
|
| `make test-app APP=name` | Live-test a single app by name (partial match) |
|
||||||
| `make test-verbose` | Live-test all apps with APK URL details |
|
| `make test-verbose` | Live-test all apps with APK URL details |
|
||||||
| `make release` | Full pipeline: validate, normalize, readme, both JSONs |
|
| `make build` | Full pipeline: validate, normalize, readme, both JSONs |
|
||||||
| `make normalize` | Normalize key order and backfill defaults |
|
| `make normalize` | Normalize key order and backfill defaults |
|
||||||
| `make table` | Generate the README table only |
|
| `make table` | Generate the README table only |
|
||||||
| `make readme` | Generate README.md from pages |
|
| `make readme` | Generate README.md from pages |
|
||||||
|
|||||||
9
Makefile
9
Makefile
@@ -1,9 +1,10 @@
|
|||||||
.PHONY: help all readme validate add-app normalize publish publish-dry-run publish-from-file test test-app test-verbose
|
.PHONY: help all readme validate add-app normalize build publish publish-dry-run publish-from-file test test-app test-verbose
|
||||||
default: help
|
default: help
|
||||||
|
|
||||||
help: # Show help for each of the makefile recipes.
|
help: # Show help for each of the makefile recipes.
|
||||||
@grep -E '^[a-zA-Z0-9 -]+:.*#' Makefile | sort | while read -r l; \
|
@width=$$(grep -E '^[a-zA-Z0-9 -]+:.*#' Makefile | cut -f1 -d':' | awk '{print length}' | sort -rn | head -1); \
|
||||||
do printf "\033[1;32m$$(echo $$l | cut -f 1 -d':')\033[00m:$$(echo $$l | cut -f 2- -d'#')\n"; done
|
grep -E '^[a-zA-Z0-9 -]+:.*#' Makefile | sort | while read -r l; \
|
||||||
|
do printf "\033[1;32m%-$${width}s\033[00m %s\n" "$$(echo $$l | cut -f 1 -d':')" "$$(echo $$l | cut -f 2- -d'#')"; done
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
# Apps
|
# Apps
|
||||||
@@ -31,7 +32,7 @@ test-verbose: # Live-test with APK URL details shown
|
|||||||
# Build
|
# Build
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
release: validate normalize readme minify minify-dual-screen # Run all Make targets related to cutting a release.
|
build: validate normalize readme minify minify-dual-screen # Build all artifacts: validate, normalize, readme, and both release JSONs.
|
||||||
|
|
||||||
minify: # Generate standard release JSON
|
minify: # Generate standard release JSON
|
||||||
@python scripts/minify-json.py src/applications.json obtainium-emulation-pack-latest.json --variant standard
|
@python scripts/minify-json.py src/applications.json obtainium-emulation-pack-latest.json --variant standard
|
||||||
|
|||||||
@@ -168,5 +168,5 @@ cd Obtainium-Emulation-Pack
|
|||||||
|
|
||||||
# Add or edit apps in src/applications.json (or use make add-app)
|
# Add or edit apps in src/applications.json (or use make add-app)
|
||||||
make test # verify configs resolve to real APKs
|
make test # verify configs resolve to real APKs
|
||||||
make release # validate, regenerate README, and build release JSONs
|
make build # validate, regenerate README, and build release JSONs
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -10,5 +10,5 @@ cd Obtainium-Emulation-Pack
|
|||||||
|
|
||||||
# Add or edit apps in src/applications.json (or use make add-app)
|
# Add or edit apps in src/applications.json (or use make add-app)
|
||||||
make test # verify configs resolve to real APKs
|
make test # verify configs resolve to real APKs
|
||||||
make release # validate, regenerate README, and build release JSONs
|
make build # validate, regenerate README, and build release JSONs
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -357,7 +357,7 @@ def main() -> int:
|
|||||||
print()
|
print()
|
||||||
|
|
||||||
print("Next steps:")
|
print("Next steps:")
|
||||||
print(" 1. Run 'make release' to regenerate all files")
|
print(" 1. Run 'make build' to regenerate all files")
|
||||||
print(" 2. Review the diff before committing")
|
print(" 2. Review the diff before committing")
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
"""Create a GitHub release with tagged JSON artifacts.
|
"""Create a GitHub release with tagged JSON artifacts.
|
||||||
|
|
||||||
Expects `make release` to have already been run. This script only handles
|
Expects `make build` to have already been run. This script only handles
|
||||||
the publish side: tagging, pushing, and creating the GitHub release.
|
the publish side: tagging, pushing, and creating the GitHub release.
|
||||||
|
|
||||||
Workflow:
|
Workflow:
|
||||||
@@ -12,7 +12,7 @@ Workflow:
|
|||||||
6. Create git tag, push, and create GitHub release
|
6. Create git tag, push, and create GitHub release
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
make release # build artifacts first
|
make build # build artifacts first
|
||||||
make publish # then publish
|
make publish # then publish
|
||||||
|
|
||||||
Requires: gh (GitHub CLI), git, python3
|
Requires: gh (GitHub CLI), git, python3
|
||||||
@@ -463,7 +463,7 @@ def main() -> None:
|
|||||||
for f in (STANDARD_JSON, DUAL_SCREEN_JSON):
|
for f in (STANDARD_JSON, DUAL_SCREEN_JSON):
|
||||||
if not f.exists():
|
if not f.exists():
|
||||||
print(f"Error: Expected artifact not found: {f}")
|
print(f"Error: Expected artifact not found: {f}")
|
||||||
print("Did you run `make release` first?")
|
print("Did you run `make build` first?")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
# Show summary before proceeding
|
# Show summary before proceeding
|
||||||
@@ -486,7 +486,7 @@ def main() -> None:
|
|||||||
print("Aborted.")
|
print("Aborted.")
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
# Commit any uncommitted changes (e.g. from `make release`)
|
# Commit any uncommitted changes (e.g. from `make build`)
|
||||||
if not check_working_tree_clean():
|
if not check_working_tree_clean():
|
||||||
print()
|
print()
|
||||||
print("Working tree has changes. Committing...")
|
print("Working tree has changes. Committing...")
|
||||||
|
|||||||
Reference in New Issue
Block a user