@@ -34,13 +34,12 @@ function workflowStepIndex(workflow: string, matches: (step: WorkflowStep) => bo
3434 . findIndex ( matches ) ;
3535}
3636
37- test ( 'every runner build-cache input triggers the PR XCTest lane' , ( ) => {
37+ test ( 'native runner build-cache inputs trigger the PR XCTest lane' , ( ) => {
3838 const action = fs . readFileSync (
3939 path . join ( repoRoot , '.github/actions/setup-apple-runner-build/action.yml' ) ,
4040 'utf8' ,
4141 ) ;
42- expect ( cacheInputs ( action ) ) . toContain ( 'packages/platform-apple/src/runner/**' ) ;
43- expect ( cacheInputs ( action ) ) . toContain ( '!packages/platform-apple/src/runner/__tests__/**' ) ;
42+ expect ( cacheInputs ( action ) . filter ( ( input ) => input . startsWith ( 'packages/' ) ) ) . toEqual ( [ ] ) ;
4443 const uncovered = ( text : string ) =>
4544 cacheInputs ( text )
4645 . filter ( ( input ) => ! input . startsWith ( '!' ) )
@@ -63,6 +62,31 @@ test('every runner build-cache input triggers the PR XCTest lane', () => {
6362 ) . toEqual ( [ 'packages/platform-apple/src/foldable/**' ] ) ;
6463} ) ;
6564
65+ test ( 'the cache stores native products before applying the current runner icon patch' , ( ) => {
66+ const action = fs . readFileSync (
67+ path . join ( repoRoot , '.github/actions/setup-apple-runner-build/action.yml' ) ,
68+ 'utf8' ,
69+ ) ;
70+ const doc = parse ( action ) as {
71+ runs : {
72+ steps : Array < { name ?: string ; env ?: Record < string , string > ; if ?: string ; run ?: string } > ;
73+ } ;
74+ } ;
75+ const steps = doc . runs . steps ;
76+ const build = steps . find ( ( step ) => step . name === 'Build Apple runner artifacts on cache miss' ) ;
77+ const saveIndex = steps . findIndex ( ( step ) => step . name === 'Save Apple runner build cache' ) ;
78+ const patchIndex = steps . findIndex ( ( step ) => step . name === 'Patch XCTest runner icon' ) ;
79+ expect ( build ?. env ?. AGENT_DEVICE_XCUITEST_SKIP_ICON_PATCH ) . toBe ( '1' ) ;
80+ expect ( saveIndex ) . toBeGreaterThan ( - 1 ) ;
81+ expect ( patchIndex ) . toBeGreaterThan ( saveIndex ) ;
82+ expect ( steps [ patchIndex ] ?. if ) . toBeUndefined ( ) ;
83+ expect ( steps [ patchIndex ] ?. run ) . toContain ( 'scripts/patch-xcuitest-runner-icon.ts' ) ;
84+ expect ( cacheInputs ( action ) ) . not . toContain ( 'scripts/patch-xcuitest-runner-icon.ts' ) ;
85+ expect ( fs . readFileSync ( path . join ( repoRoot , 'scripts/build-xcuitest-apple.sh' ) , 'utf8' ) ) . toContain (
86+ 'if ! is_truthy "${AGENT_DEVICE_XCUITEST_SKIP_ICON_PATCH:-}"; then' ,
87+ ) ;
88+ } ) ;
89+
6690test ( 'the PR workflow applies the impact decision to the XCTest step' , ( ) => {
6791 const workflow = fs . readFileSync ( path . join ( repoRoot , '.github/workflows/ios.yml' ) , 'utf8' ) ;
6892 expect ( workflow ) . toContain ( 'node --experimental-strip-types scripts/apple-ci-impact.ts xctest' ) ;
0 commit comments