-
Notifications
You must be signed in to change notification settings - Fork 108
97 lines (86 loc) · 2.96 KB
/
reusable-e2e.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
name: Reusable E2E Testing Workflow
on:
workflow_call:
inputs:
make-target:
description: 'Makefile target to execute in the Start Test step'
required: true
type: string
timeout-minutes:
description: 'The maximum number of minutes the job can run'
type: number
default: 25
run:
description: 'Whether to run the job or not'
required: true
type: boolean
runs-on:
description: 'The runner to use for the job'
required: true
type: string
default: 'ubuntu-20.04'
zetanode-image:
description: 'docker image to use for zetanode'
required: true
type: string
enable-monitoring:
description: 'Enable the monitoring stack for this run'
type: boolean
default: false
jobs:
e2e:
if: ${{ inputs.run }}
runs-on: ${{ inputs.runs-on }}
timeout-minutes: ${{ inputs.timeout-minutes }}
strategy:
fail-fast: false
env:
ZETANODE_IMAGE: ${{ inputs.zetanode-image }}
steps:
- uses: actions/checkout@v4
- name: Login to Docker Hub registry
uses: docker/login-action@v3
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'zeta-chain/node'
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_READ_ONLY }}
- name: Login to github docker registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Enable monitoring
if: inputs.enable-monitoring
run: |
echo "NODE_COMPOSE_ARGS=${NODE_COMPOSE_ARGS:-} --profile monitoring --profile monitoring-cloudflared" >> $GITHUB_ENV
- name: Start Test
run: make ${{ inputs.make-target }}
- name: Get grafana URL
if: inputs.enable-monitoring
run: |
docker logs grafana-cloudflared 2>&1 | grep -oP 'https?://\S+\.trycloudflare\.com'
# use docker logs -f rather than docker attach to make sure we get the initial logs
- name: Watch Test
run: |
container_id=$(docker ps --filter "ancestor=orchestrator:latest" --format "{{.ID}}")
docker logs -f "${container_id}" &
exit $(docker wait "${container_id}")
- name: Full Log Dump On Failure
if: failure()
run: |
cd contrib/localnet && docker compose --profile all logs --timestamps > /tmp/logs.txt
- name: Upload Logs On Failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.make-target }}-docker-logs
path: /tmp/logs.txt
- name: Stop Private Network
if: always()
run: |
make stop-localnet
- name: Clean Up Workspace
if: always()
shell: bash
run: sudo rm -rf *