ci: release guard + SDK staleness check + 100% lib test coverage gate - #18
Merged
Merged
Conversation
Add internal/module_scripts/verify-pack.js and run it in release.yml right before `npm publish`. It parses `npm pack --dry-run --json` and fails the release if a required file (README, CHANGELOG, build output, native manifests) is missing or if source/tests/secrets/example would leak. A published npm version can't be overwritten, so this catches a bad tarball before it ships.
New sdk-staleness.yml workflow (weekly + manual dispatch) runs check-sdk-staleness.js, which compares the pinned MyID SDK versions (read from ios/MyId.podspec and android/build.gradle) against the newest STABLE upstream — iOS via the CocoaPods trunk API, Android via the Artifactory maven-metadata. Pre-releases are ignored on purpose (Artifactory advertises 3.1.10-beta02 as <release> while 3.1.9 is the newest stable). On drift it opens or updates a single tracking issue.
Raise test coverage of the shippable library (src + plugin/src) and the two release-critical scripts from ~76% to 100% statements/branches/ functions/lines, and enforce it so it can't regress. New tests - src/__tests__/module.test.ts: getNativeMyIdModule() resolution, caching, and lazy binding (was 0%). - src/__tests__/web.test.ts: web fallback throws a typed MyIdError. - plugin/src/__tests__/plugin-mods.test.ts: drives every config-plugin mod body (Android permissions, settings.gradle vs allprojects repo injection incl. the centralized-skip, warn, and .kts-throw paths; iOS static frameworks, camera default/custom/preserve, microphone, firebase workaround, privacy-manifest merge) by mocking @expo/config-plugins. - internal/module_scripts/__tests__/*: tarball required/forbidden logic; version compare, pre-release filtering, JSON/XML version parsing, stale-decision, emit, and a real-pin regex regression. - Extended native.test.ts and mock.test.ts with error-path, override, cross-realm re-throw, optional-field passthrough, and fake-timer branches. Testability refactors (CLI behavior unchanged) - verify-pack.js and check-sdk-staleness.js export their pure logic behind a require.main === module guard; the genuine network / npm-pack / CLI-entry boundary is marked with visible istanbul-ignore comments rather than silently excluded from coverage. CI / config - test:ci runs with --coverage; package.json adds scoped collectCoverageFrom, a coverageThreshold ratchet (98/95/100/98), and a testMatch that excludes the script literally named test.js. - ci.yml checks job enforces the threshold and uploads the coverage report as an artifact; release.yml inherits the gate. - .gitignore ignores coverage/.
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes the two remaining CI-tooling items from the review roadmap, plus raises the library to full test coverage and gates it in CI. Independent, locally-validated additions.
1. Tarball guard before publish (
ddda5e3)internal/module_scripts/verify-pack.jsruns inrelease.ymlimmediately beforenpm publish. It parsesnpm pack --dry-run --jsonand fails the release if:build/,plugin/build/, podspec,MyIdModule.swift,android/build.gradle,MyIdModule.kt), or^src/,^plugin/src/,example/,__tests__/,*.test/spec,.env,node_modules/,*.tsbuildinfo).android/src/is intentionally allowed (autolinked native sources). A published npm version can't be overwritten, so this is the cheapest place to catch a bad manifest.Validated locally: passes on the current tarball (36 files, 14/14 required, 0 forbidden); matcher unit-tested against allow/block cases including the
android/src/false-positive edge.2. Weekly SDK staleness check (
23f5037)New
sdk-staleness.yml(weekly cron + manualworkflow_dispatch) runscheck-sdk-staleness.js:ios/MyId.podspec,android/build.gradle) so it can't itself go stale,maven-metadata.xml(Android),<latest>/<release>as3.1.10-beta02while the newest stable is3.1.9; a naive check would false-alarm every run,Validated locally: correctly reports iOS
3.1.3and Android3.1.9both up-to-date (beta ignored); version-compare unit-tested (3.1.10 > 3.1.9,2.4.91 > 2.4.9, beta filtering).Neither script is shipped in the npm tarball (
internal/isn't infiles— and the new tarball guard would catch it if it were).3. Full library test coverage + CI gate (
deec84c)Raises coverage of the shippable lib (
src+plugin/src) and the two scripts above from ~76% to 100% statements/branches/functions/lines, and enforces it so it can't regress. 106 tests, 8 suites.MyIdModule.ts, was 0%), web fallback (MyIdModule.web.ts, was 0%), and every config-plugin mod body (Android repo injection incl. centralized-skip/warn/.kts-throw paths; iOS frameworks, camera, microphone, firebase, privacy manifest) via a@expo/config-pluginsmock. The tarball matcher and version-compare claims from §1–2 are now formalized as real tests.identify()tests: error-path fallbacks, cross-realmisMyIdErrorre-throw, and an exact-match pin that every optional config field reaches native intact.require.main === moduleguard (CLI behavior unchanged); the genuine network /npm pack/ CLI-entry boundary is marked with visibleistanbul ignorecomments rather than silently excluded.test:cinow runs--coverage;package.jsonadds scopedcollectCoverageFrom, acoverageThresholdratchet (98/95/100/98), and atestMatchthat excludes the script literally namedtest.js. Thechecksjob enforces the threshold and uploads the coverage report;release.ymlinherits the gate.Validated locally:
lint,typecheck,build,build:plugin, andtest:ciall pass; 100% on every file; both CLI scripts still run identically.