forked from zecdev/ZecKit
-
Notifications
You must be signed in to change notification settings - Fork 1
141 lines (125 loc) · 4.64 KB
/
Copy pathci-action-test.yml
File metadata and controls
141 lines (125 loc) · 4.64 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
# ============================================================
# ZecKit – CI Self-Test for the Published Action
# ============================================================
# Exercises the root action.yml and the reusable golden-e2e
# workflow against both backends on every push/PR to main.
#
# This is also the workflow that prospective callers can use as
# a copy-paste reference for their own repos.
# ============================================================
name: Action CI Self-Test
on:
push:
branches:
- main
- m3-implementation
- 'release/**'
pull_request:
branches:
- main
- m3-implementation
workflow_dispatch:
inputs:
backend:
description: 'Backend to test (zaino | lwd | both)'
required: false
default: 'both'
upload_artifacts:
description: 'Artifact upload policy (always | on-failure | never)'
required: false
default: 'on-failure'
permissions:
contents: read
packages: read
# ============================================================
# STRATEGY MATRIX
# ============================================================
jobs:
# ----------------------------------------------------------
# Determine which backends to run based on trigger
# ----------------------------------------------------------
set-matrix:
name: Set test matrix
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.matrix.outputs.matrix }}
steps:
- name: Build backend matrix
id: matrix
shell: bash
run: |
requested="${{ github.event.inputs.backend }}"
if [[ "$requested" == "zaino" ]]; then
echo 'matrix={"backend":["zaino"]}' >> "$GITHUB_OUTPUT"
elif [[ "$requested" == "lwd" ]]; then
echo 'matrix={"backend":["lwd"]}' >> "$GITHUB_OUTPUT"
else
# Default: both backends
echo 'matrix={"backend":["zaino","lwd"]}' >> "$GITHUB_OUTPUT"
fi
# ----------------------------------------------------------
# Run the golden E2E flow via the COMPOSITE ACTION directly
# ----------------------------------------------------------
composite-action-test:
name: "Composite Action – ${{ matrix.backend }}"
needs: set-matrix
runs-on: ubuntu-latest
timeout-minutes: 45
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.set-matrix.outputs.matrix) }}
steps:
- name: Checkout ZecKit
uses: actions/checkout@v4
- name: Run ZecKit E2E composite action (self-test)
id: e2e
uses: ./
with:
backend: ${{ matrix.backend }}
startup_timeout_minutes: '20'
block_wait_seconds: '75'
allow_build: 'false'
send_amount: '0.05'
send_memo: 'CI self-test – ${{ matrix.backend }}'
upload_artifacts: ${{ github.event.inputs.upload_artifacts || 'on-failure' }}
ghcr_token: ${{ secrets.GITHUB_TOKEN }}
- name: Print action outputs
if: always()
shell: bash
run: |
echo "unified_address : ${{ steps.e2e.outputs.unified_address }}"
echo "transparent_address : ${{ steps.e2e.outputs.transparent_address }}"
echo "shield_txid : ${{ steps.e2e.outputs.shield_txid }}"
echo "send_txid : ${{ steps.e2e.outputs.send_txid }}"
echo "final_orchard_balance : ${{ steps.e2e.outputs.final_orchard_balance }} ZEC"
echo "block_height : ${{ steps.e2e.outputs.block_height }}"
echo "test_result : ${{ steps.e2e.outputs.test_result }}"
- name: Assert test_result is 'pass'
shell: bash
run: |
result="${{ steps.e2e.outputs.test_result }}"
if [[ "$result" != "pass" ]]; then
echo "::error::Golden E2E returned test_result='$result' (expected 'pass')."
exit 1
fi
echo "✓ test_result=pass"
# ----------------------------------------------------------
# Gate: all matrix jobs must pass
# ----------------------------------------------------------
ci-gate:
name: CI Gate
needs:
- composite-action-test
runs-on: ubuntu-latest
if: always()
steps:
- name: Check all jobs
shell: bash
run: |
composite="${{ needs.composite-action-test.result }}"
echo "composite-action-test : $composite"
if [[ "$composite" != "success" ]]; then
echo "::error::One or more composite-action jobs failed."
exit 1
fi
echo "✓ All CI jobs passed."