Skip to content
Open
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
190 changes: 169 additions & 21 deletions .github/workflows/flutter.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,185 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: Dart
name: "Flutter Testing"

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
branches:
- main
paths-ignore:
- '*.md'
- '**/*.md'
push:
branches:
- main
tags:
- '*'
paths-ignore:
- '*.md'
- '**/*.md'

jobs:
build:
# Building flutter
assemble:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: subosito/flutter-action@v2
with:
flutter-version: '2.10.5'
channel: 'stable'

- name: Check flutter version
run: flutter --version

- name: Get dependencies
- name: "Get dependencies"
run: flutter pub get

# - name: Generate icons
# run: flutter pub run flutter_launcher_icons:main

# - name: Run unit tests
# run: flutter test

# - name: Run integration tests
# run: flutter test integration_test
# - name: "Check for any formatting issues in the code."
# run: flutter format --set-exit-if-changed .

# - name: "Statically analyze the Dart code for any errors."
# run: flutter analyze .

- name: "Upload build artifacts"
uses: actions/upload-artifact@v3
with:
name: flutter-app
path: .

# Testing flutter
test_unit:
runs-on: ubuntu-latest
needs: assemble
steps:
- name: "Download build artifacts"
uses: actions/download-artifact@v3
with:
name: flutter-app
path: .

# - name: "Run unit tests"
# run: flutter test

# Testing Android
test_android:
runs-on: macos-latest # because of native hardware acceleration support provided by HAXM
needs: assemble
strategy:
matrix:
api-level: [ 21, 23, 29 ]
steps:
- name: "Download build artifacts"
uses: actions/download-artifact@v3
with:
name: flutter-app
path: .

- name: "Gradle cache"
uses: gradle/gradle-build-action@v2

- name: "AVD cache"
uses: actions/cache@v3
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-${{ matrix.api-level }}

- name: "create AVD and generate snapshot for caching"
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: false
script: echo "Generated AVD snapshot for caching."

- uses: subosito/flutter-action@v2
with:
flutter-version: '2.10.5'
channel: 'stable'

- name: "Run integration tests (android SDK #${{ matrix.api-level }})"
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
profile: Nexus 6
script: flutter test integration_test

# Testing iOS
test_ios:
runs-on: macos-latest
needs: assemble
strategy:
matrix:
device:
- "iPhone 8"
- "iPhone 11 Pro Max"
steps:
- name: "Download build artifacts"
uses: actions/download-artifact@v3
with:
name: flutter-app
path: .

- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable

- name: "List all simulators"
run: xcrun xctrace list devices

- name: "Start Simulator"
run: xcrun simctl boot "${{ matrix.device }}"

# TODO: add package build
- uses: subosito/flutter-action@v2
with:
flutter-version: '2.10.5'
channel: 'stable'

- name: "Get dependencies"
run: flutter pub get

- name: "Run integration tests - (${{ matrix.device }})"
run: flutter test integration_test

# Build android package
build_android:
runs-on: ubuntu-latest
needs: [ test_unit, test_android, test_ios ]
steps:
- uses: subosito/flutter-action@v2
with:
flutter-version: '2.10.5'
channel: 'stable'

# Build ios package
build_ios:
runs-on: macos-latest
needs: [ test_unit, test_android, test_ios ]
steps:
- uses: subosito/flutter-action@v2
with:
flutter-version: '2.10.5'
channel: 'stable'

# Publish android package
deploy_android:
runs-on: ubuntu-latest
needs: build_android
steps:
- uses: subosito/flutter-action@v2
with:
flutter-version: '2.10.5'
channel: 'stable'

# Publish ios package
deploy_ios:
runs-on: macos-latest
needs: build_ios
steps:
- uses: subosito/flutter-action@v2
with:
flutter-version: '2.10.5'
channel: 'stable'
70 changes: 70 additions & 0 deletions .github/workflows/ios_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: "Flutter iOS build"

on:
push:
branches:
- main
- cicd-testing
tags:
- '*'
paths-ignore:
- '*.md'
- '**/*.md'

jobs:
build_ios:
runs-on: macos-latest
strategy:
matrix:
device:
- "iPhone 11 Pro Max"
steps:
- uses: actions/checkout@v3
- name: Install the Apple certificate and provisioning profile
env:
BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }}
P12_PASSWORD: ${{ secrets.P12_PASSWORD }}
BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.BUILD_PROVISION_PROFILE_BASE64 }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
run: |
# create variables
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db

# import certificate and provisioning profile from secrets
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode --output $CERTIFICATE_PATH
echo -n "$BUILD_PROVISION_PROFILE_BASE64" | base64 --decode --output $PP_PATH

# create temporary keychain
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH

# import certificate to keychain
security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
security list-keychain -d user -s $KEYCHAIN_PATH

# apply provisioning profile
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable

- name: "List all simulators"
run: xcrun xctrace list devices

- name: "Start Simulator"
run: xcrun simctl boot "${{ matrix.device }}"

- uses: subosito/flutter-action@v2
with:
flutter-version: '2.10.5'
channel: 'stable'

- name: "Get dependencies"
run: flutter pub get

- name: "Run build - (${{ matrix.device }})"
run: flutter build ipa --release
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# TabManager

[![Flutter Testing](https://github.com/Mikopet/tab_manager/actions/workflows/flutter.yml/badge.svg)](https://github.com/Mikopet/tab_manager/actions/workflows/flutter.yml)

What is `tab_manager` about?

Well, it's easy, this is a tab manager. Imagine, you have a bigger group at an event, like a camp.
Expand Down
2 changes: 1 addition & 1 deletion ios/Flutter/AppFrameworkInfo.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>9.0</string>
<string>13.0</string>
</dict>
</plist>
1 change: 1 addition & 0 deletions ios/Flutter/Debug.xcconfig
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
#include "Generated.xcconfig"
1 change: 1 addition & 0 deletions ios/Flutter/Release.xcconfig
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "Generated.xcconfig"
43 changes: 43 additions & 0 deletions ios/Podfile
Original file line number Diff line number Diff line change
@@ -1 +1,44 @@
platform :ios, '13.0'

ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}

def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end

File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_ios_podfile_setup

target 'Runner' do
use_frameworks!
use_modular_headers!

flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end

post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)

target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0'
end
end
end

Loading