1+ name : CI
2+
3+ on :
4+ push :
5+ branches : [ main, ohos-main ]
6+ pull_request :
7+ branches : [ main, ohos-main ]
8+
9+ jobs :
10+ lint :
11+ name : Lint & Analyze
12+ runs-on : ubuntu-latest
13+
14+ steps :
15+ - name : Checkout repository
16+ uses : actions/checkout@v4
17+ with :
18+ submodules : recursive
19+
20+ - name : Setup Flutter
21+ uses : subosito/flutter-action@v2
22+ with :
23+ flutter-version : ' 3.38.7'
24+ channel : ' stable'
25+ cache : true
26+
27+ - name : Install melos
28+ run : dart pub global activate melos
29+
30+ - name : Add melos to PATH
31+ run : echo "$HOME/.pub-cache/bin" >> $GITHUB_PATH
32+
33+ - name : Verify melos installation
34+ run : dart pub global run melos --version
35+
36+ - name : Bootstrap melos
37+ run : dart pub global run melos bootstrap
38+
39+ - name : Check code formatting
40+ run : dart pub global run melos run format
41+
42+ - name : Analyze code
43+ run : dart pub global run melos run analyze
44+
45+ test :
46+ name : Test (${{ matrix.os }})
47+ runs-on : ${{ matrix.os }}
48+ strategy :
49+ fail-fast : false
50+ matrix :
51+ os : [ubuntu-latest, macos-latest, windows-latest]
52+
53+ steps :
54+ - name : Checkout repository
55+ uses : actions/checkout@v4
56+ with :
57+ submodules : recursive
58+
59+ - name : Setup Flutter
60+ uses : subosito/flutter-action@v2
61+ with :
62+ flutter-version : ' 3.38.7'
63+ channel : ' stable'
64+ cache : true
65+
66+ - name : Install melos
67+ run : dart pub global activate melos
68+
69+ - name : Add melos to PATH
70+ shell : bash
71+ run : |
72+ if [[ "$RUNNER_OS" == "Windows" ]]; then
73+ echo "$USERPROFILE/.pub-cache/bin" >> $GITHUB_PATH
74+ else
75+ echo "$HOME/.pub-cache/bin" >> $GITHUB_PATH
76+ fi
77+
78+ - name : Verify melos installation
79+ run : dart pub global run melos --version
80+
81+ - name : Bootstrap melos
82+ run : dart pub global run melos bootstrap
83+
84+ - name : Run tests
85+ run : dart pub global run melos run test
86+
87+ build :
88+ name : Build (${{ matrix.os }})
89+ runs-on : ${{ matrix.os }}
90+ needs : [lint]
91+ strategy :
92+ fail-fast : false
93+ matrix :
94+ os : [ubuntu-latest, macos-latest, windows-latest]
95+
96+ steps :
97+ - name : Checkout repository
98+ uses : actions/checkout@v4
99+ with :
100+ submodules : recursive
101+
102+ - name : Setup Flutter
103+ uses : subosito/flutter-action@v2
104+ with :
105+ flutter-version : ' 3.38.7'
106+ channel : ' stable'
107+ cache : true
108+
109+ - name : Install melos
110+ run : dart pub global activate melos
111+
112+ - name : Add melos to PATH
113+ shell : bash
114+ run : |
115+ if [[ "$RUNNER_OS" == "Windows" ]]; then
116+ echo "$USERPROFILE/.pub-cache/bin" >> $GITHUB_PATH
117+ else
118+ echo "$HOME/.pub-cache/bin" >> $GITHUB_PATH
119+ fi
120+
121+ - name : Bootstrap melos
122+ run : dart pub global run melos bootstrap
123+
124+ - name : Setup Java for Android
125+ if : matrix.os == 'ubuntu-latest'
126+ uses : actions/setup-java@v4
127+ with :
128+ distribution : ' temurin'
129+ java-version : ' 17'
130+
131+ - name : Install Linux dependencies
132+ if : matrix.os == 'ubuntu-latest'
133+ run : |
134+ sudo apt-get update
135+ sudo apt-get install -y \
136+ libgtk-3-dev \
137+ libblkid-dev \
138+ liblzma-dev \
139+ pkg-config \
140+ cmake \
141+ ninja-build \
142+ clang
143+
144+ - name : Build cnativeapi example Android
145+ if : matrix.os == 'ubuntu-latest'
146+ run : |
147+ cd packages/cnativeapi/example
148+ flutter build apk --release
149+
150+ - name : Build cnativeapi example iOS
151+ if : matrix.os == 'macos-latest'
152+ run : |
153+ cd packages/cnativeapi/example
154+ flutter build ios --release --no-codesign
155+
156+ - name : Build cnativeapi example Linux
157+ if : matrix.os == 'ubuntu-latest'
158+ run : |
159+ cd packages/cnativeapi/example
160+ flutter build linux --release
161+
162+ - name : Build cnativeapi example macOS
163+ if : matrix.os == 'macos-latest'
164+ run : |
165+ cd packages/cnativeapi/example
166+ flutter build macos --release
167+
168+ - name : Build cnativeapi example Windows
169+ if : matrix.os == 'windows-latest'
170+ run : |
171+ cd packages/cnativeapi/example
172+ flutter build windows --release
173+
174+ - name : Build nativeapi example Android
175+ if : matrix.os == 'ubuntu-latest'
176+ run : |
177+ cd packages/nativeapi/example
178+ flutter build apk --release
179+
180+ - name : Build nativeapi example iOS
181+ if : matrix.os == 'macos-latest'
182+ run : |
183+ cd packages/nativeapi/example
184+ flutter build ios --release --no-codesign
185+
186+ - name : Build nativeapi example Linux
187+ if : matrix.os == 'ubuntu-latest'
188+ run : |
189+ cd packages/nativeapi/example
190+ flutter build linux --release
191+
192+ - name : Build nativeapi example macOS
193+ if : matrix.os == 'macos-latest'
194+ run : |
195+ cd packages/nativeapi/example
196+ flutter build macos --release
197+
198+ - name : Build nativeapi example Windows
199+ if : matrix.os == 'windows-latest'
200+ run : |
201+ cd packages/nativeapi/example
202+ flutter build windows --release
0 commit comments