Skip to content

Commit

Permalink
Combine platform specific test apps (except win32) (microsoft#1535)
Browse files Browse the repository at this point in the history
* update fluent-tester

* delete others

* move FluentTester src

* yarn build works

* rnx-bundle works

* autolinking bug workaround + android

* windows works

* Update Apple CI

* More CI updates

* Update more CI

* update

* more updates

* More updates

* Change files

* maybe fix android

* fix ci?

* fix ci?

* ci

* setup emulator

* Remove expander

* More fixes

* The final countdown

* more fixes

* fix more links

* derp

* Change files

* Rearrange jobs and more fixes

* JS PR back to top

* remove flag that doesn't work

* Update android bundle name, enable single app mode

* forgot some

* Remove extra space

* update lock

* Update CI

* Remove Drawer from Fluent tester for now

* remove drawer again

* Change files

* Fix metro configs

* rerun `yarn configure-test-app` and add back some more metro config changes

* no expander

* update react dep + fix pipeline maybe

* delete duplicate job

* update yarn lock

* add back rnta

* Change files

* Move new tests

* Fix bundle

* update links + Podfile + delete podfile locks temporarily

* remove drawer again, add back locks

* Update apps/fluent-tester/package.json

Co-authored-by: Tommy Nguyen <[email protected]>

* Update apps/win32/package.json

Co-authored-by: Tommy Nguyen <[email protected]>

* Update apps/fluent-tester/metro.config.js

Co-authored-by: Tommy Nguyen <[email protected]>

* updates

* back to windows-2019

* merge

* remove --use-nuget

* Update .ado/azure-pipelines.yml

* Add back auto-lauch packager to ios/macos

Co-authored-by: Tommy Nguyen <[email protected]>
  • Loading branch information
Saadnajmi and tido64 authored Jul 25, 2022
1 parent af4148c commit 0772c56
Show file tree
Hide file tree
Showing 382 changed files with 619 additions and 15,929 deletions.
121 changes: 54 additions & 67 deletions .ado/azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ variables:
jobs:
# Dedicated task to build and bundle JS code, including jest tests, snapshot testing, and linting, because these things can be super
# time consuming they don't need to run on every CI pass, instead do a dedicated JS loop to make the platform specific tests start quicker
- job: BuildAndBundle
displayName: Build, test, and bundle JavaScript
- job: JSPR
displayName: JS PR
pool:
vmImage: 'ubuntu-latest'
timeoutInMinutes: 60 # how long to run the job before automatically cancelling
Expand Down Expand Up @@ -36,43 +36,39 @@ jobs:
yarn check-for-changed-files
displayName: 'verify API and Ensure Changed Files'
# Windows bundling and end to end testing
- job: WindowsPR
displayName: Windows PR
- job: AndroidPR
displayName: Android PR
pool:
vmImage: 'windows-2019'
vmImage: 'macos-11'
variables:
platform: 'android'
timeoutInMinutes: 60 # how long to run the job before automatically cancelling
cancelTimeoutInMinutes: 5 # how much time to give 'run always even if cancelled tasks' before killing them

# The "displayName" of all steps that execute a command within our repo (such as 'yarn build') start lowercase to make it
# easier to differentiate in-repo scripts from environmental setup. This makes it easier to understand CI pipeline results.
steps:
- checkout: self
persistCredentials: true

# yarn and minimal build to get set up
# setup repo basics
- template: templates/setup-repo-min-build.yml

# bundle windows adn do end to end tests
- template: templates/e2e-testing-uwp.yml

# Win32 bundling and end to end testing
- job: Win32PR
displayName: Win32 PR
pool:
vmImage: 'windows-2019'
timeoutInMinutes: 60
cancelTimeoutInMinutes: 5

steps:
- checkout: self
persistCredentials: true
# package android bundle
- script: |
yarn bundle:$(platform)
workingDirectory: apps/fluent-tester
displayName: 'yarn bundle $(platform)'
# yarn and minimal build to get set up
- template: templates/setup-repo-min-build.yml
# sets-up specifics for android dependency like NDK & emulator
- template: templates/android-dep-setup.yml

# bundle win32 and do end to end tests
- template: templates/e2e-testing-win32.yml
- bash: |
echo "yarn $(platform)"
yarn $(platform)
workingDirectory: apps/fluent-tester
displayName: 'yarn $(platform)'
env:
JAVA_HOME: $(JAVA_HOME_11_X64)
PATH: $(JAVA_HOME_11_X64)/bin;$(PATH)
- job: ApplePR
displayName: Apple PR
Expand All @@ -85,9 +81,9 @@ jobs:
maxParallel: 4
matrix:
ios:
relative_directory: 'ios'
platform: 'ios'
macos:
relative_directory: 'macos'
platform: 'macos'

steps:
- checkout: self
Expand All @@ -105,52 +101,54 @@ jobs:
- template: templates/setup-repo-min-build.yml

- script: |
yarn bundle
workingDirectory: apps/$(relative_directory)
displayName: 'yarn bundle $(relative_directory)'
yarn bundle:$(platform)
workingDirectory: apps/fluent-tester
displayName: 'yarn bundle $(platform)'
# Select proper Xcode version
- template: templates/apple-xcode-select.yml

- template: templates/apple-yarn-build.yml
parameters:
relative_directory: $(relative_directory)
platform: $(platform)

- job: AndroidPR
displayName: Android PR
# Windows bundling and end to end testing
- job: WindowsPR
displayName: Windows PR
pool:
vmImage: 'macos-11'
variables:
relative_directory: 'android'
vmImage: 'windows-2019'
timeoutInMinutes: 60 # how long to run the job before automatically cancelling
cancelTimeoutInMinutes: 5 # how much time to give 'run always even if cancelled tasks' before killing them

# The "displayName" of all steps that execute a command within our repo (such as 'yarn build') start lowercase to make it
# easier to differentiate in-repo scripts from environmental setup. This makes it easier to understand CI pipeline results.
steps:
- checkout: self
persistCredentials: true

# setup repo basics
# yarn and minimal build to get set up
- template: templates/setup-repo-min-build.yml

# package android bundle
- script: |
yarn bundle
workingDirectory: apps/$(relative_directory)
displayName: 'yarn bundle $(relative_directory)'
# bundle windows adn do end to end tests
- template: templates/e2e-testing-uwp.yml

# sets-up specifics for android dependency like NDK & emulator
- template: templates/android-dep-setup.yml
# Win32 bundling and end to end testing
- job: Win32PR
displayName: Win32 PR
pool:
vmImage: 'windows-2019'
timeoutInMinutes: 60
cancelTimeoutInMinutes: 5

steps:
- checkout: self
persistCredentials: true

# yarn and minimal build to get set up
- template: templates/setup-repo-min-build.yml

# build android apk and run available Instrumented test
- task: Gradle@2
inputs:
gradleWrapperFile: 'apps/$(relative_directory)/src/gradlew'
workingDirectory: 'apps/$(relative_directory)/src'
tasks: 'assembleDebug cAT'
publishJUnitResults: false
javaHomeOption: 'JDKVersion'
jdkVersionOption: '1.11'
sonarQubeRunAnalysis: false
# bundle win32 and do end to end tests
- template: templates/e2e-testing-win32.yml

# Dedicated task to make sure link on repo are functional.
- job: TestLinks
Expand All @@ -168,14 +166,3 @@ jobs:
- script: |
find . -name \*.md -not -name CHANGELOG.md -not -path '*/\node_modules/*' -print0 | xargs -0 -n1 yarn test-links -c `pwd`/.ado/markdown-link-check-config.json
displayName: 'testing links'
# Uncomment this job to test changes to the NuGet package
# We keep it commented out by default because this job is much longer than the other PR jobs
# - job: NuGetPublish
# displayName: NuGet Publish
# pool:
# vmImage: 'internal-macos12'
# demands: ['xcode', 'sh', 'npm']
# timeoutInMinutes: 90 # how long to run the job before automatically cancelling
# cancelTimeoutInMinutes: 5 # how much time to give 'run always even if cancelled tasks' before killing them
# steps:
# - template: templates/apple-nuget-publish.yml
18 changes: 9 additions & 9 deletions .ado/templates/apple-nuget-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,23 @@ steps:

# Pod Install iOS
- bash: |
echo "pod install --project-directory=src"
pod install --project-directory=src
workingDirectory: apps/ios
echo "pod install --project-directory=ios"
pod install --project-directory=ios
workingDirectory: apps/fluent-tester
displayName: 'pod install iOS'
# Pod Install macOS
- bash: |
echo "pod install --project-directory=src"
pod install --project-directory=src
workingDirectory: apps/macOS
echo "pod install --project-directory=macos"
pod install --project-directory=macos
workingDirectory: apps/fluent-tester
displayName: 'pod install macOS'
# macOS Release
- template: apple-xcode-build.yml
parameters:
xcode_sdk: 'macosx'
xcode_workspacePath: 'apps/macos/src/FluentTester.xcworkspace'
xcode_workspacePath: 'apps/fluent-tester/macos/FluentTester.xcworkspace'
xcode_actions: 'build'
xcode_scheme: 'FluentTester'
xcode_configuration: 'Release'
Expand All @@ -50,7 +50,7 @@ steps:
- template: apple-xcode-build.yml
parameters:
xcode_sdk: 'iphonesimulator'
xcode_workspacePath: 'apps/ios/src/FluentTester.xcworkspace'
xcode_workspacePath: 'apps/fluent-tester/ios/FluentTester.xcworkspace'
xcode_actions: 'build'
xcode_scheme: 'FluentTester'
xcode_configuration: 'Release'
Expand All @@ -60,7 +60,7 @@ steps:
- template: apple-xcode-build.yml
parameters:
xcode_sdk: 'iphoneos'
xcode_workspacePath: 'apps/ios/src/FluentTester.xcworkspace'
xcode_workspacePath: 'apps/fluent-tester/ios/FluentTester.xcworkspace'
xcode_actions: 'build'
xcode_scheme: 'FluentTester'
xcode_configuration: 'Release'
Expand Down
23 changes: 11 additions & 12 deletions .ado/templates/apple-yarn-build.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
parameters:
relative_directory: ''
platform: ''

steps:
# Install any pods necessary for the project
- bash: |
echo "pod install --project-directory=src"
pod install --project-directory=src
workingDirectory: apps/${{ parameters.relative_directory }}
displayName: 'pod install'
echo "pod install $(platform)"
pod install
workingDirectory: apps/fluent-tester/$(platform)
displayName: 'pod install $(platform)'
- bash: |
echo "Pre boot simulator"
UDID=$(xcrun simctl create test-iphone com.apple.CoreSimulator.SimDeviceType.iPhone-12 iOS15.5)
xcrun simctl boot $UDID
workingDirectory: apps/${{ parameters.relative_directory }}
workingDirectory: apps/fluent-tester
condition: and(succeeded(), eq('${{ parameters.platform }}', 'ios'))
displayName: 'Boot simulator'
- bash: |
echo "yarn ${{ parameters.relative_directory }}"
yarn ${{ parameters.relative_directory }}
workingDirectory: apps/${{ parameters.relative_directory }}
displayName: 'yarn ${{ parameters.relative_directory }}'
env:
platform_directory: ${{ parameters.relative_directory }}
echo "yarn $(platform)"
yarn $(platform)
workingDirectory: apps/fluent-tester
displayName: 'yarn $(platform)'
11 changes: 6 additions & 5 deletions .ado/templates/e2e-publish-artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,29 @@ parameters:
platform:
applicationType:
buildArtifacts:
directory:

steps:
# Copy Appium reports to FluentTesterDump
- task: CopyFiles@2
inputs:
sourceFolder: $(Build.SourcesDirectory)/apps/${{parameters.platform}}/reports/
sourceFolder: ${{parameters.directory}}/reports
targetFolder: $(Build.StagingDirectory)/E2E_${{parameters.applicationType}}_Dump
displayName: "Copy Reports"
displayName: 'Copy Reports'
condition: and (succeededOrFailed(), eq(${{parameters.buildArtifacts}}, 'success'))

# Copy errorShots to FluentTesterDump
- task: CopyFiles@2
inputs:
sourceFolder: $(Build.SourcesDirectory)/apps/${{parameters.platform}}/errorShots/
sourceFolder: ${{parameters.directory}}/errorShots
targetFolder: $(Build.StagingDirectory)/E2E_${{parameters.applicationType}}_Dump
displayName: "Copy tree dump screenshots"
displayName: 'Copy tree dump screenshots'
condition: and (succeededOrFailed(), eq(${{parameters.buildArtifacts}}, 'success'))

# Publish FluentTesterDump
- task: PublishBuildArtifacts@1
inputs:
artifactName: E2E_${{parameters.applicationType}}_Dump
pathtoPublish: $(Build.StagingDirectory)/E2E_${{parameters.applicationType}}_Dump
displayName: "Publish Artifact:E2E_${{parameters.applicationType}}_Dump"
displayName: 'Publish Artifact:E2E_${{parameters.applicationType}}_Dump'
condition: and (succeededOrFailed(), eq(${{parameters.buildArtifacts}}, 'success'))
17 changes: 9 additions & 8 deletions .ado/templates/e2e-testing-uwp.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
steps:
- script: |
yarn bundle
workingDirectory: apps/windows
yarn bundle:windows
workingDirectory: apps/fluent-tester
displayName: 'yarn bundle'
- script: |
yarn appium driver install windows
workingDirectory: apps/windows
workingDirectory: apps/fluent-tester
displayName: 'Installing appium windows driver'
# WinAppDriver 1.2 is being deployed across MS hosted agents. appium-windows-driver is tied to a specific version of WinAppDriver,
Expand Down Expand Up @@ -41,13 +41,13 @@ steps:
displayName: 'Install Azure Credentials Plugin for NuGet'

- script: |
yarn prewindows
workingDirectory: apps\windows
yarn install-windows-test-app
workingDirectory: apps\fluent-tester
displayName: 'generate UWP app'
- script: |
yarn windows --arch x64 --logging --no-packager --no-launch
workingDirectory: apps\windows
workingDirectory: apps\fluent-tester
displayName: 'build UWP app'
# Creates a variable that determines whether the previous build tasks succeeded.
Expand All @@ -63,8 +63,8 @@ steps:
displayName: 'Create success build variable'

- script: |
yarn e2etest
workingDirectory: apps\windows
yarn e2etest:windows
workingDirectory: apps\fluent-tester
displayName: 'run E2E UWP tests'
condition: succeeded()
Expand All @@ -75,3 +75,4 @@ steps:
applicationType: UWP
platform: windows
buildArtifacts: variables['task.Build.status']
directory: $(Build.SourcesDirectory)/apps/fluent-tester
1 change: 1 addition & 0 deletions .ado/templates/e2e-testing-win32.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,4 @@ steps:
applicationType: win32
platform: win32
buildArtifacts: variables['task.Build.status']
directory: $(Build.SourcesDirectory)/apps/win32
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Most components should use the compose framework as it offers the comprehensive

### Adding a new test for your component to the test app

1. In FluentTester (our test app), we'll need to add an test component. The test components are located under `fluentui-react-native/apps/fluent-tester/src/FluentTester/TestComponents`.
1. In FluentTester (our test app), we'll need to add an test component. The test components are located under `fluentui-react-native/apps/fluent-tester/src/TestComponents`.
1. Make a subdirectory for your new component at this path, as well as adding an entry for your test in `testPages.tsx` and `testPages.<platform>.tsx`
1. Create your tests in this new subdirectory. Pattern matching off an existing control's tests will greatly help.
1. If your component contains a native module, you will also need to add the path to your component's `podspec` (that we created earlier) in your test app's Podfile. This extra step is due to the fact that FluentTester has separate platform test apps that each share a common JS package. The react native community CLI does not support [autolinking transitive dependencies](https://github.com/react-native-community/cli/issues/1347), so we need to add it manually here.
Expand Down
3 changes: 0 additions & 3 deletions apps/android/.eslintrc.js

This file was deleted.

Loading

0 comments on commit 0772c56

Please sign in to comment.