-
Notifications
You must be signed in to change notification settings - Fork 71
148 lines (127 loc) · 4.08 KB
/
build-test.yaml
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
name: build-test
on:
push:
branches:
- main
paths-ignore:
- "CHANGELOG.md"
- "LICENSE"
- "README.md"
- "translations/**"
pull_request:
paths-ignore:
- "CHANGELOG.md"
- "LICENSE"
- "README.md"
- "translations/**"
workflow_dispatch:
concurrency:
# Cancels the workflow
# when another event in the same context happens.
# If it's a PR, context is the pull request number.
# Otherwise, it uses the Git reference(branch or tag name).
group: >
${{ github.workflow }}
${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build:
name: ${{ matrix.runner }} / ${{ matrix.target }}
runs-on: ${{ matrix.runner }}
timeout-minutes: 60
strategy:
fail-fast: false # Important
matrix:
runner: [ubuntu-latest, windows-latest, macos-latest]
target: [android, web] # On all platforms
include:
# Specify targets for each platform
- runner: ubuntu-latest
target: linux
- runner: windows-latest
target: windows
- runner: macos-latest
target: macos
- runner: macos-latest
target: ios
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Checkout submodules
run: git submodule update --init --recursive
# # Automaticallly setup cache (Doesn't work yet)
# - name: Setup Nix
# if: matrix.runner == 'ubuntu-latest' || matrix.runner == 'macos-latest'
# uses: DeterminateSystems/nix-installer-action@main
# - name: Setup Magic Nix Cache
# if: matrix.runner == 'ubuntu-latest' || matrix.runner == 'macos-latest'
# uses: DeterminateSystems/magic-nix-cache-action@main
# - name: Run Nix Flake Check
# if: matrix.runner == 'ubuntu-latest' || matrix.runner == 'macos-latest'
# run: nix flake check
# Manually setup cache
- name: Setup cache
uses: actions/cache@v3
with:
path: |
~/.pub-cache
~/.cargo
~/.gradle
~/.android
/usr/local/lib/android/
./example/build
key: manual-cache-${{ matrix.runner }}
- name: Setup Flutter toolchain
uses: subosito/flutter-action@v2
with:
channel: "stable"
cache: true
- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Setup Rust cache
uses: Swatinem/rust-cache@v2
with:
prefix-key: "rust-cache"
- name: Setup Ninja and GTK3 toolchain (Only Linux target)
if: matrix.target == 'linux'
run: |
sudo apt-get update -y
sudo apt-get install -y ninja-build libgtk-3-dev
- name: Setup Java toolchain (Only Android target)
if: matrix.target == 'android'
uses: actions/setup-java@v3
with:
distribution: "zulu"
java-version: "11"
cache: "gradle"
- name: Fetch dependencies
working-directory: example/
run: flutter pub get
- name: Build example Flutter app
if: matrix.target == 'linux'
working-directory: example/
run: flutter build linux
- name: Build example Flutter app
if: matrix.target == 'android'
working-directory: example/
run: |
flutter build apk
flutter build appbundle
- name: Build example Flutter app
if: matrix.target == 'windows'
working-directory: example/
run: flutter build windows
- name: Build example Flutter app
if: matrix.target == 'macos'
working-directory: example/
run: flutter build macos
- name: Build example Flutter app
if: matrix.target == 'ios'
working-directory: example/
run: flutter build ios --no-codesign
- name: Build example Flutter app
if: matrix.target == 'web'
working-directory: example/
run: |
dart run rust_in_flutter wasm --release
flutter build web