Skip to content

Commit

Permalink
Merge branch 'chore/dependabot' into feature/macos-support
Browse files Browse the repository at this point in the history
  • Loading branch information
Widcket authored Dec 7, 2023
2 parents 06e4216 + d923ee3 commit 85ba605
Show file tree
Hide file tree
Showing 5 changed files with 234 additions and 2 deletions.
81 changes: 81 additions & 0 deletions .github/actions/setup-darwin/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Set up iOS/macOS environment
description: Set up the environment for building and testing the library on iOS/macOS

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

flutter:
description: The version of Flutter to use
required: true

xcode:
description: The version of Xcode to use
required: true

auth0-domain:
description: The Auth0 domain
required: true

auth0-client-id:
description: The Auth0 client ID
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: Install Flutter
uses: subosito/flutter-action@48cafc24713cca54bbe03cdc3a423187d413aafa
with:
flutter-version: ${{ inputs.flutter }}
channel: stable
cache: true

- name: Install Flutter dependencies
working-directory: sample
run: flutter pub get
shell: bash

- name: Set Ruby version
working-directory: sample/${{ steps.lowercase-platform.outputs.platform }}
run: ruby -e 'puts RUBY_VERSION' | tee .ruby-version
shell: bash

- name: Set up Ruby
uses: ruby/setup-ruby@250fcd6a742febb1123a77a841497ccaa8b9e939
with:
bundler-cache: true
cache-version: 1
working-directory: sample/${{ steps.lowercase-platform.outputs.platform }}

- name: Setup Xcode
run: sudo xcode-select --switch /Applications/Xcode_${{ inputs.xcode }}.app/Contents/Developer
shell: bash

- name: Save Xcode version
run: xcodebuild -version | tee .xcode-version
shell: bash

- id: restore-pods-cache
name: Restore Pods cache
uses: actions/cache@f5ce41475b483ad7581884324a6eca9f48f8dcc7
with:
path: sample/${{ steps.lowercase-platform.outputs.platform }}/Pods
key: pods-${{ hashFiles('Podfile.lock') }}-${{ hashFiles('.xcode-version') }}-v1

- name: Install pods
working-directory: sample/${{ steps.lowercase-platform.outputs.platform }}
run: pod install
shell: bash

- name: Set .env
working-directory: sample
run: printf '%s\n%s\n%s' 'AUTH0_DOMAIN=${{ inputs.auth0-domain }}' 'AUTH0_CLIENT_ID=${{ inputs.auth0-client-id }}' 'AUTH0_CUSTOM_SCHEME=demo' >> .env
shell: bash
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: sample/${{ 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: sample/${{ 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'
path: 'sample/${{ steps.lowercase-platform.outputs.platform }}/smoke-tests.xcresult'
108 changes: 108 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
name: CI

on:
pull_request:
types:
- opened
- synchronize

permissions: {}

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

env:
flutter: '3.x'
ios-simulator: iPhone 15

jobs:
authorize:
name: Authorize
environment: ${{ github.event.pull_request.head.repo.fork && 'external' || 'internal' }}
runs-on: ubuntu-latest
steps:
- run: true

analyze-dart:
name: Analyze Dart code
needs: authorize
runs-on: ubuntu-latest

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

- name: Install Flutter
uses: subosito/flutter-action@2783a3f08e1baf891508463f8c6653c258246225
with:
flutter-version: ${{ env.flutter }}
channel: stable
cache: true

- name: Add sample/.env
working-directory: sample
run: cp .env.example .env

- name: Run Dart analyzer
working-directory: sample
run: flutter analyze

test-dart:
name: Test Dart code
needs: authorize
runs-on: ubuntu-latest

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

- name: Install Flutter
uses: subosito/flutter-action@2783a3f08e1baf891508463f8c6653c258246225
with:
flutter-version: ${{ env.flutter }}
channel: stable
cache: true

- name: Add sample/.env
working-directory: sample
run: cp .env.example .env

- name: Run Dart tests
working-directory: sample
run: flutter test

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

env:
platform: iOS
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 iOS smoke tests
uses: ./.github/actions/smoke-tests-darwin
with:
platform: ${{ env.platform }}
destination: 'platform=iOS Simulator,name=iPhone 15'
3 changes: 2 additions & 1 deletion sample/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,8 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Manual;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = "";
ENABLE_BITCODE = NO;
Expand Down
2 changes: 1 addition & 1 deletion sample/ios/UITests/SmokeTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class SmokeTests: XCTestCase {
private let loginButton = "Login"
private let logoutButton = "Logout"
private let continueButton = "Continue"
private let timeout: TimeInterval = 10
private let timeout: TimeInterval = 30

override func setUp() {
continueAfterFailure = false
Expand Down

0 comments on commit 85ba605

Please sign in to comment.