-
Notifications
You must be signed in to change notification settings - Fork 0
126 lines (120 loc) · 5.08 KB
/
build.yml
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
121
122
123
124
125
126
on:
push:
branches:
- main
tags:
- '*'
pull_request:
branches: [ main ]
name: Build
jobs:
check_dependencies:
name: Validate dependencies
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- id: get_flutter_version
run: |
full_version=`grep flutter .tool-versions | awk '{print $2}'`
version=`echo $full_version | awk -F '-' '{print $1}'`
channel=`echo $full_version | awk -F '-' '{print $2}'`
echo "version=${version}" >> $GITHUB_OUTPUT
echo "channel=${channel}" >> $GITHUB_OUTPUT
- uses: subosito/flutter-action@v2.14.0
with:
flutter-version: ${{ steps.get_flutter_version.outputs.version }}
channel: ${{ steps.get_flutter_version.outputs.channel }}
cache: true
cache-key: 'flutter-:os:-:channel:-:version:-:arch:-:hash:' # optional, change this to force refresh cache
cache-path: '${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:' # optional, change this to specify the cache path
architecture: x64 # optional, x64 or arm64
- run: flutter pub get
- name: Check dependencies
run: flutter pub run dependency_validator
test:
name: Run Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- id: get_flutter_version
run: |
full_version=`grep flutter .tool-versions | awk '{print $2}'`
version=`echo $full_version | awk -F '-' '{print $1}'`
channel=`echo $full_version | awk -F '-' '{print $2}'`
echo "version=${version}" >> $GITHUB_OUTPUT
echo "channel=${channel}" >> $GITHUB_OUTPUT
- uses: subosito/flutter-action@v2.14.0
with:
flutter-version: ${{ steps.get_flutter_version.outputs.version }}
channel: ${{ steps.get_flutter_version.outputs.channel }}
cache: true
cache-key: 'flutter-:os:-:channel:-:version:-:arch:-:hash:' # optional, change this to force refresh cache
cache-path: '${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:' # optional, change this to specify the cache path
- run: flutter pub get
- name: Run Flutter tests
run: flutter test
build_android:
name: Build Android
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- uses: gradle/gradle-build-action@v3
with:
# Only write to the cache for builds on the 'main' branch.
# Builds on other branches will only read existing entries from the cache.
cache-read-only: ${{ github.ref != 'refs/heads/main' }}
gradle-version: wrapper
build-root-directory: android
- id: get_flutter_version
run: |
full_version=`grep flutter .tool-versions | awk '{print $2}'`
version=`echo $full_version | awk -F '-' '{print $1}'`
channel=`echo $full_version | awk -F '-' '{print $2}'`
echo "version=${version}" >> $GITHUB_OUTPUT
echo "channel=${channel}" >> $GITHUB_OUTPUT
- uses: subosito/flutter-action@v2.14.0
with:
flutter-version: ${{ steps.get_flutter_version.outputs.version }}
channel: ${{ steps.get_flutter_version.outputs.channel }}
cache: true
cache-key: 'flutter-:os:-:channel:-:version:-:arch:-:hash:' # optional, change this to force refresh cache
cache-path: '${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:' # optional, change this to specify the cache path
- run: flutter pub get
- name: Build APK
run: flutter build apk --debug
# - name: Archive artifacts
# uses: actions/upload-artifact@v2
# with:
# name: essentiel_flutter_artifacts
# path: |
# build/app/outputs/flutter-apk/app.apk
# build/**/outputs/**/*.aab
# build/**/outputs/**/mapping.txt
# flutter_drive.log
build_ios:
name: Build IOS
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- id: get_flutter_version
run: |
full_version=`grep flutter .tool-versions | awk '{print $2}'`
version=`echo $full_version | awk -F '-' '{print $1}'`
channel=`echo $full_version | awk -F '-' '{print $2}'`
echo "version=${version}" >> $GITHUB_OUTPUT
echo "channel=${channel}" >> $GITHUB_OUTPUT
- uses: subosito/flutter-action@v2.14.0
with:
flutter-version: ${{ steps.get_flutter_version.outputs.version }}
channel: ${{ steps.get_flutter_version.outputs.channel }}
cache: true
cache-key: 'flutter-:os:-:channel:-:version:-:arch:-:hash:' # optional, change this to force refresh cache
cache-path: '${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:' # optional, change this to specify the cache path
architecture: x64 # optional, x64 or arm64
- run: flutter pub get
- name: Build IOS
run: flutter build ios --release --no-codesign