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

Use patrol_challenge as example app #1952

Merged
merged 17 commits into from
Nov 28, 2023
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
41 changes: 3 additions & 38 deletions .github/workflows/patrol-prepare.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ jobs:
brew install xcbeautify

# Disabled because of generated protobuf code
#- name: swift-format lint
# run: test -z $(swift-format lint --recursive --strict .)
- name: swift-format lint
run: test -z $(swift-format lint --recursive --strict .)

- name: swift-format format
if: success() || failure()
Expand All @@ -154,41 +154,6 @@ jobs:
if: success() || failure()
run: |
find . -iname '*.h' -o -iname '*.m' | xargs -I {} clang-format --dry-run --Werror {}

- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ matrix.flutter-version }}
channel: ${{ matrix.flutter-channel }}

- name: Preload Flutter artifacts
run: flutter precache --ios

- name: Generate iOS build files
working-directory: packages/patrol/example
run: flutter build ios --config-only --simulator

- name: Start iOS simulator
uses: futureware-tech/simulator-action@v2
with:
model: iPhone 14
os: iOS
os_version: 16.2
erase_before_boot: true
shutdown_after_job: true

- name: Run unit tests
working-directory: packages/patrol/example/ios
run: |
set -o pipefail
xcodebuild test \
-workspace Runner.xcworkspace \
-scheme Runner \
-only-testing RunnerTests \
-configuration Debug \
-sdk iphoneos -destination 'platform=iOS Simulator,name=iPhone 14' \
-derivedDataPath ../build/ios_unit | xcbeautify --renderer github-actions

prepare-flutter:
name: Flutter ${{ matrix.flutter-version }}
runs-on: ubuntu-latest
Expand Down Expand Up @@ -224,7 +189,7 @@ jobs:

- name: flutter test
if: success() || failure()
run: flutter test --coverage
run: flutter test

- name: Run analyzer
if: success() || failure()
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/patrol_cli-prepare.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ jobs:
run: patrol

- name: dart test
run: |
dart test --coverage coverage
dart run coverage:format_coverage --lcov --in coverage --out coverage/lcov.info --report-on lib
run: dart test

- name: Run analyzer
if: success() || failure()
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/patrol_devtools_extension-prepare.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:

- name: flutter test
if: success() || failure()
run: flutter test --coverage
run: flutter test

- name: Run analyzer
if: success() || failure()
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/patrol_finders-prepare.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:

- name: flutter test
if: success() || failure()
run: flutter test --coverage
run: flutter test

- name: Run analyzer
if: success() || failure()
Expand Down
234 changes: 234 additions & 0 deletions .github/workflows/prepare-e2e_app.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,234 @@
name: prepare e2e_app

on:
workflow_dispatch:
pull_request:
paths:
- '**'
- '!**.md' # ignore readmes
- '!**.mdx' # ignore docs

jobs:
prepare-android-on-windows:
runs-on: ${{ matrix.os }}
name: Android on ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
os: [windows-latest]
flutter-version: ['3.16.x']
flutter-channel: ['stable']

defaults:
run:
working-directory: dev/e2e_app/android

steps:
- name: Clone repository
uses: actions/checkout@v4

- name: Set up Java
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17

- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ matrix.flutter-version }}
channel: ${{ matrix.flutter-channel }}

- name: Preload Flutter artifacts
run: flutter precache --android

- name: Generate Gradle wrapper
run: flutter build apk --config-only

- name: ktlint check
run: .\gradlew.bat :patrol:ktlintCheck

- name: ktlint format
run: .\gradlew.bat :patrol:ktlintFormat

- name: Build app with Gradle
run: .\gradlew.bat :app:assembleDebug

- name: Build app with Flutter tool
run: flutter build apk --debug

prepare-android-on-linux:
runs-on: ${{ matrix.os }}
name: Android on ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
flutter-version: ['3.16.x']
flutter-channel: ['stable']

defaults:
run:
working-directory: dev/e2e_app/android

steps:
- name: Clone repository
uses: actions/checkout@v4

- name: Set up Java
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17

- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ matrix.flutter-version }}
channel: ${{ matrix.flutter-channel }}

- name: Preload Flutter artifacts
run: flutter precache --android

- name: Generate Gradle wrapper
run: flutter build apk --config-only

- name: Run unit tests
if: success() || failure()
run: ./gradlew :patrol:testDebug

- name: ktlint check
if: success() || failure()
run: ./gradlew :patrol:ktlintCheck

- name: ktlint format
if: success() || failure()
run: ./gradlew :patrol:ktlintFormat

- name: Build app with Gradle
run: ./gradlew :app:assembleDebug

- name: Build app with Flutter tool
run: flutter build apk --debug

prepare-ios:
runs-on: ${{ matrix.os }}
name: iOS on ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
os: [macos-latest]
flutter-version: ['3.16.x']
flutter-channel: ['stable']

defaults:
run:
working-directory: dev/e2e_app/ios

steps:
- name: Clone repository
uses: actions/checkout@v4

- name: Install tools
run: |
brew update
brew install swift-format
brew install clang-format
brew install xcbeautify

- name: swift-format lint
run: test -z $(swift-format lint --recursive --strict .)

- name: swift-format format
if: success() || failure()
run: |
swift-format format --recursive --in-place .
git update-index --refresh
git diff-index --quiet HEAD --

- name: clang-format
if: success() || failure()
run: |
find . -iname '*.h' -o -iname '*.m' | xargs -I {} clang-format --dry-run --Werror {}

- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ matrix.flutter-version }}
channel: ${{ matrix.flutter-channel }}

- name: Preload Flutter artifacts
run: flutter precache --ios

- name: Generate iOS build files
run: flutter build ios --config-only --simulator

- name: Start iOS simulator
uses: futureware-tech/simulator-action@v2
with:
model: iPhone 14
os: iOS
os_version: 16.2
erase_before_boot: true
shutdown_after_job: true

- name: Run unit tests
run: |
set -o pipefail
xcodebuild test \
-workspace Runner.xcworkspace \
-scheme Runner \
-only-testing RunnerTests \
-configuration Debug \
-sdk iphoneos -destination 'platform=iOS Simulator,name=iPhone 14' \
-derivedDataPath ../build/ios_unit | xcbeautify --renderer github-actions

prepare-flutter:
name: Flutter ${{ matrix.flutter-version }}
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
flutter-version: ['3.16.x']
flutter-channel: ['stable']

defaults:
run:
working-directory: dev/e2e_app

steps:
- name: Clone repository
uses: actions/checkout@v4

- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ matrix.flutter-version }}
channel: ${{ matrix.flutter-channel }}

- name: Set up Melos and activate workspace
working-directory: .
run: |
dart pub global activate melos
melos bootstrap

- name: flutter pub get
run: flutter pub get

- name: flutter test
if: success() || failure()
run: flutter test

- name: Run analyzer
if: success() || failure()
run: |
flutter analyze
dart run custom_lint

- name: dart format
if: success() || failure()
run: dart format --set-exit-if-changed .
2 changes: 1 addition & 1 deletion .github/workflows/test-android-device.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:

defaults:
run:
working-directory: packages/patrol/example
working-directory: dev/e2e_app

steps:
- name: Clone repository
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-android-emulator-webview.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:

defaults:
run:
working-directory: packages/patrol/example
working-directory: dev/e2e_app

steps:
- name: Clone repository
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-android-emulator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:

defaults:
run:
working-directory: packages/patrol/example
working-directory: dev/e2e_app

steps:
- name: Clone repository
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/test-ios-device.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,29 +27,29 @@ jobs:

defaults:
run:
working-directory: packages/patrol/example
working-directory: dev/e2e_app

steps:
- name: Clone repository
uses: actions/checkout@v4

- name: Add current platform to Gemfile
working-directory: packages/patrol/example/ios
working-directory: dev/e2e_app/ios
run: bundle lock --add-platform ruby

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2'
bundler-cache: true
working-directory: packages/patrol/example/ios
working-directory: dev/e2e_app/ios

- name: Set up fastlane
working-directory: packages/patrol/example/ios
working-directory: dev/e2e_app/ios
run: bundle install

- name: Run fastlane match
working-directory: packages/patrol/example/ios
working-directory: dev/e2e_app/ios
env:
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
GIT_USERNAME: ${{ secrets.PATROL_FASTLANE_CERTS_REPO_TOKEN_USERNAME }}
Expand Down
Loading
Loading