-
Notifications
You must be signed in to change notification settings - Fork 1
174 lines (144 loc) · 5.69 KB
/
integration-tests.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
name: Integration Tests
on:
pull_request:
branches: [ "main" ]
jobs:
web-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.22.1'
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: '16'
- name: Install dependencies
run: |
cd proxy-server
npm install
cd ../..
flutter pub get
working-directory: ./integrationtestapp
- name: Set up Chrome Dependencies
run: |
sudo apt-get update
sudo apt-get install --no-install-recommends -y \
libglib2.0-0 libatk1.0-0 libatk-bridge2.0-0 libgdk-pixbuf2.0-0 \
libgtk-3-0 libgbm-dev libnss3-dev libxss-dev libasound2t64 \
xvfb fonts-liberation libu2f-udev xdg-utils
wget http://mirrors.kernel.org/ubuntu/pool/universe/g/gconf/libgconf-2-4_3.2.6-6ubuntu1_amd64.deb
sudo dpkg -i libgconf-2-4_3.2.6-6ubuntu1_amd64.deb || true
sudo apt-get install -f -y
- name: Set up Google Chrome and ChromeDriver
uses: browser-actions/setup-chrome@v1
with:
chrome-version: 131
install-chromedriver: true
install-dependencies: false
- name: Start Xvfb
run: |
sudo apt-get install -y xvfb
export DISPLAY=:99
sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 &
- name: Start ChromeDriver
run: |
nohup chromedriver --port=4444 &
sleep 5
- name: Start Proxy Server
run: |
nohup node integrationtestapp/proxy-server/proxy_server.js &
sleep 5
env:
MAILOSAUR_API_KEY: ${{ secrets.MAILOSAUR_API_KEY }}
- name: Run Web tests with XVFB
run: |
for test in integration_test/*.dart; do
xvfb-run --auto-servernum --server-args="-screen 0 1280x1024x24" flutter drive --driver=test_driver/integration_test.dart --target=$test -d chrome --web-port=4200 --dart-define=MAILOSAUR_API_KEY=${{ secrets.MAILOSAUR_API_KEY }}
done
working-directory: ./integrationtestapp
env:
MAILOSAUR_API_KEY: ${{ secrets.MAILOSAUR_API_KEY }}
android-tests:
runs-on: ubuntu-latest
needs: web-tests
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Java
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '17'
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.22.1'
- name: Enable KVM
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
- name: Install Android Command Line Tools
run: |
mkdir -p $HOME/android-sdk/cmdline-tools
curl -o commandlinetools.zip https://dl.google.com/android/repository/commandlinetools-linux-9477386_latest.zip
unzip commandlinetools.zip -d $HOME/android-sdk/cmdline-tools
mv $HOME/android-sdk/cmdline-tools/cmdline-tools $HOME/android-sdk/cmdline-tools/latest
echo "export ANDROID_HOME=$HOME/android-sdk" >> $GITHUB_ENV
echo "export PATH=$ANDROID_HOME/cmdline-tools/latest/bin:$ANDROID_HOME/platform-tools:$PATH" >> $GITHUB_ENV
echo "export PATH=$PATH:$ANDROID_HOME/cmdline-tools/latest/bin:$ANDROID_HOME/platform-tools" >> $GITHUB_PATH
- name: Accept SDK Licenses and Install Tools
run: |
yes | sdkmanager --licenses
sdkmanager "platform-tools" "platforms;android-35" "system-images;android-35;google_apis;x86_64"
- name: Install dependencies
run: flutter pub get
working-directory: ./integrationtestapp
- name: Set environment variables
env:
MAILOSAUR_API_KEY: ${{ secrets.MAILOSAUR_API_KEY }}
run: |
echo "export MAILOSAUR_API_KEY=${{ secrets.MAILOSAUR_API_KEY }}" >> $GITHUB_ENV
- name: Start emulator and run tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 35
target: google_apis
arch: x86_64
profile: Nexus 6
force-avd-creation: true
emulator-boot-timeout: 600
working-directory: ./integrationtestapp
script: flutter test integration_test/*.dart -d emulator-5554 --dart-define=MAILOSAUR_API_KEY=${{ secrets.MAILOSAUR_API_KEY }}
ios-tests:
runs-on: macos-latest
needs: android-tests
steps:
- uses: actions/checkout@v4
- name: Set up Xcode 15.4
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '15.4'
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.22.1'
- name: Install dependencies
run: flutter pub get
working-directory: ./integrationtestapp
- name: Install CocoaPods
run: pod install --project-directory=ios
working-directory: ./integrationtestapp
- name: Install simulator
id: install-simulator
uses: futureware-tech/simulator-action@v3
with:
model: 'iPhone 15'
- name: Run iOS tests
run: flutter test integration_test/*.dart -d ${{ steps.install-simulator.outputs.udid }} --dart-define=MAILOSAUR_API_KEY=${{ secrets.MAILOSAUR_API_KEY }}
working-directory: ./integrationtestapp
env:
MAILOSAUR_API_KEY: ${{ secrets.MAILOSAUR_API_KEY }}