-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Expand file tree
/
Copy pathtest-suite-orchestrate-e2e-tests.yml
More file actions
130 lines (120 loc) · 6.03 KB
/
test-suite-orchestrate-e2e-tests.yml
File metadata and controls
130 lines (120 loc) · 6.03 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
name: test-suite-orchestrate-e2e-tests
on:
pull_request:
branches:
- main
permissions: {}
concurrency:
group: test-suite-orchestrate-e2e-tests-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
coprocessor-docker-build:
if: startsWith(github.head_ref, 'mergify/merge-queue/')
uses: ./.github/workflows/coprocessor-docker-build.yml
permissions: &docker_permissions
actions: 'read' # Required to read workflow run information
contents: 'read' # Required to checkout repository code
pull-requests: 'read' # Required to read pull request information
attestations: 'write' # Required to create build attestations
packages: 'write' # Required to publish Docker images
id-token: 'write' # Required for OIDC authentication
secrets: &docker_secrets
AWS_ACCESS_KEY_S3_USER: ${{ secrets.AWS_ACCESS_KEY_S3_USER }}
AWS_SECRET_KEY_S3_USER: ${{ secrets.AWS_SECRET_KEY_S3_USER }}
BLOCKCHAIN_ACTIONS_TOKEN: ${{ secrets.BLOCKCHAIN_ACTIONS_TOKEN }}
CGR_USERNAME: ${{ secrets.CGR_USERNAME }}
CGR_PASSWORD: ${{ secrets.CGR_PASSWORD }}
gateway-contracts-docker-build:
if: startsWith(github.head_ref, 'mergify/merge-queue/')
uses: ./.github/workflows/gateway-contracts-docker-build.yml
permissions: *docker_permissions
secrets: *docker_secrets
host-contracts-docker-build:
if: startsWith(github.head_ref, 'mergify/merge-queue/')
uses: ./.github/workflows/host-contracts-docker-build.yml
permissions: *docker_permissions
secrets: *docker_secrets
kms-connector-docker-build:
if: startsWith(github.head_ref, 'mergify/merge-queue/')
uses: ./.github/workflows/kms-connector-docker-build.yml
permissions: *docker_permissions
secrets: *docker_secrets
test-suite-docker-build:
if: startsWith(github.head_ref, 'mergify/merge-queue/')
uses: ./.github/workflows/test-suite-docker-build.yml
permissions: *docker_permissions
secrets: *docker_secrets
create-e2e-tests-input:
name: create-e2e-tests-input
needs:
- coprocessor-docker-build
- gateway-contracts-docker-build
- host-contracts-docker-build
- kms-connector-docker-build
- test-suite-docker-build
if: ${{ success() || failure() }}
env:
PREVIOUS_COMMIT_HASH: ${{ github.event.pull_request.base.sha }}
NEW_COMMIT_HASH: ${{ github.event.pull_request.head.sha }}
DOCKER_BUILD_RESULTS: ${{ toJSON(needs) }}
runs-on: ubuntu-latest
outputs:
coprocessor: ${{ steps.create-e2e-tests-input.outputs.coprocessor }}
connector: ${{ steps.create-e2e-tests-input.outputs.connector }}
gateway: ${{ steps.create-e2e-tests-input.outputs.gateway }}
host: ${{ steps.create-e2e-tests-input.outputs.host }}
test-suite: ${{ steps.create-e2e-tests-input.outputs.test-suite }}
steps:
- id: create-e2e-tests-input
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v0.8.0
with:
script: |
const previousCommitHash = process.env.PREVIOUS_COMMIT_HASH;
const newCommitHash = process.env.NEW_COMMIT_HASH;
console.log(`Previous commit hash: ${previousCommitHash}`)
console.log(`New commit hash: ${newCommitHash}`)
console.log(`Docker build results: ${process.env.DOCKER_BUILD_RESULTS}`)
const dockerBuildResults = JSON.parse(process.env.DOCKER_BUILD_RESULTS);
function getImageTagIfBuilt(key, build_result) {
let imageTag = dockerBuildResults[key].outputs[build_result] === 'success' ? newCommitHash : previousCommitHash;
console.log(`Assigning image tag '${imageTag}' for ${key}`);
return imageTag;
}
const coprocessor = [
getImageTagIfBuilt('coprocessor-docker-build', 'db_migration_build_result'),
getImageTagIfBuilt('coprocessor-docker-build', 'gw_listener_build_result'),
getImageTagIfBuilt('coprocessor-docker-build', 'host_listener_build_result'),
getImageTagIfBuilt('coprocessor-docker-build', 'sns_worker_build_result'),
getImageTagIfBuilt('coprocessor-docker-build', 'tfhe_worker_build_result'),
getImageTagIfBuilt('coprocessor-docker-build', 'tx_sender_build_result'),
getImageTagIfBuilt('coprocessor-docker-build', 'zkproof_worker_build_result'),
];
const connector = [
getImageTagIfBuilt('kms-connector-docker-build', 'db_migration_build_result'),
getImageTagIfBuilt('kms-connector-docker-build', 'gw_listener_build_result'),
getImageTagIfBuilt('kms-connector-docker-build', 'kms_worker_build_result'),
getImageTagIfBuilt('kms-connector-docker-build', 'tx_sender_build_result'),
];
core.setOutput('coprocessor', coprocessor);
core.setOutput('gateway', getImageTagIfBuilt('gateway-contracts-docker-build', 'build_result'));
core.setOutput('host', getImageTagIfBuilt('host-contracts-docker-build', 'build_result'));
core.setOutput('connector', connector);
core.setOutput('test-suite', getImageTagIfBuilt('test-suite-docker-build', 'build_result'));
run-e2e-tests:
needs: [create-e2e-tests-input]
uses:
./.github/workflows/test-suite-e2e-tests-mq.yml
permissions:
contents: 'read' # Required to checkout repository code
id-token: 'write' # Required for OIDC authentication
packages: 'read' # Required to read GitHub packages/container registry
secrets:
GHCR_READ_TOKEN: ${{ secrets.GHCR_READ_TOKEN }}
CGR_USERNAME: ${{ secrets.CGR_USERNAME }}
CGR_PASSWORD: ${{ secrets.CGR_PASSWORD }}
with:
coprocessor: ${{ needs.create-e2e-tests-input.outputs.coprocessor }}
gateway: ${{ needs.create-e2e-tests-input.outputs.gateway }}
host: ${{ needs.create-e2e-tests-input.outputs.host }}
connector: ${{ needs.create-e2e-tests-input.outputs.connector }}
test-suite: ${{ needs.create-e2e-tests-input.outputs.test-suite }}