-
-
Notifications
You must be signed in to change notification settings - Fork 2k
215 lines (184 loc) · 7.16 KB
/
pr-tests-stack-public.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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
name: PR Tests - Stack - Public
on:
workflow_call:
workflow_dispatch:
inputs:
none:
description: "Run Stack Integration Tests Manually"
required: false
concurrency:
group: stackpublic-${{ github.event_name == 'pull_request' && format('{0}-{1}', github.workflow, github.event.pull_request.number) || github.workflow_ref }}
cancel-in-progress: true
jobs:
pr-tests-stack-public:
strategy:
max-parallel: 99
matrix:
os: [ubuntu-latest, macos-latest, windows]
python-version: ["3.11"]
pytest-modules: ["frontend network"]
fail-fast: false
runs-on: ${{matrix.os}}
steps:
- name: "clean .git/config"
if: matrix.os == 'windows'
continue-on-error: true
shell: bash
run: |
echo "deleting ${GITHUB_WORKSPACE}/.git/config"
rm ${GITHUB_WORKSPACE}/.git/config
- 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.stack == 'true'
with:
python-version: ${{ matrix.python-version }}
- name: Get pip cache dir
if: steps.changes.outputs.stack == 'true'
id: pip-cache
shell: bash
run: |
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
- name: pip cache
uses: actions/cache@v4
if: steps.changes.outputs.stack == 'true'
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-py${{ matrix.python-version }}
restore-keys: |
${{ runner.os }}-pip-py${{ matrix.python-version }}
- name: Upgrade pip
if: steps.changes.outputs.stack == 'true'
run: |
python -m pip install --upgrade --user pip
- name: Install tox
if: steps.changes.outputs.stack == 'true'
run: |
pip install -U tox
- name: Show choco installed packages
if: steps.changes.outputs.stack == 'true' && matrix.os == 'windows'
uses: crazy-max/ghaction-chocolatey@v3
with:
args: list --localonly
- name: Install git
if: steps.changes.outputs.stack == 'true' && matrix.os == 'windows'
uses: crazy-max/ghaction-chocolatey@v3
with:
args: install git.install --params "/GitAndUnixToolsOnPath /WindowsTerminal /NoAutoCrlf" -y
- name: Install cmake
if: steps.changes.outputs.stack == 'true' && matrix.os == 'windows'
uses: crazy-max/ghaction-chocolatey@v3
with:
args: install cmake.portable --installargs 'ADD_CMAKE_TO_PATH=System' -y
- name: Check cmake version
if: steps.changes.outputs.stack == 'true' && matrix.os == 'windows'
run: |
cmake --version
shell: cmd
- name: Install visualcpp-build-tools
if: steps.changes.outputs.stack == 'true' && matrix.os == 'windows'
uses: crazy-max/ghaction-chocolatey@v3
with:
args: install visualstudio2019-workload-vctools -y
- name: Install Docker Compose
if: steps.changes.outputs.stack == 'true' && runner.os == 'Linux'
shell: bash
run: |
mkdir -p ~/.docker/cli-plugins
DOCKER_COMPOSE_VERSION=v2.21.0
curl -sSL https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-linux-x86_64 -o ~/.docker/cli-plugins/docker-compose
chmod +x ~/.docker/cli-plugins/docker-compose
- name: Docker on MacOS
if: steps.changes.outputs.stack == 'true' && matrix.os == 'macos-latest'
uses: crazy-max/[email protected]
- name: Docker Compose on MacOS
if: steps.changes.outputs.stack == 'true' && matrix.os == 'macos-latest'
shell: bash
run: |
brew install docker-compose
mkdir -p ~/.docker/cli-plugins
ln -sfn /usr/local/opt/docker-compose/bin/docker-compose ~/.docker/cli-plugins/docker-compose || true
docker compose version
- name: Remove existing containers
if: steps.changes.outputs.stack == 'true'
continue-on-error: true
shell: bash
run: |
docker rm $(docker ps -aq) --force || true
docker volume prune -f || true
docker buildx use default || true
# - name: Run integration tests
# if: steps.changes.outputs.stack == 'true'
# timeout-minutes: 60
# env:
# HAGRID_ART: false
# PYTEST_MODULES: "${{ matrix.pytest-modules }}"
# HAGRID_FLAGS: "--tag=beta --test --build-src=dev"
# run: |
# tox -e stack.test.integration
- name: Run integration tests
uses: nick-fields/retry@v2
if: steps.changes.outputs.stack == 'true'
env:
HAGRID_ART: false
PYTEST_MODULES: "${{ matrix.pytest-modules }}"
HAGRID_FLAGS: "--tag=beta --test --build-src=dev"
with:
timeout_seconds: 1800
max_attempts: 3
command: tox -e stack.test.integration
continue-on-error: true
- name: Reboot node
if: matrix.os == 'windows' && failure()
run: |
shutdown /r /t 1
- name: Run log collector
timeout-minutes: 5
if: failure()
shell: bash
run: |
python ./scripts/container_log_collector.py
- name: Get job name and url
id: job_name
if: failure()
shell: bash
run: |
echo "job_name=$(echo ${{ github.job }})" >> $GITHUB_OUTPUT
echo "url=$(echo ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})" >> $GITHUB_OUTPUT
- name: Get current date
id: date
if: failure()
shell: bash
run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
- name: Upload logs to GitHub
uses: actions/upload-artifact@master
if: failure()
with:
name: ${{ matrix.os }}-${{ steps.job_name.outputs.job_name }}-${{ matrix.pytest-modules }}-logs-${{ steps.date.outputs.date }}
path: ./logs/${{ steps.job_name.outputs.job_name}}/
- name: Get pull request url
id: pull_request
if: failure()
shell: bash
run: |
echo "url=$(echo ${{ github.event.pull_request.html_url }})" >> $GITHUB_OUTPUT
- name: Job Report Status
if: github.repository == 'OpenMined/PySyft' && failure()
uses: ravsamhq/notify-slack-action@v2
with:
status: ${{ job.status }}
notify_when: "failure"
notification_title: " {workflow} has {status_message}"
message_format: "${{matrix.os}} {emoji} *{job}* {status_message} in {run_url}"
footer: "Find the PR here ${{ steps.pull_request.outputs.url }}"
mention_users: "U01LNCACY03,U8KUAD396,UNMQ2SJSW,U01SAESBJA0"
mention_users_when: "failure,warnings"
env:
SLACK_WEBHOOK_URL: ${{ secrets.ACTION_MONITORING_SLACK_WEBHOOK_URL }}