-
Notifications
You must be signed in to change notification settings - Fork 71
122 lines (108 loc) · 3.57 KB
/
reusable_ragger_tests_latest_speculos.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
name: Functional tests using Ragger and latest speculos
on:
workflow_call:
inputs:
app_repository:
required: false
default: ${{ github.repository }}
type: string
app_branch_name:
required: false
default: ${{ github.ref }}
type: string
test_dir:
required: true
type: string
speculos_app_branch_name:
required: false
default: master
type: string
jobs:
build_application:
name: Build application using the reusable workflow
uses: LedgerHQ/ledger-app-workflows/.github/workflows/reusable_build.yml@v1
with:
app_repository: ${{ inputs.app_repository }}
app_branch_name: ${{ inputs.app_branch_name }}
upload_app_binaries_artifact: compiled_app_binaries-${{ inputs.app_branch_name }}
build_docker_image:
name: Build Speculos Docker image
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: Clone
uses: actions/checkout@v4
with:
ref: ${{ inputs.speculos_app_branch_name }}
submodules: recursive
fetch-depth: 0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build the Speculos docker
uses: docker/build-push-action@v4
with:
push: false
tags: ledgerhq/speculos:test
context: .
outputs: type=docker,dest=/tmp/speculos_image.tar
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: speculos_image-${{ inputs.app_branch_name }}
path: /tmp/speculos_image.tar
call_get_app_metadata:
name: Retrieve application metadata
uses: LedgerHQ/ledger-app-workflows/.github/workflows/_get_app_metadata.yml@v1
with:
app_repository: ${{ inputs.app_repository }}
app_branch_name: ${{ inputs.app_branch_name }}
ragger_tests:
name: Functional tests with Ragger
runs-on: ubuntu-latest
needs: [build_docker_image, build_application, call_get_app_metadata]
strategy:
fail-fast: false
matrix:
device: ${{ fromJSON(needs.call_get_app_metadata.outputs.compatible_devices) }}
steps:
- name: Clone
uses: actions/checkout@v4
with:
repository: ledgerHQ/speculos
ref: ${{ inputs.speculos_app_branch_name }}
submodules: recursive
fetch-depth: 0
- name: Clone
uses: actions/checkout@v4
with:
repository: ${{ inputs.app_repository }}
ref: ${{ inputs.app_branch_name }}
path: app
submodules: recursive
fetch-depth: 0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: speculos_image-${{ inputs.app_branch_name }}
path: /tmp
- name: Load image
run: |
docker load --input /tmp/speculos_image.tar
docker image ls -a
- name: Download app binaries
uses: actions/download-artifact@v4
with:
name: compiled_app_binaries-${{ inputs.app_branch_name }}
path: ${{ github.workspace }}/app/build
- name: Run and test Speculos docker
uses: addnab/docker-run-action@v3
with:
image: ledgerhq/speculos:test
options: -v ${{ github.workspace }}/app:/app
run: |
apt-get update && apt-get install -y gcc
pip install --extra-index-url https://test.pypi.org/simple/ -r /app/${{ inputs.test_dir }}/requirements.txt
pytest /app/${{ inputs.test_dir }}/ --tb=short -v --device ${{ matrix.device }}