Repository navigation
132 lines (110 loc) · 4.33 KB
/
Copy pathfunctional-test-beta.yml
File metadata and controls
132 lines (110 loc) · 4.33 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
131
132
name: Check new beta version - Functional
on:
schedule:
- cron: "12 * * * *"
workflow_dispatch:
inputs:
dry_run:
description: "Dry-Run - If true, only report the plan; do not trigger downstream workflows."
required: false
default: "false"
env:
DRY_RUN: ${{ github.event_name == 'workflow_dispatch' && inputs.dry_run || 'false' }}
permissions: {}
jobs:
# This job discovers the available splits, converts them into JSON,
# then exports that JSON as a job output:
# for example: ["functional1","functional2","functional3","functional4"]
Get-Functional-Splits:
runs-on: ubuntu-latest
outputs:
functional_splits: ${{ steps.splits.outputs.functional_splits }}
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # 6.0.2
with:
persist-credentials: false
- name: Get functional splits
id: splits
run: |
MAX_SPLITS=$(grep -o 'functional[0-9]\+' manifests/key.yaml | sed 's/functional//' | sort -n | tail -1)
splits="["
for i in $(seq 1 "$MAX_SPLITS"); do
splits="${splits}\"functional${i}\","
done
splits="${splits%,}]"
echo "functional_splits=$splits" >> "$GITHUB_OUTPUT"
Build-Reportable-Matrix:
needs: Get-Functional-Splits
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.matrix.outputs.matrix }}
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # 6.0.2
with:
persist-credentials: false
- name: Setup dependencies
run: bash ./scripts/setup_python.sh
- name: Build reportable matrix
id: matrix
env:
FUNCTIONAL_SPLITS: ${{ needs.Get-Functional-Splits.outputs.functional_splits }}
TESTRAIL_REPORT: true
TESTRAIL_BASE_URL: ${{ secrets.TESTRAIL_BASE_URL }}
TESTRAIL_API_KEY: ${{ secrets.TESTRAIL_API_KEY }}
TESTRAIL_USERNAME: ${{ secrets.TESTRAIL_USERNAME }}
DRY_RUN: ${{ env.DRY_RUN }}
run: |
matrix="[]"
for split in $(echo "$FUNCTIONAL_SPLITS" | jq -r '.[]'); do
echo "Checking reportability for $split"
output=$(STARFOX_SPLIT="$split" bash ./scripts/check_reportable.sh)
win=$(echo "$output" | grep -E '^win=' | tail -1 | cut -d '=' -f2)
mac=$(echo "$output" | grep -E '^mac=' | tail -1 | cut -d '=' -f2)
if [ "$win" = "True" ]; then
matrix=$(jq --arg split "$split" '. + [{job_to_run: "Test-Windows", split: $split}]' <<< "$matrix")
fi
if [ "$mac" = "True" ]; then
matrix=$(jq --arg split "$split" '. + [{job_to_run: "Test-MacOS", split: $split}]' <<< "$matrix")
fi
done
echo "matrix=$(jq -c . <<< "$matrix")" >> "$GITHUB_OUTPUT"
Preview-Plan:
needs:
- Get-Functional-Splits
- Build-Reportable-Matrix
runs-on: ubuntu-latest
steps:
- name: Print plan
run: |
{
echo "## Functional beta plan"
echo
echo "Functional splits:"
echo '${{ needs.Get-Functional-Splits.outputs.functional_splits }}' | jq .
echo
echo "Reportable matrix:"
echo '${{ needs.Build-Reportable-Matrix.outputs.matrix }}' | jq .
} >> "$GITHUB_STEP_SUMMARY"
Run-Functional:
needs: Build-Reportable-Matrix
if: needs.Build-Reportable-Matrix.outputs.matrix != '[]' && (github.event_name != 'workflow_dispatch' || inputs.dry_run != 'true')
strategy:
fail-fast: false
matrix:
include: ${{ fromJson(needs.Build-Reportable-Matrix.outputs.matrix) }}
uses: ./.github/workflows/main.yml
with:
job_to_run: ${{ matrix.job_to_run }}
test_set: ${{ matrix.split }}
trigger_event: ${{ github.event_name }}
secrets:
TESTRAIL_BASE_URL: ${{ secrets.TESTRAIL_BASE_URL }}
TESTRAIL_API_KEY: ${{ secrets.TESTRAIL_API_KEY }}
TESTRAIL_USERNAME: ${{ secrets.TESTRAIL_USERNAME }}
SLACK_KEY: ${{ secrets.SLACK_KEY }}
GCP_CREDENTIAL: ${{ secrets.GCP_CREDENTIAL }}
CI_WAF_TOKEN: ${{ secrets.CI_WAF_TOKEN }}
GC_CREDENTIAL_STABILITY: ${{ secrets.GC_CREDENTIAL_STABILITY }}
BQ_PROJECT: ${{ secrets.BQ_PROJECT }}