-
Notifications
You must be signed in to change notification settings - Fork 24
121 lines (105 loc) · 4 KB
/
upstream-integration-test.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
# Action to execute upstream integration tests - Edge Network (Konductor)
name: Integration Tests
on:
# `*` is a special character in YAML so you have to quote this string
# Avoiding start of hour and other common times to avoid conflicts with peak times
schedule:
# Run every weekday at 12:16 PM PDT (Daylight saving time) -> 7:16 PM UTC
# Add +1 hour when back in PST
- cron: '16 19 * * 1-5'
workflow_dispatch:
inputs:
branch:
description: 'The branch to use when running the integration tests.'
required: false
default: 'main'
id:
description: '(Optional) The identifier for the run.'
required: false
tags-mobile-property-id:
type: string
description: '(Optional) The tags mobile property ID to use for the test. A default is used if not set.'
required: false
default: ''
edge-location-hint:
type: choice
description: '(Optional) The Edge location hint to set before each test.'
required: false
default: 'None'
options:
- 'aus3'
- 'ind1'
- 'irl1'
- 'jpn3'
- 'or2'
- 'sgp3'
- 'va6'
- 'EmptyString'
- 'Invalid'
- 'None'
run-name: ${{ inputs.id }}
jobs:
test-integration-upstream:
runs-on: macos-latest
steps:
- name: Job run identifier ${{ github.event.inputs.id }}
id: job-run-identifier
run: |
if [ -z "${{ github.event.inputs.id }}" ]; then \
echo No job run identifier was set.
else
echo 'Job run identifier is:' ${{ inputs.id }}
fi;
- name: Checkout
id: checkout
uses: actions/[email protected]
with:
ref: ${{ github.event.inputs.branch }}
- name: Cache Cocoapods
id: cache-cocoapods
uses: actions/[email protected]
with:
path: Pods
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-pods-
- name: Execute Edge Network integration tests
id: execute-integration-tests
run: make test-integration-upstream TAGS_MOBILE_PROPERTY_ID=${{ github.event.inputs.tags-mobile-property-id }} EDGE_LOCATION_HINT=${{ github.event.inputs.edge-location-hint }}
# Potential workflow solutions on job failure
# All workflow setup step failures give exit code 2, with 3 as fallback
# Actual integration test failures give exit code 1
- name: On failure
id: on-failure
if: ${{ failure() }}
env:
BRANCH: ${{ github.event.inputs.branch }}
run: |
echo "Job used branch: $BRANCH. Please make sure this is the branch to run off of."
EXIT_CODE=3
if [[ "${{ steps.job-run-identifier.conclusion }}" == "failure" ]]; then
echo "Job step failed: Job run identifier."
EXIT_CODE=2
elif [[ "${{ steps.checkout.conclusion }}" == "failure" ]]; then
echo "Job step failed: Checkout."
EXIT_CODE=2
elif [[ "${{ steps.cache-cocoapods.conclusion }}" == "failure" ]]; then
echo "Job step failed: Cache Cocoapods."
EXIT_CODE=2
elif [[ "${{ steps.execute-integration-tests.conclusion }}" == "failure" ]]; then
echo "Job step failed: Execute Edge Network integration tests."
EXIT_CODE=1
else
echo "Job failed: Failure cause not identified."
fi
echo "EXIT_CODE=$EXIT_CODE" >> $GITHUB_OUTPUT
# Dynamic step name in JSON format, examples on job:
# - During job run (before this step): {"exitCode":${{ steps.on-failure.outputs.EXIT_CODE || 0 }}}
# - Failure: {"exitCode":1}
# - Success: {"exitCode":0}
- name: "{\"exitCode\":${{ steps.on-failure.outputs.EXIT_CODE || 0 }}}"
id: failure-data
if: ${{ failure() }}
run: |
echo 'exit code in the body: ${{ steps.on-failure.outputs.EXIT_CODE }}'
echo 'on-failure outputs: ${{ toJson(steps.on-failure.outputs) }}'