forked from gsainfoteam/ziggle-flutter
-
Notifications
You must be signed in to change notification settings - Fork 0
120 lines (112 loc) · 3.52 KB
/
Copy pathtest.yml
File metadata and controls
120 lines (112 loc) · 3.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
name: build test (android, iOS)
on:
pull_request:
branches:
- main
- development
- development-v4
jobs:
check-test-required:
name: Check if test is required
runs-on: ubuntu-latest
outputs:
android-changed: ${{ steps.android-changed-files.outputs.any_changed }}
ios-changed: ${{ steps.ios-changed-files.outputs.any_changed }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Changed Files (android)
uses: tj-actions/changed-files@v37.5.0
id: android-changed-files
with:
files: |
pubspec.yaml
pubspec.lock
android/**
lib/**
- name: Changed Files (iOS)
uses: tj-actions/changed-files@v37.5.0
id: ios-changed-files
with:
files: |
pubspec.yaml
pubspec.lock
ios/**
lib/**
build-and-test:
name: Build ${{ matrix.os }} App and Test
needs: check-test-required
strategy:
fail-fast: false
matrix:
build-os: [ubuntu-latest, macos-15]
include:
- build-os: ubuntu-latest
os: Android
- build-os: macos-15
os: iOS
runs-on: ${{ matrix.build-os }}
concurrency:
group: ${{ matrix.os }}-test-${{ github.event.pull_request.number }}
cancel-in-progress: true
steps:
- name: setup env
run: |
echo "run=${{
matrix.os == 'Android' && needs.check-test-required.outputs.android-changed == 'true' ||
matrix.os == 'iOS' && needs.check-test-required.outputs.ios-changed == 'true'
}}" >> $GITHUB_ENV
echo "directory=$(echo ${{ matrix.os }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
- uses: actions/checkout@v4
if: env.run == 'true'
- uses: subosito/flutter-action@v2
if: env.run == 'true'
with:
flutter-version: "3.35.4"
channel: "stable"
cache: true
- uses: actions/cache@v4
if: env.run == 'true'
with:
path: |
.dart_tool
!.dart_tool/**/*.snapshot
key: ${{ runner.os }}-dart-tool-${{ hashFiles('pubspec.lock') }}
- name: install flutterfire
if: env.run == 'true'
run: flutter pub global activate flutterfire_cli
- uses: actions/cache@v4
if: env.run == 'true' && matrix.os == 'iOS'
with:
path: |
~/.cocoapods
~/Library/Caches/CocoaPods
key: cocoapods-${{ hashFiles('ios/Podfile.lock') }}
- uses: actions/setup-java@v4
if: env.run == 'true' && matrix.os == 'Android'
with:
java-version: "17"
distribution: "temurin"
cache: "gradle"
- uses: ruby/setup-ruby@v1
if: env.run == 'true'
with:
ruby-version: "3.2.0"
bundler-cache: true
working-directory: ${{ env.directory }}
- name: Copy dotenv
if: env.run == 'true'
run: |
echo '${{ vars.DOTENV }}' > .env
echo "AMPLITUDE_API_KEY=${{ secrets.AMPLITUDE_API_KEY }}" >> .env
echo "SMARTLOOK_API_KEY=${{ secrets.SMARTLOOK_API_KEY }}" >> .env
- name: Generate files
if: env.run == 'true'
run: |
dart run slang
dart run build_runner build --delete-conflicting-outputs
- name: Run fastlane
if: env.run == 'true'
run: bundle exec fastlane test
working-directory: ${{ env.directory }}