-
-
Notifications
You must be signed in to change notification settings - Fork 179
151 lines (131 loc) · 5.15 KB
/
mobile-curriculum-e2e.yml
File metadata and controls
151 lines (131 loc) · 5.15 KB
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
name: CI - Mobile curriculum test
on:
workflow_dispatch:
pull_request:
branches:
- main
paths:
- "mobile-app/**"
- ".github/**"
push:
branches:
- main
schedule:
- cron: "0 0 * * *"
jobs:
mobile-test:
name: Test curriculum for mobile app
runs-on: ubuntu-22.04
timeout-minutes: 60
strategy:
matrix:
gradle-version: [8.7]
java-version: [17]
android-api-level: [35]
node-version: [22]
pnpm-version: [10]
flutter-version: ["3.38.x"]
steps:
- name: Remove unused software
working-directory: /
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
echo "Free space:"
df -h /
- 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: Gradle cache - ${{ matrix.gradle-version }}
uses: gradle/actions/setup-gradle@d9c87d481d55275bb5441eef3fe0e46805f9ef70 # v3
with:
gradle-version: ${{ matrix.gradle-version }}
- name: Setup Java - ${{ matrix.java-version }}
uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4
with:
distribution: "temurin"
java-version: ${{ matrix.java-version }}
- name: AVD cache - ${{ matrix.android-api-level }}
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-${{ matrix.android-api-level }}
- name: Create AVD and generate snapshot for caching - ${{ matrix.android-api-level }}
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@1dcd0090116d15e7c562f8db72807de5e036a4ed # v2
with:
api-level: ${{ matrix.android-api-level }}
target: google_apis
arch: x86_64
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: false
script: echo "Generated AVD snapshot for caching."
- name: Checkout freeCodeCamp main repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
repository: freeCodeCamp/freeCodeCamp
path: freeCodeCamp
- name: Checkout mobile repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
path: mobile
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: ${{ matrix.node-version }}
- name: Setup pnpm - ${{ matrix.pnpm-version }}
uses: pnpm/action-setup@v2
with:
version: ${{ matrix.pnpm-version }}
- name: Setup Flutter - ${{ matrix.flutter-version }}
uses: subosito/flutter-action@e938fdf56512cc96ef2f93601a5a40bde3801046 # v2
with:
flutter-version: ${{ matrix.flutter-version }}
channel: "stable"
cache: true
cache-key: flutter-${{ matrix.flutter-version }}
cache-path: ${{ runner.tool_cache }}/flutter
- name: Set freeCodeCamp Environment Variables
working-directory: freeCodeCamp
run: |
cp sample.env .env
echo "SHOW_UPCOMING_CHANGES=true" >> .env
- name: Create dummy mobile app .env file
working-directory: mobile/mobile-app
run: touch .env
- name: Install and Build Curriculum
working-directory: freeCodeCamp
run: |
pnpm install
pnpm run compile:ts
pnpm run build:curriculum
pnpm run clean:packages
- name: Install mobile app dependencies
working-directory: mobile/mobile-app
run: flutter pub get
- name: Run curriculum tests in emulator - ${{ matrix.android-api-level }}
uses: reactivecircus/android-emulator-runner@1dcd0090116d15e7c562f8db72807de5e036a4ed # v2
with:
api-level: ${{ matrix.android-api-level }}
target: google_apis
arch: x86_64
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
script: cd mobile/mobile-app && if adb shell pm list packages | grep -q org.freecodecamp; then adb uninstall org.freecodecamp; fi && dart integration_test_runner.dart --curriculum ${RUNNER_DEBUG:+--debug}
- name: Upload failed tests logs
if: failure()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: test_runner_results.txt
path: mobile/mobile-app/integration_test/test_runner/test_runner_results.txt
if-no-files-found: error
retention-days: 7