Skip to content

Commit 524d559

Browse files
chore: update ci (#890)
Separate format / analyze / test jobs --------- Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
1 parent 6f5a936 commit 524d559

2 files changed

Lines changed: 115 additions & 68 deletions

File tree

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Copyright 2024 LiveKit, Inc.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: "Setup Flutter Environment"
16+
description: "Sets up Flutter, Java (optional), and installs project dependencies"
17+
18+
inputs:
19+
java-version:
20+
description: "Java version to setup (optional)"
21+
required: false
22+
default: ""
23+
flutter-channel:
24+
description: "Flutter channel to use"
25+
required: false
26+
default: "stable"
27+
28+
runs:
29+
using: "composite"
30+
steps:
31+
- name: Setup Java
32+
if: inputs.java-version != ''
33+
uses: actions/setup-java@v4
34+
with:
35+
distribution: "temurin"
36+
java-version: ${{ inputs.java-version }}
37+
38+
- name: Setup Flutter
39+
uses: subosito/flutter-action@v2
40+
with:
41+
channel: ${{ inputs.flutter-channel }}
42+
43+
- name: Install project dependencies
44+
shell: bash
45+
run: flutter pub get

.github/workflows/build.yaml

Lines changed: 70 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -13,37 +13,68 @@
1313
# limitations under the License.
1414

1515
name: Build
16+
permissions:
17+
contents: read
1618

1719
on:
1820
push:
19-
branches: [ main ]
21+
branches: [main]
2022
pull_request:
21-
branches: [ main ]
23+
branches: [main]
2224

2325
jobs:
24-
dart-format-and-analyze-check:
25-
name: Dart Format/Analyze/Test Check
26+
dart-format-check:
27+
name: Dart Format Check
2628
runs-on: ubuntu-latest
2729

2830
steps:
29-
- uses: actions/checkout@v2
30-
- uses: actions/setup-java@v1
31-
with:
32-
java-version: '17.x'
33-
- uses: actions/checkout@v2
34-
- uses: subosito/flutter-action@v2
35-
with:
36-
channel: 'stable'
37-
- name: Install project dependencies
38-
run: flutter pub get
31+
- name: Clone repository
32+
uses: actions/checkout@v4
33+
- uses: ./.github/actions/setup-flutter
3934
- name: Dart Format Check
4035
run: dart format lib/ test/ --set-exit-if-changed
36+
37+
import-sorter-check:
38+
name: Import Sorter Check
39+
runs-on: ubuntu-latest
40+
41+
steps:
42+
- name: Clone repository
43+
uses: actions/checkout@v4
44+
- uses: ./.github/actions/setup-flutter
4145
- name: Import Sorter Check
4246
run: dart run import_sorter:main --no-comments --exit-if-changed
47+
48+
version-consistency-check:
49+
name: Version Consistency Check
50+
runs-on: ubuntu-latest
51+
52+
steps:
53+
- name: Clone repository
54+
uses: actions/checkout@v4
55+
- uses: ./.github/actions/setup-flutter
4356
- name: Check version consistency
4457
run: dart run scripts/check_version.dart
58+
59+
dart-analyze-check:
60+
name: Dart Analyze Check
61+
runs-on: ubuntu-latest
62+
63+
steps:
64+
- name: Clone repository
65+
uses: actions/checkout@v4
66+
- uses: ./.github/actions/setup-flutter
4567
- name: Dart Analyze Check
4668
run: flutter analyze
69+
70+
dart-test-check:
71+
name: Dart Test Check
72+
runs-on: ubuntu-latest
73+
74+
steps:
75+
- name: Clone repository
76+
uses: actions/checkout@v4
77+
- uses: ./.github/actions/setup-flutter
4778
- name: Dart Test Check
4879
run: flutter test
4980

@@ -52,16 +83,11 @@ jobs:
5283
runs-on: ubuntu-latest
5384

5485
steps:
55-
- uses: actions/checkout@v2
56-
- uses: actions/setup-java@v1
57-
with:
58-
java-version: '17.x'
59-
- uses: actions/checkout@v2
60-
- uses: subosito/flutter-action@v2
86+
- name: Clone repository
87+
uses: actions/checkout@v4
88+
- uses: ./.github/actions/setup-flutter
6189
with:
62-
channel: 'stable'
63-
- name: Install project dependencies
64-
run: flutter pub get
90+
java-version: "17.x"
6591
- name: Build for Android
6692
working-directory: ./example
6793
run: flutter build apk
@@ -71,12 +97,9 @@ jobs:
7197
runs-on: macos-latest
7298

7399
steps:
74-
- uses: actions/checkout@v2
75-
- uses: subosito/flutter-action@v2
76-
with:
77-
channel: 'stable'
78-
- name: Install project dependencies
79-
run: flutter pub get
100+
- name: Clone repository
101+
uses: actions/checkout@v4
102+
- uses: ./.github/actions/setup-flutter
80103
- name: Install xcode platform support for iOS
81104
run: xcodebuild -downloadPlatform iOS
82105
- name: Build for iOS
@@ -88,12 +111,9 @@ jobs:
88111
runs-on: windows-latest
89112

90113
steps:
91-
- uses: actions/checkout@v2
92-
- uses: subosito/flutter-action@v1
93-
with:
94-
channel: 'stable'
95-
- name: Install project dependencies
96-
run: flutter pub get
114+
- name: Clone repository
115+
uses: actions/checkout@v4
116+
- uses: ./.github/actions/setup-flutter
97117
- name: Build for Windows
98118
working-directory: ./example
99119
run: flutter build windows --release
@@ -103,12 +123,9 @@ jobs:
103123
runs-on: macos-latest
104124

105125
steps:
106-
- uses: actions/checkout@v2
107-
- uses: subosito/flutter-action@v1
108-
with:
109-
channel: 'stable'
110-
- name: Install project dependencies
111-
run: flutter pub get
126+
- name: Clone repository
127+
uses: actions/checkout@v4
128+
- uses: ./.github/actions/setup-flutter
112129
- name: Build for macOS
113130
working-directory: ./example
114131
run: flutter build macos --release
@@ -118,16 +135,11 @@ jobs:
118135
runs-on: ubuntu-latest
119136

120137
steps:
121-
- uses: actions/checkout@v2
122-
- uses: actions/setup-java@v1
138+
- name: Clone repository
139+
uses: actions/checkout@v4
140+
- uses: ./.github/actions/setup-flutter
123141
with:
124-
java-version: '12.x'
125-
- uses: actions/checkout@v2
126-
- uses: subosito/flutter-action@v2
127-
with:
128-
channel: 'stable'
129-
- name: Install project dependencies
130-
run: flutter pub get
142+
java-version: "17.x"
131143
- name: Run apt update
132144
run: sudo apt-get update
133145
- name: Install ninja-build libgtk-3-dev
@@ -141,16 +153,11 @@ jobs:
141153
runs-on: ubuntu-latest
142154

143155
steps:
144-
- uses: actions/checkout@v2
145-
- uses: actions/setup-java@v1
146-
with:
147-
java-version: '12.x'
148-
- uses: actions/checkout@v2
149-
- uses: subosito/flutter-action@v2
156+
- name: Clone repository
157+
uses: actions/checkout@v4
158+
- uses: ./.github/actions/setup-flutter
150159
with:
151-
channel: 'stable'
152-
- name: Install project dependencies
153-
run: flutter pub get
160+
java-version: "17.x"
154161
- name: Build for Web
155162
working-directory: ./example
156163
run: flutter build web
@@ -160,16 +167,11 @@ jobs:
160167
runs-on: ubuntu-latest
161168

162169
steps:
163-
- uses: actions/checkout@v2
164-
- uses: actions/setup-java@v1
165-
with:
166-
java-version: '12.x'
167-
- uses: actions/checkout@v2
168-
- uses: subosito/flutter-action@v2
170+
- name: Clone repository
171+
uses: actions/checkout@v4
172+
- uses: ./.github/actions/setup-flutter
169173
with:
170-
channel: 'stable'
171-
- name: Install project dependencies
172-
run: flutter pub get
174+
java-version: "17.x"
173175
- name: Build for Web
174176
working-directory: ./example
175177
run: flutter build web --wasm

0 commit comments

Comments
 (0)