forked from cosmos/ibc-go
-
Notifications
You must be signed in to change notification settings - Fork 0
132 lines (124 loc) · 4.21 KB
/
e2e-test-workflow-call.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
123
124
125
126
127
128
129
130
131
132
on:
workflow_call:
inputs:
test-entry-point:
description: 'Test entry point'
required: false
type: string
default: "" # empty string means run all tests
test-exclusions:
description: 'Comma separated list of tests to skip'
required: false
type: string
default: "" # empty string means don't skip any test.
chain-image:
description: 'The image to use for chains'
required: true
type: string
default: "ghcr.io/cosmos/ibc-go-simd"
chain-a-tag:
description: 'The tag to use for chain A'
required: true
type: string
default: main
chain-b-tag:
default: v4.0.0
description: 'The tag to use for chain B'
required: true
type: string
chain-binary:
default: "simd"
description: 'The chain binary'
required: false
type: string
relayer-tag:
description: 'The tag to use for the relayer'
required: false
default: "v2.1.2"
type: string
build-and-push-docker-image:
description: "Flag to specify if the docker image should be built and pushed beforehand"
required: false
type: boolean
default: false
env:
REGISTRY: ghcr.io
IMAGE_NAME: ibc-go-simd
jobs:
test-details:
runs-on: ubuntu-latest
steps:
- name: Display Inputs
run: |
echo "Chain Image: ${{ inputs.chain-image }}"
echo "Chain A Tag: ${{ inputs.chain-a-tag }}"
echo "Chain B Tag: ${{ inputs.chain-b-tag }}"
echo "Relayer Tag: ${{ inputs.relayer-tag }}"
echo "Test Entry Point: ${{ inputs.test-entry-point }}"
# we skip individual steps rather than the full job as e2e-tests will not run if this task
# is skipped. But will run if every individual task is skipped. There is no current way of conditionally needing
# a job.
docker-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
if: ${{ inputs.build-and-push-docker-image }}
- name: Log in to the Container registry
if: ${{ inputs.build-and-push-docker-image }}
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
if: ${{ inputs.build-and-push-docker-image }}
id: meta
uses: docker/metadata-action@57396166ad8aefe6098280995947635806a0e6ea
with:
images: ${{ env.REGISTRY }}/cosmos/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
if: ${{ inputs.build-and-push-docker-image }}
uses: docker/build-push-action@c56af957549030174b10d6867f20e78cfd7debc5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
# dynamically build a matrix of test/test suite pairs to run
build-test-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.18
- id: set-matrix
run: echo "matrix=$(go run cmd/build_test_matrix/main.go)" >> $GITHUB_OUTPUT
env:
TEST_ENTRYPOINT: "${{ inputs.test-entry-point }}"
TEST_EXCLUSIONS: "${{ inputs.test-exclusions }}"
e2e-tests:
runs-on: ubuntu-latest
needs:
- build-test-matrix
- docker-build
env:
CHAIN_IMAGE: "${{ inputs.chain-image }}"
CHAIN_A_TAG: "${{ inputs.chain-a-tag }}"
CHAIN_B_TAG: "${{ inputs.chain-b-tag }}"
RLY_TAG: "${{ inputs.relayer-tag }}"
CHAIN_BINARY: "${{ inputs.chain-binary }}"
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.build-test-matrix.outputs.matrix) }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.18
- name: Run e2e Test
run: |
cd e2e
make e2e-test entrypoint=${{ matrix.entrypoint }} test=${{ matrix.test }}