README.md (1475B)
1 # 11 — Upstream Trigger 2 3 Re-run your app’s tests whenever an upstream library gets new commits. 4 5 ## Repos 6 7 | Repo | Path | Role | 8 |------|------|------| 9 | **upstream-lib** | `/home/exedev/upstream-lib/` | Shared library (`mathlib.py` — `add`, `multiply`) | 10 | **downstream-app** | `/home/exedev/downstream-app/` | App that depends on the library | 11 12 ## The symlink 13 14 ``` 15 downstream-app/.jci/upstream-lib → /home/exedev/upstream-lib 16 ``` 17 18 This symlink is how the app knows where its upstream dependency lives. 19 20 ## How it works 21 22 1. `downstream-app/.jci/run.sh` resolves the `upstream-lib` symlink. 23 2. It reads the upstream repo’s `HEAD` commit. 24 3. It compares that against `.jci/upstream-last-commit` (saved from the previous run). 25 4. **If upstream has changed** — app tests run to verify compatibility. 26 5. **If upstream is unchanged** — CI exits early, nothing to do. 27 28 ## Try it 29 30 ```bash 31 # First run — upstream is "new", tests run 32 cd /home/exedev/downstream-app 33 git jci run 34 35 # Second run — upstream unchanged, skips 36 git jci run 37 38 # Simulate an upstream change 39 cd /home/exedev/upstream-lib 40 echo '# update' >> mathlib.py && git add mathlib.py && git commit -m 'update' 41 42 # Third run — detects upstream change, tests run again 43 cd /home/exedev/downstream-app 44 git jci run 45 ``` 46 47 ## Adding more upstream repos 48 49 ```bash 50 cd /home/exedev/downstream-app/.jci 51 ln -s /path/to/another-lib upstream-other 52 ``` 53 54 Extend `run.sh` to loop over all `upstream-*` symlinks if needed.