-
Notifications
You must be signed in to change notification settings - Fork 240
129 lines (125 loc) · 4.99 KB
/
examples.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
name: Test examples
permissions: read-all
on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
inputs:
pull_request_number:
description: 'The pull request number'
default: ''
pytest_args:
description: 'Pytest arguments'
default: ''
skip_windows:
description: 'Skip tests on Windows'
type: boolean
default: false
concurrency:
group: test-examples-${{ github.workflow }}-${{ github.ref }}-${{ github.event.inputs.pytest_args || '' }}-${{github.event.inputs.pull_request_number || ''}}
cancel-in-progress: false
jobs:
examples-cpu:
name: Test exmaples CPU [${{ matrix.group }}/4]
runs-on: ubuntu-22.04-16-cores
strategy:
fail-fast: false
matrix:
group: [1, 2, 3, 4]
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
with:
lfs: true
fetch-depth: 0 # Fetch full history to allow checking out any branch or PR
- name: Fetch and Checkout the Pull Request Branch
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.pull_request_number != '' }}
run: |
git fetch origin pull/${{ github.event.inputs.pull_request_number }}/head:pr-${{ github.event.inputs.pull_request_number }}
git checkout pr-${{ github.event.inputs.pull_request_number }}
- uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0
with:
python-version: 3.10.14
cache: pip
- name: cpuinfo
run: cat /proc/cpuinfo
- name: Install test requirements
run: |
pip install -r tests/cross_fw/examples/requirements.txt
- name: Print installed modules
run: pip list
- name: Run examples test scope
run: |
set +e
python -m pytest -s -ra tests/cross_fw/examples \
--junit-xml=pytest-results.xml \
--durations-path=tests/cross_fw/examples/.test_durations \
--splitting-algorithm=least_duration \
--splits 4 \
--group ${{ matrix.group }} \
${{ github.event.inputs.pytest_args || '' }}
ret=$?
[ $ret -eq 5 ] && [ -n "${{ github.event.inputs.pytest_args || '' }}" ] && exit 0 || exit $ret
env:
TQDM_DISABLE: 1
- name: Test Summary
if: ${{ !cancelled() }}
run: |
pip install defusedxml==0.7.1
python .github/scripts/pytest_md_summary.py pytest-results.xml >> $GITHUB_STEP_SUMMARY
examples-win-cpu:
name: Test exmaples CPU Windows [${{ matrix.group }}/4]
runs-on: windows-2019-16-core
if: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.skip_windows == 'false' }}
strategy:
fail-fast: false
matrix:
group: [1, 2, 3, 4]
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
with:
lfs: true
fetch-depth: 0 # Fetch full history to allow checking out any branch or PR
- name: Fetch and Checkout the Pull Request Branch
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.pull_request_number != '' }}
run: |
git fetch origin pull/${{ github.event.inputs.pull_request_number }}/head:pr-${{ github.event.inputs.pull_request_number }}
git checkout pr-${{ github.event.inputs.pull_request_number }}
- uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0
with:
python-version: "3.10"
cache: pip
- uses: ilammy/msvc-dev-cmd@ed94116c4d30d2091601b81f339a2eaa1c2ba0a6 # v1.4.1
- name: Install NNCF and test requirements
run: |
pip install -e .
pip install -r tests/cross_fw/examples/requirements.txt
- name: Print installed modules
run: pip list
- name: Run examples test scope
run: |
set +e
export LIB="${LIB};$(python -c "import sysconfig; print(sysconfig.get_config_var('LIBDIR'))")"
export LIB="${LIB};$(python -c "import sys; print(sys.prefix + '/libs')")"
export INCLUDE="${INCLUDE};$(python -c "import sysconfig; print(sysconfig.get_path('include'))")"
python -m pytest -s -ra tests/cross_fw/examples \
--junit-xml=pytest-results.xml \
--durations-path=tests/cross_fw/examples/.test_durations \
--splitting-algorithm=least_duration \
--splits 4 \
--group ${{ matrix.group }} \
${{ github.event.inputs.pytest_args || '' }}
ret=$?
[ $ret -eq 5 ] && [ -n "${{ github.event.inputs.pytest_args || '' }}" ] && exit 0 || exit $ret
env:
TQDM_DISABLE: 1
- name: Test Summary
if: ${{ !cancelled() }}
run: |
pip install defusedxml==0.7.1
python .github/scripts/pytest_md_summary.py pytest-results.xml >> $GITHUB_STEP_SUMMARY