|
| 1 | +# Multi-Arch Images Implementation Plan |
| 2 | + |
| 3 | +> **For Claude:** REQUIRED SUB-SKILL: Use |
| 4 | +> superpowers:executing-plans to implement this plan task-by-task. |
| 5 | +
|
| 6 | +**Goal:** Build and publish `opencpu-psychometrics` images for both |
| 7 | +`linux/amd64` and `linux/arm64` in the existing GitHub Actions |
| 8 | +workflow. |
| 9 | + |
| 10 | +**Architecture:** Keep the single Docker workflow job and extend it to |
| 11 | +build a multi-platform manifest list with QEMU + Buildx. Add |
| 12 | +regression tests that assert the workflow is configured for both target |
| 13 | +architectures, then update build documentation to reflect the new |
| 14 | +publish behavior. |
| 15 | + |
| 16 | +**Tech Stack:** GitHub Actions workflow YAML, Docker Buildx, QEMU, |
| 17 | +Python `unittest` |
| 18 | + |
| 19 | +--- |
| 20 | + |
| 21 | +## Task 1: Add failing workflow tests |
| 22 | + |
| 23 | +**Files:** |
| 24 | + |
| 25 | +- Create: `tests/test_docker_publish_workflow.py` |
| 26 | +- Test: `tests/test_docker_publish_workflow.py` |
| 27 | + |
| 28 | +### Step 1: Write the failing test |
| 29 | + |
| 30 | +```python |
| 31 | +import pathlib |
| 32 | +import unittest |
| 33 | + |
| 34 | + |
| 35 | +WORKFLOW = ( |
| 36 | + pathlib.Path(__file__).resolve().parents[1] |
| 37 | + / ".github/workflows/docker-publish.yml" |
| 38 | +) |
| 39 | + |
| 40 | + |
| 41 | +class DockerWorkflowMultiArchTest(unittest.TestCase): |
| 42 | + def setUp(self) -> None: |
| 43 | + self.content = WORKFLOW.read_text(encoding="utf-8") |
| 44 | + |
| 45 | + def test_workflow_sets_up_qemu_for_cross_arch_builds(self) -> None: |
| 46 | + self.assertIn("docker/setup-qemu-action", self.content) |
| 47 | + |
| 48 | + def test_workflow_builds_amd64_and_arm64(self) -> None: |
| 49 | + self.assertIn("platforms: linux/amd64,linux/arm64", self.content) |
| 50 | +``` |
| 51 | + |
| 52 | +### Step 2: Run test to verify it fails |
| 53 | + |
| 54 | +Run: `python3 -m unittest tests.test_docker_publish_workflow -v` |
| 55 | +Expected: FAIL because QEMU and the multi-arch `platforms` line do |
| 56 | +not exist yet. |
| 57 | + |
| 58 | +### Step 3: Commit |
| 59 | + |
| 60 | +Do not commit yet. |
| 61 | + |
| 62 | +## Task 2: Update the workflow minimally |
| 63 | + |
| 64 | +**Files:** |
| 65 | + |
| 66 | +- Modify: `.github/workflows/docker-publish.yml` |
| 67 | +- Test: `tests/test_docker_publish_workflow.py` |
| 68 | + |
| 69 | +### Step 1: Write minimal implementation |
| 70 | + |
| 71 | +Add a pinned `docker/setup-qemu-action` step before Buildx and add: |
| 72 | + |
| 73 | +```yaml |
| 74 | +platforms: linux/amd64,linux/arm64 |
| 75 | +``` |
| 76 | +
|
| 77 | +to the `docker/build-push-action` step. |
| 78 | + |
| 79 | +### Step 2: Run targeted tests to verify they pass |
| 80 | + |
| 81 | +Run: `python3 -m unittest tests.test_docker_publish_workflow -v` |
| 82 | +Expected: PASS |
| 83 | + |
| 84 | +### Step 3: Run the full test suite |
| 85 | + |
| 86 | +Run: `python3 -m unittest discover -s tests -v` |
| 87 | +Expected: PASS |
| 88 | + |
| 89 | +## Task 3: Update architecture docs |
| 90 | + |
| 91 | +**Files:** |
| 92 | + |
| 93 | +- Modify: `ARCHITECTURE.md` |
| 94 | +- Modify: `AGENTS.md` (if verification guidance needs to mention |
| 95 | + workflow config tests) |
| 96 | + |
| 97 | +### Step 1: Document the new behavior |
| 98 | + |
| 99 | +Update `ARCHITECTURE.md` so the build pipeline section states that the |
| 100 | +workflow now emits a multi-architecture manifest list for amd64 and |
| 101 | +arm64. |
| 102 | + |
| 103 | +### Step 2: Verify docs remain lint-clean |
| 104 | + |
| 105 | +Run: `markdownlint-cli2 AGENTS.md ARCHITECTURE.md README.md` |
| 106 | + |
| 107 | +Run: `markdownlint-cli2 docs/plans/2026-03-11-multi-arch-images-design.md docs/plans/2026-03-11-multi-arch-images.md` |
| 108 | + |
| 109 | +Expected: PASS |
| 110 | + |
| 111 | +## Task 4: Final verification and commit |
| 112 | + |
| 113 | +**Files:** |
| 114 | + |
| 115 | +- Modify: `.github/workflows/docker-publish.yml` |
| 116 | +- Modify: `AGENTS.md` |
| 117 | +- Create: `tests/test_docker_publish_workflow.py` |
| 118 | +- Modify: `ARCHITECTURE.md` |
| 119 | +- Create: `docs/plans/2026-03-11-multi-arch-images-design.md` |
| 120 | +- Create: `docs/plans/2026-03-11-multi-arch-images.md` |
| 121 | + |
| 122 | +### Step 1: Run verification |
| 123 | + |
| 124 | +Run: |
| 125 | + |
| 126 | +```bash |
| 127 | +python3 -m unittest discover -s tests -v |
| 128 | +markdownlint-cli2 AGENTS.md ARCHITECTURE.md README.md |
| 129 | +markdownlint-cli2 docs/plans/2026-03-11-multi-arch-images-design.md docs/plans/2026-03-11-multi-arch-images.md |
| 130 | +``` |
| 131 | + |
| 132 | +Expected: PASS |
| 133 | + |
| 134 | +### Step 2: Commit |
| 135 | + |
| 136 | +```bash |
| 137 | +git add .github/workflows/docker-publish.yml \ |
| 138 | + AGENTS.md \ |
| 139 | + tests/test_docker_publish_workflow.py \ |
| 140 | + ARCHITECTURE.md \ |
| 141 | + docs/plans/2026-03-11-multi-arch-images-design.md \ |
| 142 | + docs/plans/2026-03-11-multi-arch-images.md |
| 143 | +git commit -m "feat: publish multi-arch Docker images" |
| 144 | +``` |
0 commit comments