Skip to content

Commit 720fa79

Browse files
committed
Fail job if there are failed tests
1 parent e3d4e04 commit 720fa79

2 files changed

Lines changed: 111 additions & 1 deletion

File tree

.github/workflows/main.yml

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,3 +138,113 @@ jobs:
138138
name: ${{ matrix.tool.name }}-report
139139
path: |
140140
catroid/build/reports/html/${{ matrix.tool.name }}.html
141+
142+
ui-tests-main:
143+
name: UI Tests main
144+
runs-on: ubuntu-latest
145+
steps:
146+
- name: checkout
147+
uses: actions/checkout@v4
148+
149+
- name: Setup JDK ${{ env.JAVA_VERSION }}
150+
uses: actions/setup-java@v4
151+
with:
152+
distribution: "temurin"
153+
java-version: ${{ env.JAVA_VERSION }}
154+
cache: gradle
155+
156+
- name: Setup Gradle
157+
uses: gradle/actions/setup-gradle@v4
158+
159+
- name: Set up Android SDK
160+
if: ${{ env.ACT }} # Only run on local act setups, as GitHub Actions provides the Android SDK on Ubuntu
161+
uses: android-actions/setup-android@v2
162+
163+
- name: Install Emulator Dependencies
164+
if: ${{ env.ACT }} # Only run on local act setups, as GitHub Actions provides the dependencies on Ubuntu
165+
run: |
166+
sudo apt-get update
167+
sudo apt-get install -y \
168+
libxtst6 \
169+
libdbus-1-3 \
170+
libpulse0\
171+
172+
#\
173+
#libnss3 \
174+
#libxcomposite1 \
175+
#libxcursor1 \
176+
#libasound2t64 \
177+
#libgl1 \
178+
#libxkbcommon0 \
179+
#libxml2 \
180+
#libgbm1 \
181+
#libxrender1 \
182+
#libglib2.0-0t64
183+
#some dependencies provided by ai but not breaking if left out (maybe unnecessary)
184+
185+
- name: Enable KVM
186+
if: ${{ env.ACT }} # Only run on local act setups, as normal KVM Setup doesn't work there
187+
run: |
188+
# 1. Create the kvm group
189+
sudo groupadd -f kvm
190+
191+
# 2. Add current user to the group
192+
sudo usermod -aG kvm $USER
193+
194+
# 3. Create the rule file (good for documentation, though it might not trigger)
195+
sudo mkdir -p /etc/udev/rules.d/
196+
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
197+
198+
# 4. MANUALLY set permissions (This bypasses the need for udevadm reload)
199+
if [ -e /dev/kvm ]; then
200+
sudo chown root:kvm /dev/kvm
201+
sudo chmod 0666 /dev/kvm
202+
echo "Successfully set permissions for /dev/kvm"
203+
else
204+
echo "ERROR: /dev/kvm not found. Did you use the --device flag in act?"
205+
exit 1
206+
fi
207+
#sudo udevadm control --reload-rules
208+
#sudo udevadm trigger --name-match=kvm
209+
210+
- name: Enable KVM Github
211+
if: ${{ !env.ACT }} # Only run on GitHub-hosted runners
212+
run: |
213+
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
214+
sudo udevadm control --reload-rules
215+
sudo udevadm trigger --name-match=kvm
216+
217+
- name: run tests
218+
uses: reactivecircus/android-emulator-runner@v2
219+
with:
220+
api-level: 35
221+
force-avd-creation: true
222+
emulator-boot-timeout: 900
223+
emulator-options: >
224+
-no-window
225+
-no-boot-anim
226+
-no-audio
227+
-camera-back none
228+
-camera-front none
229+
-qemu -append panic=1
230+
arch: x86_64
231+
script: |
232+
# 1. Compile
233+
./gradlew compileCatroidDebugSources compileCatroidDebugAndroidTestSources
234+
235+
# 2. Standard Test-Run without Coverage
236+
./gradlew disableAnimations -PenableCoverage createCatroidDebugAndroidTestCoverageReport -Pandroid.testInstrumentationRunnerArguments.class=org.catrobat.catroid.testsuites.UiEspressoPullRequestTriggerSuite
237+
| grep "There were failing tests."
238+
- name: Upload Test Reports Folder
239+
uses: actions/upload-artifact@v4
240+
if: always() # IMPORTANT: Upload reports regardless of status
241+
with:
242+
name: reports
243+
path: catroid/build/reports/androidTests/connected/debug/flavors/catroid/
244+
245+
- name: Upload Coverage Report
246+
uses: actions/upload-artifact@v4
247+
if: always() # IMPORTANT: Upload reports regardless of status
248+
with:
249+
name: coverage-report
250+
path: catroid/build/reports/coverage/androidTest/catroid/debug/connected/

.github/workflows/ui.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ jobs:
109109
110110
# 2. Standard Test-Run without Coverage
111111
./gradlew disableAnimations -PenableCoverage createCatroidDebugAndroidTestCoverageReport -Pandroid.testInstrumentationRunnerArguments.class=org.catrobat.catroid.testsuites.UiEspressoPullRequestTriggerSuite
112-
112+
| grep "There were failing tests."
113113
- name: Upload Test Reports Folder
114114
uses: actions/upload-artifact@v4
115115
if: always() # IMPORTANT: Upload reports regardless of status

0 commit comments

Comments
 (0)