2020-06-23 14:40:51 +03:00
name : Tests
# https://dev.to/edvinasbartkus/running-react-native-detox-tests-for-ios-and-android-on-github-actions-2ekn
# https://medium.com/@reime005/the-best-ci-cd-for-react-native-with-e2e-support-4860b4aaab29
2023-10-07 22:31:18 +01:00
env :
TRAVIS : 1
HD_MNEMONIC : ${{ secrets.HD_MNEMONIC }}
HD_MNEMONIC_BIP84 : ${{ secrets.HD_MNEMONIC_BIP84 }}
2020-06-30 10:53:33 +01:00
on : [ pull_request]
2020-06-23 14:40:51 +03:00
jobs :
test :
2024-05-01 09:50:50 +01:00
runs-on : ubuntu-latest
2020-06-23 14:40:51 +03:00
steps :
- name : Checkout project
2024-04-08 21:45:10 +01:00
uses : actions/checkout@v4
2020-06-23 14:40:51 +03:00
- name : Specify node version
2024-04-08 21:45:10 +01:00
uses : actions/setup-node@v4
2020-06-23 14:40:51 +03:00
with :
2024-04-08 21:45:10 +01:00
node-version : 20
2020-06-23 14:40:51 +03:00
- name : Use npm caches
2024-04-08 21:45:10 +01:00
uses : actions/cache@v4
2020-06-23 14:40:51 +03:00
with :
path : ~/.npm
key : ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys : |
${{ runner.os }}-npm-
- name : Use node_modules caches
id : cache-nm
2024-04-08 21:45:10 +01:00
uses : actions/cache@v4
2020-06-23 14:40:51 +03:00
with :
path : node_modules
key : ${{ runner.os }}-nm-${{ hashFiles('package-lock.json') }}
- name : Install node_modules
if : steps.cache-nm.outputs.cache-hit != 'true'
run : npm install
- name : Run tests
run : npm test || npm test || npm test
env :
2023-02-09 22:13:47 -05:00
BIP47_HD_MNEMONIC : ${{ secrets.BIP47_HD_MNEMONIC}}
2020-06-23 14:40:51 +03:00
HD_MNEMONIC : ${{ secrets.HD_MNEMONIC }}
HD_MNEMONIC_BIP49 : ${{ secrets.HD_MNEMONIC_BIP49 }}
HD_MNEMONIC_BIP49_MANY_TX : ${{ secrets.HD_MNEMONIC_BIP49_MANY_TX }}
HD_MNEMONIC_BIP84 : ${{ secrets.HD_MNEMONIC_BIP84 }}
HD_MNEMONIC_BREAD : ${{ secrets.HD_MNEMONIC_BREAD }}
2021-06-16 12:34:19 +01:00
FAULTY_ZPUB : ${{ secrets.FAULTY_ZPUB }}
MNEMONICS_COBO : ${{ secrets.MNEMONICS_COBO }}
MNEMONICS_COLDCARD : ${{ secrets.MNEMONICS_COLDCARD }}
2020-06-23 14:40:51 +03:00
e2e :
2024-05-01 09:50:50 +01:00
runs-on : ubuntu-latest
2020-06-23 14:40:51 +03:00
steps :
2022-06-03 17:54:05 +01:00
- name : checkout
2024-04-08 21:45:10 +01:00
uses : actions/checkout@v4
2024-05-01 09:50:50 +01:00
with :
fetch-depth : 1
- name : Free Disk Space
uses : jlumbroso/free-disk-space@main
with :
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache : false
android : false
dotnet : true
haskell : true
large-packages : true
docker-images : true
swap-storage : true
- name : npm and gradle caches in /mnt
run : |
rm -rf ~/.npm
rm -rf ~/.gradle
sudo mkdir -p /mnt/.npm
sudo mkdir -p /mnt/.gradle
sudo chown -R runner /mnt/.npm
sudo chown -R runner /mnt/.gradle
ln -s /mnt/.npm /home/runner/
ln -s /mnt/.gradle /home/runner/
- name : Create artifacts directory on /mnt
run : |
sudo mkdir -p /mnt/artifacts
sudo chown -R runner /mnt/artifacts
2020-06-23 14:40:51 +03:00
- name : Specify node version
2024-04-08 21:45:10 +01:00
uses : actions/setup-node@v4
2020-06-23 14:40:51 +03:00
with :
2024-04-08 21:45:10 +01:00
node-version : 20
2020-06-23 14:40:51 +03:00
- name : Use gradle caches
2024-04-08 21:45:10 +01:00
uses : actions/cache@v4
2020-06-23 14:40:51 +03:00
with :
2024-01-17 13:11:35 +00:00
path : |
~/.gradle/caches
~/.gradle/wrapper
2024-04-08 21:51:10 +01:00
key : ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
2020-06-23 14:40:51 +03:00
restore-keys : |
${{ runner.os }}-gradle-
- name : Use npm caches
2024-04-08 21:45:10 +01:00
uses : actions/cache@v4
2020-06-23 14:40:51 +03:00
with :
path : ~/.npm
key : ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys : |
${{ runner.os }}-npm-
2022-06-03 17:54:05 +01:00
- name : Install node_modules
2024-05-01 09:50:50 +01:00
run : npm install || npm install
2022-06-03 17:54:05 +01:00
2020-06-23 14:40:51 +03:00
- name : Use specific Java version for sdkmanager to work
2024-05-01 09:50:50 +01:00
uses : actions/setup-java@v4
2020-06-23 14:40:51 +03:00
with :
2022-07-27 19:18:15 +01:00
distribution : 'temurin'
2024-04-27 20:52:53 +01:00
java-version : '17'
2020-06-23 14:40:51 +03:00
2024-05-01 09:50:50 +01:00
- 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
2020-06-23 14:40:51 +03:00
- name : Build
run : npm run e2e:release-build
2024-05-01 09:50:50 +01:00
- name : Run tests
2023-10-07 22:31:18 +01:00
uses : reactivecircus/android-emulator-runner@v2
with :
api-level : 31
avd-name : Pixel_API_29_AOSP
force-avd-creation : false
emulator-options : -no -window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim -camera-back none -camera-front none -partition-size 2047
arch : x86_64
2024-05-01 09:50:50 +01:00
script : npm run e2e:release-test -- --record-videos all --record-logs all --take-screenshots all --headless -d 200000 -R 3 --artifacts-location /mnt/artifacts
2020-06-23 14:40:51 +03:00
2024-05-06 15:08:55 +01:00
- uses : actions/upload-artifact@v4
2020-06-23 14:40:51 +03:00
if : failure()
with :
name : e2e-test-videos
2024-05-01 09:50:50 +01:00
path : /mnt/artifacts/