-
Notifications
You must be signed in to change notification settings - Fork 10
119 lines (108 loc) · 4.49 KB
/
reusable-workflow.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
name: Reusable E2E Workflow
on:
workflow_call:
inputs:
docker_compose_command:
description: 'Docker Compose command to run E2E tests'
required: true
type: string
AGORIC_NET:
required: false
default: emerynet
type: string
mnemonic_phrase:
required: false
type: string
base_image:
description: 'Base image tag for agoric-sdk'
required: false
default: latest
type: string
docker_image:
description: 'Docker image for the a3p chain to use in testing'
required: false
type: string
jobs:
e2e:
runs-on: ubuntu-latest
permissions:
contents: 'read'
id-token: 'write'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: 'GCP auth'
uses: 'google-github-actions/auth@v2'
if: ${{ inputs.AGORIC_NET != 'local' }}
with:
project_id: 'simulationlab'
workload_identity_provider: 'projects/60745596728/locations/global/workloadIdentityPools/github/providers/dapp-inter'
- name: Docker Image Used For E2E Testing
run: |
if [ -z "${{ inputs.docker_image }}" ]; then
echo "Error: Docker image not provided."
exit 1
else
echo "Docker Image: ${{ inputs.docker_image }}"
fi
- name: Run e2e tests
run: ${{ inputs.docker_compose_command }}
env:
# conditionals based on github event
SYNPRESS_PROFILE: ${{ inputs.AGORIC_NET == 'local' && 'synpress' || 'daily-tests' }}
CYPRESS_AGORIC_NET: ${{ inputs.AGORIC_NET }}
# for docker-compose.yml
DOCKER_IMAGE: ${{ inputs.docker_image }}
COMPOSE_DOCKER_CLI_BUILD: 1
DOCKER_BUILDKIT: 1
DOCKER_DEFAULT_PLATFORM: linux/amd64
NGROK_AUTH: ${{ secrets.NGROK_AUTH }}
NGROK_BASIC_AUTH: ${{ secrets.NGROK_BASIC_AUTH }}
CYPRESS_PRIVATE_KEY_WITH_FUNDS: ${{ secrets.CYPRESS_PRIVATE_KEY_WITH_FUNDS }}
ANVIL_FORK_URL: ${{ secrets.ANVIL_FORK_URL }}
GH_PAT: ${{ secrets.GH_PAT }}
GH_USERNAME: ${{ secrets.GH_USERNAME }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CYPRESS_PROJECT_ID: ${{ secrets.CYPRESS_PROJECT_ID }}
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
COMMIT_INFO_MESSAGE: ${{ github.event.pull_request.title }}
COMMIT_INFO_SHA: ${{ github.event.pull_request.head.sha }}
CYPRESS_MNEMONIC_PHRASE: ${{ inputs.mnemonic_phrase }}
BASE_IMAGE_TAG_INPUT: ${{ inputs.base_image }}
# Liquidation Secrets
CYPRESS_GOV1_MNEMONIC: ${{ secrets.CYPRESS_GOV1_MNEMONIC }}
CYPRESS_GOV1_ADDRESS: ${{ secrets.CYPRESS_GOV1_ADDRESS }}
CYPRESS_GOV2_MNEMONIC: ${{ secrets.CYPRESS_GOV2_MNEMONIC }}
CYPRESS_GOV2_ADDRESS: ${{ secrets.CYPRESS_GOV2_ADDRESS }}
CYPRESS_USER1_MNEMONIC: ${{ secrets.CYPRESS_USER1_MNEMONIC }}
CYPRESS_USER1_ADDRESS: ${{ secrets.CYPRESS_USER1_ADDRESS }}
CYPRESS_BIDDER_MNEMONIC: ${{ secrets.CYPRESS_BIDDER1_MNEMONIC }}
CYPRESS_BIDDER_ADDRESS: ${{ secrets.CYPRESS_BIDDER1_ADDRESS }}
- name: Upload e2e artifacts as workflow artifacts
uses: actions/upload-artifact@v4
if: ${{ inputs.AGORIC_NET == 'local' && !cancelled() }}
with:
name: e2e-artifacts
path: |
test/e2e/docker/videos
test/e2e/docker/videos-ci
test/e2e/docker/screenshots
continue-on-error: true
- name: Upload e2e artifacts to GCP
uses: google-github-actions/upload-cloud-storage@v2
if: ${{ inputs.AGORIC_NET != 'local' && !cancelled() }}
with:
path: 'test/e2e/docker'
destination: 'github-artifacts/${{ github.repository }}/${{ github.run_id }}/${{ github.event.repository.updated_at }}'
continue-on-error: true
- name: Log Path to GCS artifacts
if: ${{ inputs.AGORIC_NET != 'local' && !cancelled() }}
run: echo "https://console.cloud.google.com/storage/browser/github-artifacts/${{ github.repository }}/${{ github.run_id }}/${{ github.event.repository.updated_at }}/docker/videos-ci"
- name: Notify About Failure
if: >
failure() && github.event_name != 'pull_request' &&
github.repository_owner == 'agoric'
uses: ./.github/actions/notify-status
with:
webhook: ${{ secrets.SLACK_WEBHOOK_URL }}
continue-on-error: true