E2E Test with FusionAuth supported versions and latest iOS #49
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # This workflow performs a full End 2 End test of the App | |
| # It includes all FusionAuth versions of the past ~6 months. | |
| # And uses the latest iOS Target API level requirements. | |
| name: E2E Test with FusionAuth supported versions and latest iOS | |
| on: | |
| # Allows you to run this workflow manually from the Actions tab | |
| workflow_dispatch: | |
| # Triggers the workflow when it is called from another workflow | |
| workflow_call: | |
| # A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
| jobs: | |
| # This workflow contains a single job called "e2e-test" | |
| e2e-test: | |
| name: End 2 End Test | |
| permissions: | |
| # required for all workflows | |
| security-events: write | |
| # only required for workflows in private repositories | |
| actions: read | |
| contents: read | |
| # The type of runner that the job will run on | |
| # https://xcodereleases.com/ | |
| # https://developer.apple.com/support/xcode/ | |
| # https://developer.apple.com/documentation/xcode-release-notes | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| destination: [ "platform=iOS Simulator,OS=26.0.1,name=iPhone 17" ] | |
| xcode: [ "26.0.1" ] | |
| simulator-platform: [ "iOS" ] | |
| simulator-version: [ "26.0.1" ] | |
| swift: [ "6.1.0" ] | |
| os: [ "macos-15" ] | |
| postgresql-version: [ "16" ] | |
| fusionauth-docker-image-version: [ "1.57.1", "1.58.3", "1.59.1", "1.60.2", "1.61.0" ] | |
| # Steps represent a sequence of tasks that will be executed as part of the job | |
| steps: | |
| # Initialize the latest version of Xcode. | |
| - name: Initialize latest xcode | |
| uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd # v1.6.0 | |
| with: | |
| xcode-version: ${{ matrix.xcode }} | |
| # Remove any other Xcode version. | |
| - name: Remove old xcode versions | |
| run: | | |
| echo "Searching for Xcode versions:" | |
| find /Applications -name "Xcode_*" -maxdepth 1 -mindepth 1 | |
| echo "Removing old Xcode versions..." | |
| find /Applications -name "Xcode_*" -maxdepth 1 -mindepth 1 | grep -v ${{ matrix.xcode }} | xargs rm -rf | |
| echo "Available Xcode versions after removal:" | |
| find /Applications -name "Xcode_*" -maxdepth 1 -mindepth 1 | |
| # Get the Xcode version. | |
| - name: Get Xcode version | |
| run: xcodebuild -version | |
| # Install Xcodes. | |
| - name: Install Xcodes | |
| if: matrix.os == 'macos-13' | |
| shell: bash | |
| run: | | |
| brew install aria2 | |
| brew install xcodes | |
| # Install simulator platform. | |
| - name: Install Simulator | |
| if: matrix.os == 'macos-13' | |
| shell: bash | |
| run: | | |
| sudo xcodes runtimes | |
| sudo xcodes runtimes install '${{ matrix.simulator-platform }} ${{ matrix.simulator-version }}' | |
| sudo xcodes runtimes | |
| # Initialize Swift in the matrix specified version. | |
| - name: Initialize Swift | |
| uses: swift-actions/setup-swift@682457186b71c25a884c45c06f859febbe259240 # v2.3.0 | |
| with: | |
| swift-version: ${{ matrix.swift }} | |
| # Get the Swift version. | |
| - name: Get Swift version | |
| run: swift --version | |
| # Checkout the repository. | |
| - name: Checkout repository | |
| uses: actions/[email protected] | |
| # Install PostgreSQL with brew. | |
| - name: Install PostgreSQL | |
| run: brew install postgresql@${{ matrix.postgresql-version }} -v | |
| # Start PostgreSQL with brew. | |
| - name: Start PostgreSQL | |
| run: brew services start postgresql@${{ matrix.postgresql-version }} -v | |
| # Add PostgreSQL to the PATH. | |
| - name: Add PostgreSQL to the PATH | |
| run: echo "$(brew --prefix postgresql@${{matrix.postgresql-version }})/bin" >> $GITHUB_PATH | |
| # Add PostgreSQL fusionauth user with default password. | |
| - name: Add PostgreSQL fusionauth user | |
| run: psql --command="CREATE USER fusionauth PASSWORD 'fusionauth'" --command="\du" postgres | |
| # Add PostgreSQL fusionauth database. | |
| - name: Add PostgreSQL fusionauth database | |
| run: createdb --owner=fusionauth fusionauth | |
| # Download FusionAuth App formula. | |
| - name: Download FusionAuth App formula | |
| run: | | |
| mkdir -p $(brew --repository)/Library/Taps/local/homebrew-tap/Formula | |
| curl -L https://raw.githubusercontent.com/FusionAuth/homebrew-fusionauth/refs/tags/${{ matrix.fusionauth-docker-image-version }}/Formula/fusionauth-app.rb -o $(brew --repository)/Library/Taps/local/homebrew-tap/Formula/fusionauth-app.rb | |
| # Install FusionAuth App formula with brew. | |
| - name: Install FusionAuth App | |
| run: brew install --formula $(brew --repository)/Library/Taps/local/homebrew-tap/Formula/fusionauth-app.rb -v | |
| # Configure FusionAuth App with silent mode. | |
| - name: Configure FusionAuth App | |
| run: | | |
| echo "" >> $(brew --prefix)/etc/fusionauth/fusionauth.properties | |
| echo "fusionauth-app.kickstart.file=$(echo $GITHUB_WORKSPACE)/Samples/Quickstart/fusionauth/${{ matrix.fusionauth-docker-image-version }}/kickstart/kickstart.json" >> $(brew --prefix)/etc/fusionauth/fusionauth.properties | |
| echo "fusionauth-app.silent-mode=true" >> $(brew --prefix)/etc/fusionauth/fusionauth.properties | |
| cat $(brew --prefix)/etc/fusionauth/fusionauth.properties | |
| # Start FusionAuth App. | |
| - name: Start FusionAuth App | |
| run: brew services start fusionauth-app -v | |
| # Check Brew services status. | |
| - name: Check Brew services status | |
| run: brew services list | |
| # Check FusionAuth status 10 times with increasing wait times | |
| # Continue if FusionAuth status is OK or fail at the end. | |
| - name: Check FusionAuth status | |
| run: | | |
| for i in {1..10}; do | |
| if curl -s http://localhost:9011/api/status | grep -qi "ok"; then | |
| echo "FusionAuth is up and running." | |
| exit 0 | |
| else | |
| echo "FusionAuth is not up and running. Waiting for $(expr 10 \* $i) seconds." | |
| sleep $(expr 10 \* $i) | |
| fi | |
| done | |
| cat $(brew --prefix)/var/log/fusionauth/fusionauth-app.log | |
| exit 1 | |
| # Check KickstartRunner execution 10 times with increasing wait times | |
| # Continue if KickstartRunner execution is OK or fail at the end. | |
| # TODO - use webhook instead https://fusionauth.io/docs/extend/events-and-webhooks/events/kickstart-success | |
| - name: Check KickstartRunner execution | |
| run: | | |
| for i in {1..10}; do | |
| if cat $(brew --prefix)/var/log/fusionauth/fusionauth-app.log | grep "KickstartRunner" | grep -q "Summary"; then | |
| echo "KickstartRunner execution is OK." | |
| exit 0 | |
| else | |
| echo "KickstartRunner execution is not OK. Waiting for $(expr 10 \* $i) seconds." | |
| sleep $(expr 10 \* $i) | |
| fi | |
| done | |
| cat $(brew --prefix)/var/log/fusionauth/fusionauth-app.log | |
| exit 1 | |
| # Read FusionAuth App logs. | |
| - name: Read FusionAuth App logs | |
| run: cat $(brew --prefix)/var/log/fusionauth/fusionauth-app.log | |
| # Connect to FusionAuth App. | |
| - name: Connect to FusionAuth App | |
| run: curl http://localhost:9011/api/status | |
| # Perform the tests from the fusionauth-quickstart-swift-ios-native Sample. | |
| - name: Perform end to end tests | |
| run: set -o pipefail && xcodebuild test -workspace FusionAuthSDK.xcworkspace/ -scheme fusionauth-quickstart-swift-ios-native-swift-6 -destination "${{matrix.destination}}" -skipPackagePluginValidation -parallel-testing-enabled NO | |
| - name: Upload recording | |
| uses: actions/[email protected] | |
| if: ${{ failure() }} | |
| with: | |
| name: FusionAuth-${{ matrix.fusionauth-docker-image-version }}_${{ matrix.os }}_xcode-${{ matrix.xcode }}_swift-${{ matrix.swift }}_${{ matrix.simulator-platform }}-${{ matrix.simulator-version }}.xcresult | |
| path: /Users/runner/Library/Developer/Xcode/DerivedData/*/Logs/Test/*.xcresult |