forked from securefederatedai/openfl
-
Notifications
You must be signed in to change notification settings - Fork 0
125 lines (113 loc) · 4.17 KB
/
task_runner_e2e_resiliency.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
---
# Task Runner E2E tests for resiliency. Currently only native tests are enabled.
name: Task_Runner_E2E_Resiliency # Please do not modify the name as it is used in the composite action
on:
schedule:
- cron: "0 5 * * *" # Run every day at 5 am UTC
workflow_call:
workflow_dispatch:
inputs:
num_rounds:
description: "Number of rounds to train"
required: false
default: "30"
type: string
num_collaborators:
description: "Number of collaborators"
required: false
default: "2"
type: string
model_name:
description: "Model name"
required: false
default: "torch/mnist"
type: choice
options:
- torch/mnist
- keras/mnist
- all
python_version:
description: "Python version"
required: false
default: "3.10"
type: choice
options:
- "3.10"
- "3.11"
- "3.12"
permissions:
contents: read
# Environment variables common for all the jobs
# DO NOT use double quotes for the values of the environment variables
env:
NUM_ROUNDS: ${{ inputs.num_rounds || 30 }}
NUM_COLLABORATORS: ${{ inputs.num_collaborators || 2 }}
MODEL_NAME: ${{ inputs.model_name || 'torch/mnist' }}
PYTHON_VERSION: ${{ inputs.python_version || '3.10' }}
jobs:
input_selection:
if: |
(github.event_name == 'schedule' && github.repository_owner == 'securefederatedai') ||
(github.event_name == 'workflow_dispatch') ||
(github.event.pull_request.draft == false)
name: Input value selection
runs-on: ubuntu-22.04
outputs:
# Output all the variables related to models and python versions to be used in the matrix strategy
# for different jobs, however their usage depends on the selected job.
selected_models_for_tls: ${{ steps.input_selection.outputs.models_for_tls }}
selected_python_for_tls: ${{ steps.input_selection.outputs.python_for_tls }}
steps:
- name: Job to select input values
id: input_selection
run: |
if [ "${{ env.MODEL_NAME }}" == "all" ]; then
echo "models_for_tls=[\"torch/mnist\", \"keras/mnist\"]" >> "$GITHUB_OUTPUT"
else
echo "models_for_tls=[\"${{env.MODEL_NAME}}\"]" >> "$GITHUB_OUTPUT"
fi
if [ "${{ env.PYTHON_VERSION }}" == "all" ]; then
echo "python_for_tls=[\"3.10\", \"3.11\"]" >> "$GITHUB_OUTPUT"
else
echo "python_for_tls=[\"${{env.PYTHON_VERSION}}\"]" >> "$GITHUB_OUTPUT"
fi
resiliency_in_native:
name: With TLS
needs: input_selection
runs-on: ubuntu-22.04
timeout-minutes: 30
strategy:
matrix:
model_name: ${{ fromJson(needs.input_selection.outputs.selected_models_for_tls) }}
python_version: ${{ fromJson(needs.input_selection.outputs.selected_python_for_tls) }}
exclude: # Keras does not support Python 3.12
- model_name: "keras/mnist"
python_version: "3.12"
fail-fast: false # do not immediately fail if one of the combinations fail
env:
MODEL_NAME: ${{ matrix.model_name }}
PYTHON_VERSION: ${{ matrix.python_version }}
steps:
- name: Checkout OpenFL repository
id: checkout_openfl
uses: actions/checkout@v4
with:
fetch-depth: 2 # needed for detecting changes
submodules: "true"
token: ${{ secrets.GITHUB_TOKEN }}
- name: Pre test run
uses: ./.github/actions/tr_pre_test_run
if: ${{ always() }}
- name: Run Task Runner E2E tests with TLS
id: run_tests
run: |
python -m pytest -s tests/end_to_end/test_suites/tr_resiliency_tests.py \
-m task_runner_basic --model_name ${{ env.MODEL_NAME }} \
--num_collaborators ${{ env.NUM_COLLABORATORS }} --num_rounds ${{ env.NUM_ROUNDS }}
echo "Task runner end to end test run completed"
- name: Post test run
uses: ./.github/actions/tr_post_test_run
if: ${{ always() }}
with:
test_type: "Resiliency_Native"
# TODO - Add dockerized approach as well once we have GitHub runners with higher configurations.