-
Notifications
You must be signed in to change notification settings - Fork 470
142 lines (124 loc) · 5.14 KB
/
test-coin-tester.yml
File metadata and controls
142 lines (124 loc) · 5.14 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
name: "[Coin] - Coin Tester - Scheduled"
on:
schedule:
- cron: "9 16 * * 1-5"
pull_request:
branches-ignore:
- "smartling-content-updated**"
- "smartling-translation-completed**"
workflow_dispatch:
inputs:
chain:
description: "Coin family to test, separated by commas (,)"
required: false
default: ""
permissions:
id-token: write
contents: read
env:
COIN_TESTER_CURRENCIES: "evm polkadot solana bitcoin"
jobs:
is-affected:
runs-on: ubuntu-22.04
outputs:
is-affected: ${{ steps.detect.outputs.is-affected }}
matrix: ${{ steps.detect.outputs.matrix }}
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
ref: develop
fetch-depth: 0
- name: Checkout PR
if: ${{ github.event_name == 'pull_request' }}
env:
GH_TOKEN: ${{ github.token }}
run: |
gh pr checkout ${{ github.event.pull_request.number }}
- name: Checkout push/ref
if: ${{ github.event_name != 'pull_request' }}
run: git checkout $GITHUB_SHA
- name: Run live-common-affected
uses: LedgerHQ/ledger-live/tools/actions/live-common-affected@develop
id: affected
with:
ref: ${{ github.event_name == 'pull_request' && format('origin/{0}', github.event.pull_request.base.ref) || 'HEAD^' }}
- name: Build matrix from affected paths or manual input
id: detect
run: |
CHAINS=()
if [[ "${{ github.event_name }}" == "workflow_dispatch" && "${{ github.event.inputs.chain }}" != "" ]]; then
IFS=',' read -ra CHAINS <<< "${{ github.event.inputs.chain }}"
elif echo "${{ steps.affected.outputs.paths }}" | grep -qE "(^|/| )coin-tester(/| |$)"; then
echo "Detected base coin-tester → adding all coins"
for coin in $COIN_TESTER_CURRENCIES; do
CHAINS+=("$coin")
done
else
# Otherwise, only add coins that appear individually
for coin in $COIN_TESTER_CURRENCIES; do
if echo "${{ steps.affected.outputs.paths }}" | grep -q "$coin"; then
CHAINS+=("$coin")
fi
done
fi
# If it's a scheduled job and no chain is detected, run all chains by default
if [ "${{ github.event_name }}" == "schedule" ] && [ ${#CHAINS[@]} -eq 0 ]; then
for coin in $COIN_TESTER_CURRENCIES; do
CHAINS+=("$coin")
done
CHAIN_JSON=$(printf '%s\n' "${CHAINS[@]}" | jq -R . | jq -cs '{chain: .}')
echo "matrix=${CHAIN_JSON}" >> "$GITHUB_OUTPUT"
echo "is-affected=true" >> $GITHUB_OUTPUT
elif [ ${#CHAINS[@]} -eq 0 ]; then
echo "matrix={\"chain\":[]}" >> $GITHUB_OUTPUT
echo "is-affected=false" >> $GITHUB_OUTPUT
else
CHAIN_JSON=$(printf '%s\n' "${CHAINS[@]}" | jq -R . | jq -cs '{chain: .}')
echo "matrix=${CHAIN_JSON}" >> $GITHUB_OUTPUT
echo "is-affected=true" >> $GITHUB_OUTPUT
fi
- name: Debug affected paths (for troubleshooting)
run: |
echo "Affected paths: ${{ steps.affected.outputs.paths }}"
echo "Is affected: ${{ steps.detect.outputs.is-affected }}"
echo "Matrix: ${{ steps.detect.outputs.matrix }}"
coin-tester:
name: Coin Tester - ${{ matrix.chain }}
needs: is-affected
if: ${{ needs.is-affected.outputs.is-affected == 'true' }}
runs-on: public-ledgerhq-shared-small
continue-on-error: true
strategy:
matrix:
chain: ${{ fromJson(needs.is-affected.outputs.matrix).chain }}
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- name: Setup the caches
uses: LedgerHQ/ledger-live/tools/actions/composites/setup-caches@develop
with:
use-mise: true
gh-token: ${{ secrets.GITHUB_TOKEN }}
skip-turbo-cache: "false"
cache-develop-role-arn: ${{ secrets.AWS_CACHE_OIDC_ROLE_ARN_DEVELOP }}
cache-branch-role-arn: ${{ secrets.AWS_CACHE_OIDC_ROLE_ARN_BRANCH }}
nx-key: ${{ secrets.NX_KEY }}
accountId: ${{ secrets.AWS_ACCOUNT_ID_PROD }}
roleName: ${{ secrets.AWS_CACHE_ROLE_NAME }}
region: ${{ secrets.AWS_CACHE_REGION }}
turbo-server-token: ${{ secrets.TURBOREPO_SERVER_TOKEN }}
- name: Login to Ledger Artifactory
id: jfrog-login
timeout-minutes: 10
uses: LedgerHQ/actions-security/actions/jfrog-login@actions/jfrog-login-1
- name: Login to JFrog OCI Registry
uses: docker/login-action@v3
with:
registry: jfrog.ledgerlabs.net/bbs-oci-prod-green
username: ${{ steps.jfrog-login.outputs.oidc-user }}
password: ${{ steps.jfrog-login.outputs.oidc-token }}
- name: Setup environment
uses: LedgerHQ/ledger-live/tools/actions/composites/setup-coin-tester-env@develop
- name: Run Coin Tester
uses: LedgerHQ/ledger-live/tools/actions/composites/run-coin-tester@develop
with:
chain: ${{ matrix.chain }}