162 lines
4.6 KiB
YAML
162 lines
4.6 KiB
YAML
name: Tests
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
branches:
|
|
- master
|
|
pull_request:
|
|
branches:
|
|
- master
|
|
- develop
|
|
|
|
jobs:
|
|
scan-build:
|
|
name: Clang Static Analyzer
|
|
runs-on: ubuntu-latest
|
|
|
|
container:
|
|
image: ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder:latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Build with Clang Static Analyzer
|
|
run: |
|
|
make clean
|
|
scan-build --use-cc=clang -analyze-headers -enable-checker security -enable-checker unix -enable-checker valist -o scan-build --status-bugs make default
|
|
- uses: actions/upload-artifact@v2
|
|
if: failure()
|
|
with:
|
|
name: scan-build
|
|
path: scan-build
|
|
|
|
# =====================================================
|
|
# ZEMU TESTS
|
|
# =====================================================
|
|
|
|
building_for_e2e_zemu_tests:
|
|
name: Building binaries for E2E tests
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder:latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Build testing binaries
|
|
run: cd tests/zemu/ && ./build_local_test_elfs.sh
|
|
|
|
- name: Upload app binaries
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: e2e_elfs
|
|
path: ./tests/zemu/elfs/
|
|
|
|
jobs-e2e-zemu-tests:
|
|
name: E2E Zemu tests
|
|
needs: [building_for_e2e_zemu_tests]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Test
|
|
run: |
|
|
id
|
|
echo $HOME
|
|
echo $DISPLAY
|
|
- name: Checkout
|
|
uses: actions/checkout@v2
|
|
|
|
- run: sudo apt-get update -y && sudo apt-get install -y libusb-1.0.0 libudev-dev
|
|
|
|
- name: Install node
|
|
uses: actions/setup-node@v2
|
|
with:
|
|
node-version: "14.4.0"
|
|
|
|
- name: Install yarn
|
|
run: npm install -g yarn
|
|
|
|
- name: Build/Install build js deps
|
|
run: cd tests/zemu/ && yarn install
|
|
|
|
- name: Create tmp folder for artifacts
|
|
run: mkdir tests/zemu/elfs
|
|
|
|
- name: Download app binaries
|
|
uses: actions/download-artifact@v2
|
|
with:
|
|
path: tmp/
|
|
|
|
- name: Gather elfs
|
|
run: cp `find tmp/e2e_elfs/ -name "*.elf"` tests/zemu/elfs/
|
|
|
|
- name: Run zemu tests
|
|
run: cd tests/zemu/ && yarn test
|
|
|
|
# =====================================================
|
|
# SPECULOS TESTS
|
|
# =====================================================
|
|
|
|
building_for_e2e_speculos_tests:
|
|
name: Building binaries for E2E tests
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder:latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Build testing binaries
|
|
run: mkdir tests/speculos/elfs
|
|
run: make clean; make DEBUG=1 NFT_TESTING_KEY=1 BOLOS_SDK=$NANOS_SDK; mv bin/app.elf .; mv app.elf nanos.elf; mv nanos.elf tests/speculos/elfs
|
|
run: make clean; make DEBUG=1 NFT_TESTING_KEY=1 BOLOS_SDK=$NANOX_SDK; mv bin/app.elf .; mv app.elf nanox.elf; mv nanox.elf tests/speculos/elfs
|
|
run: make clean; make DEBUG=1 NFT_TESTING_KEY=1 BOLOS_SDK=$NANOSP_SDK; mv bin/app.elf .; mv app.elf nanosp.elf; mv nanosp.elf tests/speculos/elfs
|
|
|
|
- name: Upload app binaries
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: e2e_elfs
|
|
path: ./tests/speculos/elfs
|
|
|
|
|
|
jobs-e2e-speculos-tests:
|
|
name: Speculos tests
|
|
needs: [building_for_e2e_speculos_tests]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Test
|
|
run: |
|
|
id
|
|
echo $HOME
|
|
echo $DISPLAY
|
|
- name: Checkout
|
|
uses: actions/checkout@v2
|
|
|
|
- run: sudo apt-get update -y && sudo apt-get install -y libusb-1.0.0 libudev-dev
|
|
|
|
- name: Install Python3
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: "3.8.10"
|
|
|
|
- name: Install dependencies
|
|
run: cd tests/speculos
|
|
run: python3 -m pip install --extra-index-url https://test.pypi.org/simple/ -r requirements.txt
|
|
|
|
- name: Create tmp folder for artifacts
|
|
run: mkdir tests/speculos/elfs
|
|
|
|
- name: Download app binaries
|
|
uses: actions/download-artifact@v2
|
|
with:
|
|
path: tmp/
|
|
|
|
- name: Gather elfs
|
|
run: cp `find tmp/e2e_elfs/ -name "*.elf"` tests/speculos/elfs/
|
|
|
|
- name: Run speculos tests
|
|
run: cd tests/speculos
|
|
run: pytest --model nanos --path ./elfs/nanos.elf --display headless
|
|
run: pytest --model nanox --path ./elfs/nanox.elf --display headless
|
|
run: pytest --model nanosp --path ./elfs/nanosp.elf --display headless
|