-
-
Notifications
You must be signed in to change notification settings - Fork 2k
170 lines (143 loc) · 5.12 KB
/
pr-tests-hagrid.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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
name: PR Tests - HAGrid
on:
workflow_call:
pull_request:
branches:
- dev
- main
- "0.8"
concurrency:
group: hagrid-${{ github.event_name == 'pull_request' && format('{0}-{1}', github.workflow, github.event.pull_request.number) || github.workflow_ref }}
cancel-in-progress: true
defaults:
run:
working-directory: ./packages/hagrid
jobs:
pr-tests-hagrid:
strategy:
max-parallel: 99
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.11"]
include:
- python-version: "3.9"
os: "ubuntu-latest"
- python-version: "3.10"
os: "ubuntu-latest"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Check for file changes
uses: dorny/paths-filter@v3
id: changes
with:
base: ${{ github.ref }}
token: ${{ github.token }}
filters: .github/file-filters.yml
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
if: steps.changes.outputs.hagrid == 'true'
with:
python-version: ${{ matrix.python-version }}
- name: Upgrade pip
if: steps.changes.outputs.hagrid == 'true'
run: |
python -m pip install --upgrade --user pip
- name: Get pip cache dir
id: pip-cache
if: steps.changes.outputs.hagrid == 'true'
shell: bash
run: |
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
- name: pip cache
uses: actions/cache@v4
if: steps.changes.outputs.hagrid == 'true'
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-py${{ matrix.python-version }}-${{ hashFiles('packages/hagrid/setup.cfg') }}
restore-keys: |
${{ runner.os }}-pip-py${{ matrix.python-version }}-
- name: Install Dependencies
if: steps.changes.outputs.hagrid == 'true'
run: |
pip install --upgrade tox bandit safety setuptools packaging wheel twine pytest
pip install -e .
# 42923 is ansible 7.4.0 (latest 2023.04.14)
- name: Scan for security issues python 3.8+
if: steps.changes.outputs.hagrid == 'true'
run: |
bandit -r hagrid
safety check -i 42923 -i 54229 -i 54230 -i 54230 -i 54229 -i 62044
- name: Run normal tests
if: steps.changes.outputs.hagrid == 'true'
run: |
pytest --durations=50
- name: Run hagrid debug
if: steps.changes.outputs.hagrid == 'true'
run: |
hagrid debug
- name: Run hagrid quickstart
if: steps.changes.outputs.hagrid == 'true'
run: |
hagrid quickstart --reset --quiet --test
- name: Build Wheel
if: steps.changes.outputs.hagrid == 'true'
run: |
python setup.py bdist_wheel
- name: Twine Check
if: steps.changes.outputs.hagrid == 'true'
run: |
twine check dist/*.whl
pr-tests-syft-hagrid-comptability:
strategy:
max-parallel: 99
matrix:
os: [ubuntu-latest]
python-version: ["3.11"]
syft-version: ["0.8.2", "0.8.2b6", "0.8.3"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Check for file changes
uses: dorny/paths-filter@v3
id: changes
with:
base: ${{ github.ref }}
token: ${{ github.token }}
filters: .github/file-filters.yml
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
if: steps.changes.outputs.hagrid == 'true'
with:
python-version: ${{ matrix.python-version }}
- name: Upgrade pip
if: steps.changes.outputs.hagrid == 'true'
run: |
python -m pip install --upgrade --user pip
- name: Get pip cache dir
id: pip-cache
if: steps.changes.outputs.hagrid == 'true'
shell: bash
run: |
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
- name: pip cache
uses: actions/cache@v4
if: steps.changes.outputs.hagrid == 'true'
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-py${{ matrix.python-version }}-${{ hashFiles('packages/syft/setup.cfg') }}
restore-keys: |
${{ runner.os }}-pip-py${{ matrix.python-version }}-${{ hashFiles('packages/syft/setup.cfg') }}
# https://github.com/google/jax/issues/17693
# pinning ml-dtypes due to jax version==0.4.10
- name: Install Syft ${{ matrix.syft-version }}
if: steps.changes.outputs.hagrid == 'true'
run: |
pip install ml-dtypes==0.2.0
pip install syft==${{ matrix.syft-version }}
pip install .
- name: Run Orchestra Command
if: steps.changes.outputs.hagrid == 'true'
run: |
python -c "import syft as sy; domain1 = sy.orchestra.launch(name='test-domain-1', dev_mode=True, reset=True)"
python -c "import syft as sy; domain2 = sy.orchestra.launch(name='test-domain-2',dev_mode=False, reset=True)"