-
-
Notifications
You must be signed in to change notification settings - Fork 132
150 lines (132 loc) · 5.56 KB
/
slow_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
name: Slow Tests
on:
schedule:
# "High load times include the start of every hour.
# To decrease the chance of delay, schedule your workflow to run
# at a different time of the hour."
# We pick 8:25 UTC, aiming for "later than PST/UTC-8 night work" and
# "earlier than ADT/UTC-3 morning work".
- cron: '25 8 * * *'
workflow_dispatch: {} # no parameters
jobs:
check-up-to-date:
name: Already up to date?
runs-on: ubuntu-latest
if: ${{ github.event_name == 'schedule' && github.repository_owner == 'signalapp' && endsWith(github.repository, '-private') }}
outputs:
has-changes: ${{ steps.check.outputs.has-changes }}
steps:
- uses: actions/checkout@v4
- run: git log --after '24 hours ago' --exit-code || echo 'has-changes=true' >> $GITHUB_OUTPUT
id: check
android:
name: Build for Android
runs-on: ubuntu-latest
needs: [check-up-to-date]
if: ${{ always() && (needs.check-up-to-date.outputs.has-changes || github.event_name != 'schedule') }}
steps:
- name: Install protoc
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler
- uses: actions/checkout@v4
- run: rustup toolchain install $(cat rust-toolchain) --profile minimal --target aarch64-linux-android,armv7-linux-androideabi,x86_64-linux-android,i686-linux-android
- name: set up JDK 17
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
- run: bin/fetch-artifact -p android
- run: bin/build-aar --release --ringrtc-only
- name: Upload libraries
uses: actions/upload-artifact@v4
with:
name: libs
path: out/release/libs/*
retention-days: 2
android-emulator-tests:
name: Android Emulator Tests
# For hardware acceleration; see https://github.blog/changelog/2023-02-23-hardware-accelerated-android-virtualization-on-actions-windows-and-linux-larger-hosted-runners/
runs-on: ubuntu-latest-4-cores
needs: [android]
if: ${{ always() && needs.android.result == 'success' }}
strategy:
fail-fast: false
matrix:
arch: [x86, x86_64]
steps:
# For hardware acceleration; see https://github.blog/changelog/2023-02-23-hardware-accelerated-android-virtualization-on-actions-windows-and-linux-larger-hosted-runners/
- name: Enable KVM group perms
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
- uses: actions/checkout@v4
- name: Download JNI libraries
id: download
uses: actions/download-artifact@v4
with:
name: libs
path: out/release/libs
- name: set up JDK 17
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
# From reactivecircus/android-emulator-runner
- name: AVD cache
uses: actions/cache@v4
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-${{ matrix.arch }}-21-linux
- name: Create AVD and generate snapshot for caching
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@6b0df4b0efb23bb0ec63d881db79aefbc976e4b2 # v2.30.1
with:
arch: ${{ matrix.arch }}
api-level: 21
force-avd-creation: false
emulator-options: -no-window -noaudio -no-boot-anim
script: echo "Generated AVD snapshot for caching."
- name: Run tests
uses: reactivecircus/android-emulator-runner@6b0df4b0efb23bb0ec63d881db79aefbc976e4b2 # v2.30.1
with:
arch: ${{ matrix.arch }}
api-level: 21
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -noaudio -no-boot-anim
# It is correct that we use *debug*RingrtcLibDir below (specified by connectedCheck),
# even though we are using *release* artifacts.
script: ./gradlew ringrtc:android:connectedCheck -PdebugRingrtcLibDir=${{ github.workspace }}/out/release/libs -PwebrtcJar=${{ github.workspace }}/out/release/libs/libwebrtc.jar
ios:
name: Build for all iOS targets
runs-on: macos-13
needs: [check-up-to-date]
if: ${{ always() && (needs.check-up-to-date.outputs.has-changes || github.event_name != 'schedule') }}
steps:
- uses: actions/checkout@v4
- run: brew install protobuf coreutils # for grealpath
- run: rustup toolchain install $(cat rust-toolchain) --profile minimal --target x86_64-apple-ios,aarch64-apple-ios,aarch64-apple-ios-sim --component rust-src
- run: cargo install cbindgen
- run: bin/fetch-artifact -p ios
- run: bin/build-ios --release --ringrtc-only
report_failures:
name: Report Failures
runs-on: ubuntu-latest
needs: [android, android-emulator-tests, ios]
if: ${{ failure() && github.event_name == 'schedule' }}
permissions:
# createCommitComment is supposed to only need the default 'read' permissions...
# ...but maybe it's different for private repositories.
contents: write
steps:
- uses: actions/github-script@v7
with:
script: |
github.rest.repos.createCommitComment({
owner: context.repo.owner,
repo: context.repo.repo,
commit_sha: context.sha,
body: 'Failed Slow Tests: <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}>'
})