forked from edgarmsilva/QAEngineeringChallenge2
-
Notifications
You must be signed in to change notification settings - Fork 0
129 lines (108 loc) · 3.61 KB
/
actions.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
name: detox_e2e
on:
push:
branches:
- main
schedule:
- cron: "0 6 * * 1"
jobs:
test:
runs-on: macos-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
# - name: Gradle cache
# uses: gradle/actions/setup-gradle@v3
- name: Cache
id: cache
uses: actions/cache@v3
with:
path: |
native-app/node_modules
backend/node_modules
native-app/ios/build
key: ${{ runner.os }}-dependencies-${{ hashFiles('native-app/yarn.lock') }}-${{ hashFiles('backend/yarn.lock') }}
restore-keys: |
${{ runner.os }}-dependencies
# - name: Set up JDK 17
# uses: actions/setup-java@v2
# with:
# java-version: "17"
# distribution: "adopt"
- name: Set up Node.js
uses: actions/setup-node@v3
with:
cache: yarn
node-version-file: native-app/.nvmrc
- name: Install dependencies
run: |
cd native-app
yarn --frozen-lockfile --prefer-offline
yarn start &
sleep 5
- name: Install macOS dependencies
run: |
brew tap wix/brew
brew install applesimutils
env:
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_INSTALL_CLEANUP: 1
- name: Start API server in background
run: |
cd backend
yarn --frozen-lockfile --prefer-offline
yarn start &
sleep 5
- name: Install CocoaPods
run: cd native-app/ios ; pod install ; cd -
# - name: Build android binary
# run: |
# cd native-app
# echo 'ANDROID_BINARY_READY=false' >> $GITHUB_ENV
# yarn detox build --configuration android.debug && echo 'ANDROID_BINARY_READY=true' >> $GITHUB_ENV
# sleep 30
- name: Build ios binary
run: |
cd native-app
echo 'IOS_BINARY_READY=false' >> $GITHUB_ENV
yarn detox build --configuration ios.debug && echo 'IOS_BINARY_READY=true' >> $GITHUB_ENV
sleep 15
# - name: Wait for binaries
# run: |
# timeout=180
# end=$((SECONDS+timeout))
# while [ $SECONDS -lt $end ]; do
# echo "Checking if binaries are ready..."
# if [ "$ANDROID_BINARY_READY" = "true" ] && [ "$IOS_BINARY_READY" = "true" ]; then
# echo "All binaries are built."
# break
# fi
# echo "Checking again in 30 seconds..."
# sleep 30
# done
# # Final check if still not ready
# if [ "$ANDROID_BINARY_READY" != "true" ] || [ "$IOS_BINARY_READY" != "true" ]; then
# echo "Final check: binaries not complete within the timeout period."
# exit 1
# fi
# - name: Get device name
# id: device
# run: |
# AVD_NAME=$(node -p "require('./native-app/.detoxrc.js').devices.emulator.device.avdName")
# echo "AVD_NAME=$AVD_NAME" >> $GITHUB_ENV
# - name: Run android Detox tests
# uses: reactivecircus/android-emulator-runner@v2
# with:
# api-level: 31
# arch: x86_64
# avd-name: ${{ env.AVD_NAME }}
# emulator-boot-timeout: 1000
# script: cd native-app && yarn detox:test:android
- name: Run ios Detox tests
run: cd native-app && yarn detox:test:ios
- name: Upload artifacts
if: failure()
uses: actions/upload-artifact@v3
with:
name: detox-artifacts
path: native-app/e2e/test-assets/artifacts/