Skip to content

Commit

Permalink
Add CI job for macOS smoke tests [SDK-4703] (#362)
Browse files Browse the repository at this point in the history
Add step for building the app
  • Loading branch information
Widcket committed Dec 6, 2023
1 parent 7a98d4b commit f4d97e8
Show file tree
Hide file tree
Showing 5 changed files with 95 additions and 21 deletions.
42 changes: 42 additions & 0 deletions .github/actions/smoke-tests-darwin/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Run iOS/macOS smoke tests
description: Execute the smoke test suite on iOS/macOS

inputs:
platform:
description: Either iOS or macOS
required: true

destination:
description: The destination string for xcodebuild
required: true

runs:
using: composite

steps:
- name: Lowercase platform value
id: lowercase-platform
run: echo "platform=$(echo ${{ inputs.platform }} | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_OUTPUT"
shell: bash

- name: Build ${{ inputs.platform }} app
working-directory: auth0_flutter/example/${{ steps.lowercase-platform.outputs.platform }}
run: flutter build ${{ steps.lowercase-platform.outputs.platform }} --debug ${{ inputs.platform == 'iOS' && '--no-codesign' || '' }}
shell: bash

- name: Disable iOS hardware keyboard
if: ${{ inputs.platform == 'iOS' }}
run: defaults write com.apple.iphonesimulator ConnectHardwareKeyboard 0
shell: bash

- name: Run ${{ inputs.platform }} smoke tests
working-directory: auth0_flutter/example/${{ steps.lowercase-platform.outputs.platform }}
run: xcodebuild test -scheme Runner -workspace Runner.xcworkspace -destination '${{ inputs.destination }}' -resultBundlePath smoke-tests.xcresult -only-testing:RunnerUITests
shell: bash

- name: Upload xcresult bundles
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32
if: ${{ failure() }}
with:
name: '${{ inputs.platform }} xcresult bundles (smoke tests)'
path: 'auth0_flutter/example/${{ steps.lowercase-platform.outputs.platform }}/smoke-tests.xcresult'
2 changes: 1 addition & 1 deletion .github/actions/unit-tests-darwin/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ runs:
if: ${{ failure() }}
with:
name: '${{ inputs.platform }} xcresult bundles (unit tests)'
path: 'auth0_flutter/example/${{ steps.lowercase-platform.outputs.platform }}/*.xcresult'
path: 'auth0_flutter/example/${{ steps.lowercase-platform.outputs.platform }}/unit-tests.xcresult'
62 changes: 47 additions & 15 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: CI

on:
pull_request:
types:
Expand Down Expand Up @@ -199,18 +200,10 @@ jobs:
auth0-client-id: ${{ vars.AUTH0_CLIENT_ID }}

- name: Run iOS smoke tests
if: ${{ github.event.pull_request.head.repo.fork == false }}
working-directory: auth0_flutter/example/ios
run: |
defaults write com.apple.iphonesimulator ConnectHardwareKeyboard 0
xcodebuild test -scheme Runner -workspace Runner.xcworkspace -destination 'platform=iOS Simulator,name=iPhone 14' -resultBundlePath smoke-tests.xcresult -only-testing:RunnerUITests
- name: Upload xcresult bundles
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32
if: ${{ failure() }}
uses: ./.github/actions/smoke-tests-darwin
with:
name: 'iOS xcresult bundles (smoke tests)'
path: 'auth0_flutter/example/ios/*.xcresult'
platform: ${{ env.platform }}
destination: 'platform=iOS Simulator,name=iPhone 14'

test-macos-unit:
name: Run native macOS unit tests using Xcode ${{ matrix.xcode }}
Expand Down Expand Up @@ -249,6 +242,41 @@ jobs:
platform: ${{ env.platform }}
destination: platform=macOS,arch=x86_64

test-macos-smoke:
name: Run native macOS smoke tests using Xcode ${{ matrix.xcode }}
needs: authorize
runs-on: macos-13
environment: ${{ github.event.pull_request.head.repo.fork && 'external' || 'internal' }}

env:
platform: macOS
USER_EMAIL: ${{ secrets.USER_EMAIL }}
USER_PASSWORD: ${{ secrets.USER_PASSWORD }}

strategy:
matrix:
xcode:
- '15.0.1'

steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11

- name: Set up environment
uses: ./.github/actions/setup-darwin
with:
platform: ${{ env.platform }}
flutter: ${{ env.flutter }}
xcode: ${{ matrix.xcode }}
auth0-domain: ${{ vars.AUTH0_DOMAIN }}
auth0-client-id: ${{ vars.AUTH0_CLIENT_ID }}

- name: Run macOS smoke tests
uses: ./.github/actions/smoke-tests-darwin
with:
platform: ${{ env.platform }}
destination: platform=macOS,arch=x86_64

test-android-unit:
name: Run native Android unit tests
needs: authorize
Expand Down Expand Up @@ -408,22 +436,26 @@ jobs:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11

- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a
- name: Download coverage report for auth0_flutter
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a
with:
name: auth0_flutter coverage
path: coverage/auth0_flutter

- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a
- name: Download coverage report for auth0_flutter_platform_interface
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a
with:
name: auth0_flutter_platform_interface coverage
path: coverage/auth0_flutter_platform_interface

- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a
- name: Download coverage report for iOS
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a
with:
name: iOS coverage
path: coverage/ios

- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a
- name: Download coverage report for Android
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a
with:
name: Android coverage
path: coverage/android
Expand Down
4 changes: 2 additions & 2 deletions auth0_flutter/example/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,7 @@
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = 22U9KJ5PK6;
DEVELOPMENT_TEAM = "";
GCC_C_LANGUAGE_STANDARD = gnu11;
GENERATE_INFOPLIST_FILE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
Expand Down Expand Up @@ -828,7 +828,7 @@
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = 22U9KJ5PK6;
DEVELOPMENT_TEAM = "";
GCC_C_LANGUAGE_STANDARD = gnu11;
GENERATE_INFOPLIST_FILE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
Expand Down
6 changes: 3 additions & 3 deletions auth0_flutter/example/macos/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1014,7 +1014,7 @@
GCC_WARN_UNDECLARED_SELECTOR = YES;
GENERATE_INFOPLIST_FILE = YES;
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
MACOSX_DEPLOYMENT_TARGET = 14.0;
MACOSX_DEPLOYMENT_TARGET = 11.0;
MARKETING_VERSION = 1.0;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
Expand Down Expand Up @@ -1048,7 +1048,7 @@
GCC_WARN_UNDECLARED_SELECTOR = YES;
GENERATE_INFOPLIST_FILE = YES;
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
MACOSX_DEPLOYMENT_TARGET = 14.0;
MACOSX_DEPLOYMENT_TARGET = 11.0;
MARKETING_VERSION = 1.0;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.auth0.sdks.Flutter.RunnerUITests;
Expand Down Expand Up @@ -1080,7 +1080,7 @@
GCC_WARN_UNDECLARED_SELECTOR = YES;
GENERATE_INFOPLIST_FILE = YES;
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
MACOSX_DEPLOYMENT_TARGET = 14.0;
MACOSX_DEPLOYMENT_TARGET = 11.0;
MARKETING_VERSION = 1.0;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.auth0.sdks.Flutter.RunnerUITests;
Expand Down

0 comments on commit f4d97e8

Please sign in to comment.