|
| 1 | +# CI package dependency locks |
| 2 | + |
| 3 | +This directory holds **CI-only** dependency pins for Matter package validation |
| 4 | +workflows (`.github/workflows/matter-packages-validation.yaml` and the package |
| 5 | +builders it calls). |
| 6 | + |
| 7 | +These files are **not** part of the `matter` / `matter_app` Conan packages. |
| 8 | +Packaging pulls SLC/SDK trees and explicit recipe roots; it does not ship |
| 9 | +`.github/`. |
| 10 | + |
| 11 | +## Why this exists |
| 12 | + |
| 13 | +Package CI depends on many Silabs Conan packages (direct and transitive). |
| 14 | +Floating ranges (for example in `slc/script/dependency_versions.yaml` / |
| 15 | +generated `pkg.slt`) can pick up newly published prereleases and break PR CI |
| 16 | +even when Matter code did not change. |
| 17 | + |
| 18 | +This directory stores a **certified pin set**: |
| 19 | + |
| 20 | +1. **PR CI** installs that pin set so builds are reproducible. |
| 21 | +2. **Nightly CI** resolves freely with `slt install`, and on success refreshes |
| 22 | + the pins so the next day’s PRs pick up a validated set. |
| 23 | + |
| 24 | +## Files |
| 25 | + |
| 26 | +| File | Format | Role | |
| 27 | +| --- | --- | --- | |
| 28 | +| `pkg.lock` | SLT TOML-like lock | **Source of truth.** Exact pins from `slt install` (versions + Conan recipe revisions, plus archive tools). | |
| 29 | +| `conan.lock` | Conan 2 JSON lock (`version: "0.5"`) | **Derived.** Used by `conan install --lockfile=...`. | |
| 30 | +| `conanfile.txt` | Conan requires list | **Derived.** Companion graph for `conan install <dir> --lockfile=...`. | |
| 31 | +| `README.md` | Markdown | This document. | |
| 32 | + |
| 33 | +### Important: two lock formats |
| 34 | + |
| 35 | +| | `pkg.lock` | `conan.lock` | |
| 36 | +| --- | --- | --- | |
| 37 | +| Consumer | `slt install` | `conan install --lockfile` | |
| 38 | +| Shape | `[dependency]` entries with `installer`, `type`, `ref` | JSON `requires` array of `name/version@user#revision` | |
| 39 | +| Compatible with each other? | **No** — do not pass `pkg.lock` to `--lockfile` | |
| 40 | + |
| 41 | +Always treat `pkg.lock` as the source and regenerate Conan files from it. |
| 42 | + |
| 43 | +## Source of truth and conversion |
| 44 | + |
| 45 | +```text |
| 46 | +slt install --> pkg.lock --> pkg_lock_to_conan_lock.py --> conan.lock |
| 47 | + \--> conanfile.txt |
| 48 | +``` |
| 49 | + |
| 50 | +Converter script (repo root): |
| 51 | + |
| 52 | +```bash |
| 53 | +python3 slc/script/pkg_lock_to_conan_lock.py \ |
| 54 | + --input .github/pkg-manifest/pkg.lock \ |
| 55 | + --output .github/pkg-manifest/conan.lock \ |
| 56 | + --conanfile .github/pkg-manifest/conanfile.txt |
| 57 | +``` |
| 58 | + |
| 59 | +What the converter does: |
| 60 | + |
| 61 | +- Keeps only entries with `installer = "conan"`. |
| 62 | +- Skips archive/tool packages (`commander`, `slc-cli`, `python`, `java21`, `zap`, …). |
| 63 | +- By default **omits** `matter` and `matter_app` so CI can install PR-built |
| 64 | + Matter packages on top of the locked third-party set. |
| 65 | +- Prefers each entry’s `ref = "name/version@silabs#revision"` when present. |
| 66 | +- Writes a minimal `conanfile.txt` with exact `name/version@silabs` requires |
| 67 | + (revision stripped in the requires list; revisions stay in `conan.lock`). |
| 68 | + |
| 69 | +Optional flag: |
| 70 | + |
| 71 | +```bash |
| 72 | +# Include matter/matter_app in the Conan lock (normally not needed in CI) |
| 73 | +python3 slc/script/pkg_lock_to_conan_lock.py --include-matter ... |
| 74 | +``` |
| 75 | + |
| 76 | +## PR CI (locked / stable) |
| 77 | + |
| 78 | +Triggered on pull requests into `main` / `release_*` with `use_lockfile=true` |
| 79 | +(default). |
| 80 | + |
| 81 | +Flow (via `.github/actions/install-pkg-manifest` + `packages/build_app.sh`): |
| 82 | + |
| 83 | +1. Restore the Actions cache that contains the PR’s exported `matter` / |
| 84 | + `matter_app` packages. |
| 85 | +2. Configure the Conan remote (`silabs-conan-production`). |
| 86 | +3. Install third-party deps: |
| 87 | + |
| 88 | + ```bash |
| 89 | + conan install .github/pkg-manifest \ |
| 90 | + --lockfile=.github/pkg-manifest/conan.lock \ |
| 91 | + -r silabs-conan-production |
| 92 | + ``` |
| 93 | + |
| 94 | +4. Install the PR Matter app package: |
| 95 | + |
| 96 | + ```bash |
| 97 | + slt install "matter_app/<PR_VERSION>@silabs" -e conan |
| 98 | + ``` |
| 99 | + |
| 100 | +5. Export `CI_PKG_LOCK` to the absolute path of `pkg.lock`. |
| 101 | +6. For each app build, `build_app.sh`: |
| 102 | + - Copies `CI_PKG_LOCK` into the app directory as `pkg.lock`. |
| 103 | + - Rewrites `matter` / `matter_app` entries to the PR package version |
| 104 | + (drops recipe revision so local `export-pkg` packages resolve). |
| 105 | + - Runs `slt install --check-updates=false` so SLT does not float. |
| 106 | + |
| 107 | +Result: third-party packages stay at the certified pins; only Matter code under |
| 108 | +test comes from the PR. |
| 109 | + |
| 110 | +## Nightly CI (resolve + refresh) |
| 111 | + |
| 112 | +Triggered by `.github/workflows/trigger-matter-packages-validation.yaml` with |
| 113 | +`use_lockfile=false`. |
| 114 | + |
| 115 | +Flow: |
| 116 | + |
| 117 | +1. **Build** without installing `.github/pkg-manifest` locks. |
| 118 | +2. App builds use normal `slt install` (`CHECK_UPDATES=true`) so newly published |
| 119 | + packages matching `pkg.slt` ranges can be pulled. |
| 120 | +3. If the package app builds (and OTA check, when enabled) succeed, the |
| 121 | + **Update CI pkg.lock and conan.lock** job: |
| 122 | + - Runs unlocked `slt install` in `slc/apps/lock_app/wifi`. |
| 123 | + - Copies the produced `pkg.lock` to `.github/pkg-manifest/pkg.lock`. |
| 124 | + - Runs `pkg_lock_to_conan_lock.py` to refresh `conan.lock` and |
| 125 | + `conanfile.txt`. |
| 126 | + - Commits and pushes the three files on the branch that was dispatched |
| 127 | + (for example `release_2.10-1.6.1`). |
| 128 | + |
| 129 | +If nightly fails, the previous committed locks are left unchanged, so PRs keep |
| 130 | +using the last green pin set. |
| 131 | + |
| 132 | +## Manual update (local) |
| 133 | + |
| 134 | +Use this when you want to refresh pins without waiting for nightly: |
| 135 | + |
| 136 | +```bash |
| 137 | +# From repo root, with slt/conan configured and remotes available |
| 138 | +python3 slc/script/generate_pkg_slt.py -d slc # if pkg.slt missing |
| 139 | +rm -f slc/apps/lock_app/wifi/pkg.lock |
| 140 | +( cd slc/apps/lock_app/wifi && slt install --check-updates=true ) |
| 141 | + |
| 142 | +mkdir -p .github/pkg-manifest |
| 143 | +cp -f slc/apps/lock_app/wifi/pkg.lock .github/pkg-manifest/pkg.lock |
| 144 | + |
| 145 | +python3 slc/script/pkg_lock_to_conan_lock.py \ |
| 146 | + --input .github/pkg-manifest/pkg.lock \ |
| 147 | + --output .github/pkg-manifest/conan.lock \ |
| 148 | + --conanfile .github/pkg-manifest/conanfile.txt |
| 149 | + |
| 150 | +# Review diff, then commit all three files together |
| 151 | +git add .github/pkg-manifest/pkg.lock \ |
| 152 | + .github/pkg-manifest/conan.lock \ |
| 153 | + .github/pkg-manifest/conanfile.txt |
| 154 | +``` |
| 155 | + |
| 156 | +Always convert after editing or replacing `pkg.lock`. Never hand-edit |
| 157 | +`conan.lock` alone unless you also update `pkg.lock` (or accept drift). |
| 158 | + |
| 159 | +## Secrets / remotes |
| 160 | + |
| 161 | +| Name | Purpose | |
| 162 | +| --- | --- | |
| 163 | +| `ARTIFACTORY_USER` / `ARTIFACTORY_TOKEN` | Optional Conan remote login for `silabs-conan-production` (and lock refresh). If unset, CI tries anonymous access. | |
| 164 | +| Job `contents: write` + `GITHUB_TOKEN` | Nightly commit/push of refreshed locks (branch protection may require a bot PAT). | |
| 165 | + |
| 166 | +Remote used by CI: |
| 167 | + |
| 168 | +```text |
| 169 | +https://artifactory.silabs.net/artifactory/api/conan/silabs-conan-production |
| 170 | +``` |
| 171 | + |
| 172 | +## Related code |
| 173 | + |
| 174 | +| Path | Role | |
| 175 | +| --- | --- | |
| 176 | +| `slc/script/pkg_lock_to_conan_lock.py` | `pkg.lock` → `conan.lock` + `conanfile.txt` | |
| 177 | +| `.github/actions/install-pkg-manifest/` | Restore Matter cache; locked Conan install; set `CI_PKG_LOCK` | |
| 178 | +| `packages/build_app.sh` | Honors `CI_PKG_LOCK` / `--pkg-lock` and `CHECK_UPDATES` | |
| 179 | +| `.github/workflows/matter-packages-validation.yaml` | PR vs nightly mode; nightly lock refresh job | |
| 180 | +| `.github/workflows/trigger-matter-packages-validation.yaml` | Daily dispatch with `use_lockfile=false` | |
| 181 | +| `slc/script/dependency_versions.yaml` | Floating ranges for local/dev `pkg.slt` generation (not the CI pin set) | |
| 182 | + |
| 183 | +## Seed note |
| 184 | + |
| 185 | +The initial `pkg.lock` was taken from `slc/apps/lock_app/wifi/pkg.lock` (a |
| 186 | +representative Wi‑Fi app resolve that also includes shared Thread/platform |
| 187 | +packages). Nightly (or a manual refresh) should replace it with a newly |
| 188 | +resolved lock after a green package validation run. |
0 commit comments