Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CI job for macOS smoke tests [SDK-4703] #362

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .github/actions/smoke-tests-darwin/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
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: 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'
66 changes: 51 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,45 @@ 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: Build macOS example app
working-directory: auth0_flutter/example
run: flutter build macos --debug

- 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 +440,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
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
Loading