-
Notifications
You must be signed in to change notification settings - Fork 19
235 lines (194 loc) · 7.06 KB
/
elastic-ci.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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
name: Elastic
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
workflow_dispatch:
env:
FLUTTER_VERSION: 3.22.3
jobs:
formatting-analysis:
name: "Check Formatting & Analyze"
runs-on: ubuntu-22.04
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
cache: true
cache-path: ${{ runner.tool_cache }}/flutter/linux
- name: Install dependencies
run: flutter pub get
- name: Generate mocks
run: dart run build_runner build
- name: Verify formatting
run: dart format --output=none --set-exit-if-changed lib/* test/*
- name: Verify import sorting
run: dart run import_sorter:main --exit-if-changed
- name: Analyze project source
run: flutter analyze --no-fatal-infos --no-fatal-warnings
test:
name: "Run Tests"
runs-on: ubuntu-22.04
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
cache: true
cache-path: ${{ runner.tool_cache }}/flutter/linux
- name: Install dependencies
run: flutter pub get
- name: Generate mocks
run: dart run build_runner build
- name: Run tests
run: flutter test --coverage
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
build:
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
build-option: "windows"
artifact-path: "build/windows/x64/runner/Release"
artifact-name: Elastic-Windows
- os: macos-latest
build-option: "macos"
artifact-path: "build/macos/Build/Products/Release/Elastic-macOS.zip"
artifact-name: Elastic-macOS
- os: ubuntu-22.04
build-option: "linux"
artifact-path: "build/linux/x64/release/bundle"
artifact-name: Elastic-Linux
name: "Build - ${{ matrix.artifact-name }}"
needs: [formatting-analysis, test]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Install flutter build dependencies
if: ${{ matrix.build-option == 'linux' }}
run: |
sudo apt-get update -y
sudo apt-get install -y libglu1-mesa ninja-build libgtk-3-dev liblzma-dev
- name: Setup flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
cache: true
cache-path: ${{ runner.tool_cache }}/flutter/${{ matrix.build-option }}
- name: Install dependencies
run: flutter pub get
- name: Generate icons
run: dart run flutter_launcher_icons
- name: Build app
run: flutter build ${{ matrix.build-option }}
- name: Zip release
if: ${{ matrix.build-option == 'macos' }}
run: |
cd build/macos/Build/Products/Release
zip -r ${{ matrix.artifact-name }}.zip elastic_dashboard.app --symlinks
- name: Upload artifact
if: ${{ matrix.build-option != 'windows' }}
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact-name }}
path: ${{ matrix.artifact-path }}
if-no-files-found: error
- name: Upload windows portable
if: ${{ matrix.build-option == 'windows' }}
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact-name }}_portable
path: ${{ matrix.artifact-path }}
if-no-files-found: error
- name: Create macOS installer
if: ${{ matrix.build-option == 'macos' }}
uses: L-Super/[email protected]
with:
dmg_name: build/macos/Build/Products/Release/elastic-setup
src_dir: build/macos/Build/Products/Release/elastic_dashboard.app
- name: Upload macOS installer
if: ${{ matrix.build-option == 'macos' }}
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact-name }}_installer
path: build/macos/Build/Products/Release/elastic-setup.dmg
if-no-files-found: error
- name: Create windows installer
if: ${{ matrix.build-option == 'windows' }}
uses: Minionguyjpro/[email protected]
with:
path: installer_setup_script.iss
options: /O+
- name: Upload windows installer
if: ${{ matrix.build-option == 'windows' }}
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact-name }}_installer
path: "build/windows/x64/installer"
if-no-files-found: error
build-wpilib:
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
build-option: "windows"
artifact-path: "build/windows/x64/runner/Release"
artifact-name: Elastic-WPILib-Windows
- os: macos-latest
build-option: "macos"
artifact-path: "build/macos/Build/Products/Release/Elastic-WPILib-macOS.tar.gz"
artifact-name: Elastic-WPILib-macOS
- os: ubuntu-22.04
build-option: "linux"
artifact-path: "build/linux/x64/release/bundle"
artifact-name: Elastic-WPILib-Linux
name: "Build - ${{ matrix.artifact-name }}"
needs: [formatting-analysis, test]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Install flutter build dependencies
if: ${{ matrix.build-option == 'linux' }}
run: |
sudo apt-get update -y
sudo apt-get install -y libglu1-mesa ninja-build libgtk-3-dev liblzma-dev
- name: Setup flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
cache: true
cache-path: ${{ runner.tool_cache }}/flutter/${{ matrix.build-option }}
- name: Install dependencies
run: flutter pub get
- name: Generate icons
run: dart run flutter_launcher_icons -f wpilib_icon_config.yaml
- name: Build app
run: flutter build ${{ matrix.build-option }} --dart-define=ELASTIC_WPILIB=true
- name: Zip release
if: ${{ matrix.build-option == 'macos' }}
run: |
cd build/macos/Build/Products/Release
tar -zcvf ${{ matrix.artifact-name }}.tar.gz elastic_dashboard.app
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact-name }}
path: ${{ matrix.artifact-path }}
if-no-files-found: error