Skip to content

Commit

Permalink
Merge feature/macos-support into main (#381)
Browse files Browse the repository at this point in the history
  • Loading branch information
Widcket committed Dec 14, 2023
1 parent bd906fc commit 34db36f
Show file tree
Hide file tree
Showing 133 changed files with 2,620 additions and 1,450 deletions.
8 changes: 8 additions & 0 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
staged_files=($(git diff --staged --name-only --diff-filter=ACDMRT -- auth0_flutter/darwin))

# Only proceed if there are staged files from the 'darwin' directory
if [ ${#staged_files[@]} -eq 0 ]; then
exit 0
fi

scripts/generate-symlinks.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
name: Set up iOS environment
description: Set up the environment for building and testing the library on iOS
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
Expand All @@ -22,6 +26,11 @@ 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:
Expand All @@ -35,7 +44,7 @@ runs:
shell: bash

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

Expand All @@ -44,7 +53,7 @@ runs:
with:
bundler-cache: true
cache-version: 1
working-directory: auth0_flutter/example/ios
working-directory: auth0_flutter/example/${{ steps.lowercase-platform.outputs.platform }}

- name: Setup Xcode
run: sudo xcode-select --switch /Applications/Xcode_${{ inputs.xcode }}.app/Contents/Developer
Expand All @@ -58,11 +67,11 @@ runs:
name: Restore Pods cache
uses: actions/cache@f5ce41475b483ad7581884324a6eca9f48f8dcc7
with:
path: auth0_flutter/example/ios/Pods
path: auth0_flutter/example/${{ steps.lowercase-platform.outputs.platform }}/Pods
key: pods-${{ hashFiles('Podfile.lock') }}-${{ hashFiles('.xcode-version') }}-v1

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

Expand Down
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'
32 changes: 32 additions & 0 deletions .github/actions/unit-tests-darwin/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Run iOS/macOS unit tests
description: Execute the unit 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: Run ${{ inputs.platform }} unit tests
working-directory: auth0_flutter/example/${{ steps.lowercase-platform.outputs.platform }}
run: xcodebuild test -scheme Runner -workspace Runner.xcworkspace -destination '${{ inputs.destination }}' -resultBundlePath unit-tests.xcresult -skip-testing:RunnerUITests
shell: bash

- name: Upload xcresult bundles
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32
if: ${{ failure() }}
with:
name: '${{ inputs.platform }} xcresult bundles (unit tests)'
path: 'auth0_flutter/example/${{ steps.lowercase-platform.outputs.platform }}/unit-tests.xcresult'
35 changes: 35 additions & 0 deletions .github/workflows/check-symlinks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Symlinks

on:
pull_request:
types:
- opened
- synchronize

permissions: {}

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

jobs:
check-symlinks:
name: Check symlinks of iOS/macOS native code
runs-on: ubuntu-latest

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

- name: Run check
run: |
scripts/generate-symlinks.sh
if git diff HEAD --quiet --diff-filter=ACDMRT; then
echo $'\nNo changes detected in the iOS/macOS files that require updating the symlinks.'
echo 'All good.'
else
echo $'\nDetected changes in the iOS/macOS files that require updating the symlinks.'
echo "Please run 'scripts/generate-symlinks.sh' from the repository root and commit the changes."
exit 1
fi

0 comments on commit 34db36f

Please sign in to comment.