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

chore: improve ci concurrency and tests #74

Merged
merged 9 commits into from
May 15, 2024
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
47 changes: 27 additions & 20 deletions .github/workflows/analyze.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,65 +19,72 @@ on:
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
flutter-analyze:
timeout-minutes: 45
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
- uses: subosito/flutter-action@48cafc24713cca54bbe03cdc3a423187d413aafa
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b
- uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1
with:
channel: 'stable'
flutter-version: "3.19.x"
channel: "stable"
cache: true
- uses: bluefireteam/melos-action@dd3c344d731938d2ab2567a261f54a19a68b5f6a
with:
melos-version: '3.0.1'
- name: 'Run Flutter Analyze'
melos-version: "3.0.1"
- name: "Run Flutter Analyze"
run: melos run flutter-analyze

format:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- uses: subosito/flutter-action@48cafc24713cca54bbe03cdc3a423187d413aafa
distribution: "temurin"
java-version: "17"
- uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1
with:
channel: 'stable'
flutter-version: "3.19.x"
channel: "stable"
cache: true
- uses: bluefireteam/melos-action@dd3c344d731938d2ab2567a261f54a19a68b5f6a
with:
melos-version: '3.0.1'
melos-version: "3.0.1"
- name: Restore Cache
uses: actions/cache/restore@v3
uses: actions/cache/restore@v4
id: cache
with:
path: /home/linuxbrew/.linuxbrew
key: ${{ runner.os }}-linuxbrew-
key: ${{ runner.os }}-linuxbrew
- uses: Homebrew/actions/setup-homebrew@master
- name: 'Install swiftformat v0.53'
- name: "Install swiftformat v0.53"
if: steps.cache.outputs.cache-hit != 'true'
run: |
export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1
curl -O https://raw.githubusercontent.com/Homebrew/homebrew-core/86f85aaa82beba49f8a5aabf3a22508c9249f188/Formula/s/swiftformat.rb
echo 'brew "swiftformat.rb"' > Brewfile
brew bundle
- name: Save Cache
uses: actions/cache/save@v3
if: endsWith(steps.cache.outputs.cache-matched-key,hashFiles('Brewfile.lock.json')) == false
uses: actions/cache/save@v4
if: steps.cache.outputs.cache-hit != 'true'
with:
path: /home/linuxbrew/.linuxbrew
key: ${{ runner.os }}-linuxbrew-${{ hashFiles('Brewfile.lock.json') }}
- name: 'Formatter version'
key: ${{ runner.os }}-linuxbrew
- name: "Formatter version"
run: |
swiftformat --version
- name: 'Run format'
- name: "Run format"
if: ${{ success() || failure() }}
run: |
melos run format
- name: 'Validate formatting'
- name: "Validate formatting"
if: ${{ success() || failure() }}
run: |
./.github/workflows/scripts/validate-formatting.sh
104 changes: 55 additions & 49 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,127 +19,133 @@ on:
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
test-dart:
timeout-minutes: 45
runs-on:
runs-on:
labels: ubuntu-latest-8core
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
cache: 'gradle'
- uses: subosito/flutter-action@48cafc24713cca54bbe03cdc3a423187d413aafa
distribution: "temurin"
java-version: "17"
cache: "gradle"
- uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1
with:
channel: 'stable'
flutter-version: "3.19.x"
channel: "stable"
cache: true
- uses: bluefireteam/melos-action@dd3c344d731938d2ab2567a261f54a19a68b5f6a
with:
melos-version: '3.0.1'
- name: 'Run flutter test'
melos-version: "3.0.1"
- name: "Run flutter test"
run: melos run test:dart

test-android:
timeout-minutes: 45
runs-on:
runs-on:
labels: ubuntu-latest-8core
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
cache: 'gradle'
- uses: subosito/flutter-action@48cafc24713cca54bbe03cdc3a423187d413aafa
distribution: "temurin"
java-version: "17"
cache: "gradle"
- uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1
with:
flutter-version: '3.16.x'
channel: 'stable'
flutter-version: "3.19.x"
channel: "stable"
cache: true
- uses: bluefireteam/melos-action@dd3c344d731938d2ab2567a261f54a19a68b5f6a
with:
melos-version: '3.0.1'
- name: 'Run Android native unit tests'
melos-version: "3.0.1"
- name: "Run Android native unit tests"
run: melos run test:android

test-ios:
timeout-minutes: 45
runs-on:
runs-on:
labels: macos-latest-xlarge
strategy:
matrix:
working_directory:
['example']
working_directory: ["example"]
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
- uses: actions/cache@v3
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b
- uses: actions/cache@v4
with:
path: '**/Pods'
path: "**/Pods"
key: ${{ runner.os }}-pods-${{ hashFiles('**/*.podspec') }}
restore-keys: |
${{ runner.os }}-pods-
- uses: subosito/flutter-action@48cafc24713cca54bbe03cdc3a423187d413aafa
- uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1
with:
flutter-version: '3.16.x'
channel: 'stable'
flutter-version: "3.19.x"
channel: "stable"
cache: true
- uses: bluefireteam/melos-action@dd3c344d731938d2ab2567a261f54a19a68b5f6a
with:
melos-version: '3.0.1'
melos-version: "3.0.1"
- name: Generate necessary files with flutter build
working-directory: ${{ matrix.working_directory }}
run: flutter build ios --config-only
- name: 'Run iOS native unit tests'
run: flutter build ios --config-only
- name: "Run iOS native unit tests"
run: DEVICE='iPhone 14 Pro' melos run test:ios

build-android:
needs: [test-dart,test-android,test-ios]
needs: [test-dart, test-android, test-ios]
if: contains(github.base_ref, 'main')
timeout-minutes: 45
runs-on:
runs-on:
labels: ubuntu-latest-8core
env:
MAPS_API_KEY: ${{ secrets.ACTIONS_API_KEY }}
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
cache: 'gradle'
- uses: subosito/flutter-action@48cafc24713cca54bbe03cdc3a423187d413aafa
distribution: "temurin"
java-version: "17"
cache: "gradle"
- uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1
with:
channel: 'stable'
flutter-version: "3.19.x"
channel: "stable"
cache: true
- uses: bluefireteam/melos-action@dd3c344d731938d2ab2567a261f54a19a68b5f6a
with:
melos-version: '3.0.1'
- name: 'Run build for Android'
melos-version: "3.0.1"
- name: "Run build for Android"
run: melos run flutter-build-android

build-ios:
needs: [test-dart,test-android,test-ios]
needs: [test-dart, test-android, test-ios]
if: contains(github.base_ref, 'main')
timeout-minutes: 90
runs-on: macos-latest-xlarge
env:
MAPS_API_KEY: ${{ secrets.ACTIONS_API_KEY }}
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
- uses: subosito/flutter-action@48cafc24713cca54bbe03cdc3a423187d413aafa
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b
- uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1
with:
channel: 'stable'
flutter-version: "3.19.x"
channel: "stable"
cache: true
architecture: x64
- uses: bluefireteam/melos-action@dd3c344d731938d2ab2567a261f54a19a68b5f6a
with:
melos-version: '3.0.1'
- uses: actions/cache@v3
melos-version: "3.0.1"
- uses: actions/cache@v4
with:
path: '**/Pods'
path: "**/Pods"
key: ${{ runner.os }}-pods-${{ hashFiles('**/*.podspec') }}
restore-keys: |
${{ runner.os }}-pods-
- name: 'Run build for iOS'
- name: "Run build for iOS"
run: melos run flutter-build-ios
58 changes: 35 additions & 23 deletions .github/workflows/integration_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,45 +19,53 @@ on:
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
android:
if: contains(github.base_ref, 'main')
timeout-minutes: 45
strategy:
matrix:
patrol_cli_version: [2.5.0]
working_directory:
['example']
runs-on:
working_directory: ["example"]
runs-on:
labels: ubuntu-latest-8core
env:
MAPS_API_KEY: ${{ secrets.ACTIONS_API_KEY }}
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
- name: Fail if workflow has no access to API key
if: ${{ env.MAPS_API_KEY == '' }}
run: |
echo "MAPS_API_KEY is not available or empty."
exit 1
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
cache: 'gradle'
distribution: "temurin"
java-version: "17"
cache: "gradle"
- name: Enable KVM group perms
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
- name: Setup Android SDK
uses: android-actions/setup-android@v3
- uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8
- uses: actions/cache@v4
name: AVD Cache
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd
- uses: subosito/flutter-action@48cafc24713cca54bbe03cdc3a423187d413aafa
- uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1
with:
flutter-version: '3.16.x'
channel: 'stable'
flutter-version: "3.19.x"
channel: "stable"
cache: true
- name: Install patrol_cli
run: flutter pub global activate patrol_cli ${{ matrix.patrol_cli_version }}
Expand Down Expand Up @@ -97,22 +105,26 @@ jobs:
strategy:
matrix:
patrol_cli_version: [2.5.0]
working_directory:
['example']
runs-on:
working_directory: ["example"]
runs-on:
labels: macos-13-large
env:
MAPS_API_KEY: ${{ secrets.ACTIONS_API_KEY }}
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
- uses: subosito/flutter-action@48cafc24713cca54bbe03cdc3a423187d413aafa
- name: Fail if workflow has no access to API key
if: ${{ env.MAPS_API_KEY == '' }}
run: |
echo "MAPS_API_KEY is not available or empty."
exit 1
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b
- uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1
with:
flutter-version: '3.16.x'
channel: 'stable'
flutter-version: "3.19.x"
channel: "stable"
cache: true
- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: '**/Pods'
path: "**/Pods"
key: ${{ runner.os }}-pods-${{ hashFiles('**/*.podspec') }}
restore-keys: |
${{ runner.os }}-pods-
Expand Down
Loading
Loading