-
Notifications
You must be signed in to change notification settings - Fork 44
145 lines (128 loc) · 4.27 KB
/
build-test.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
name: Build and test
run-name: ${{ inputs.run_name }}
on:
workflow_dispatch:
inputs:
runner_label:
description: Runner label, keep empty for default
type: string
default: ""
install_ipex:
# This boolean parameter defines what PyTorch will be used in the workflow:
# true: Stonepia/pytorch (fork) with IPEX
# false: pytorch/pytorch (upstream) without IPX
# In both cases, pytorch_ref below allows specifying a branch, tag, or commit id in the
# corresponding repository. If not specified, a default (pinned) version will be used.
description: Install Intel PyTorch Extension
type: boolean
default: true
pytorch_ref:
description: PyTorch ref, keep empty for default
type: string
default: ""
upload_test_reports:
description: Upload test reports
type: boolean
default: false
ignore_errors:
description: Ignore test errors
type: boolean
default: false
skip_list:
description: Skip list
type: string
default: ""
run_name:
description: Custom run name
type: string
default: "Build and test"
enable_unskip:
description: Ignore pytest.skip
type: boolean
default: false
pull_request:
branches:
- llvm-target
push:
branches:
- llvm-target
permissions: read-all
jobs:
pre-commit:
name: Pre-commit checks
runs-on:
- glados
- spr
- cpu
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Load pip cache
id: pip-cache
uses: ./.github/actions/load
env:
# Increase this value to reset cache
CACHE_NUMBER: 2
with:
path: $HOME/.cache/pip
key: pip-3.10-${{ hashFiles('.pre-commit-config.yaml') }}-${{ env.INSTALL_IPEX }}-${{ env.CACHE_NUMBER }}
- name: Install Python 3.10
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Run pre-commit checks
run: |
set -x
pip install --upgrade pre-commit
# TODO: ignore the first yapf failure until https://github.com/google/yapf/issues/1164 is fixed
python3 -m pre_commit run --all-files --verbose yapf &> /dev/null || true
# If first run of yapf worked and made changes reset the tree to the original state
git reset --hard
python3 -m pre_commit run --show-diff-on-failure --color=always --all-files --verbose
- name: Save pip cache
if: ${{ steps.pip-cache.outputs.status == 'miss' }}
uses: ./.github/actions/save
with:
path: ${{ steps.pip-cache.outputs.path }}
dest: ${{ steps.pip-cache.outputs.dest }}
prepare:
name: Prepare
runs-on: Linux
outputs:
matrix: ${{ steps.matrix.outputs.matrix }}
steps:
- name: Inputs
run: |
cat <<EOF
${{ toJSON(inputs) }}
EOF
- name: Matrix
id: matrix
run: |
if [[ -n "${{ inputs.runner_label }}" ]]; then
matrix='{"python": ["3.9"]}'
else
if [[ "${{ github.ref_name }}" = "llvm-target" ]]; then
matrix='{"python": ["3.9", "3.10", "3.11"], "driver": ["rolling", "lts"]}'
else
matrix='{"python": ["3.9"], "driver": ["rolling", "lts"]}'
fi
fi
echo "matrix=$matrix" | tee -a $GITHUB_OUTPUT
integration-tests:
name: Integration tests matrix
needs: prepare
strategy:
matrix: ${{ fromJson(needs.prepare.outputs.matrix) }}
uses: ./.github/workflows/build-test-reusable.yml
with:
driver_version: ${{ matrix.driver }}
runner_label: ${{ inputs.runner_label }}
install_ipex: ${{ inputs.install_ipex || github.event_name == 'pull_request' || github.event_name == 'push' }}
pytorch_ref: ${{ inputs.pytorch_ref }}
python_version: ${{ matrix.python }}
upload_test_reports: ${{ inputs.upload_test_reports || false }}
ignore_errors: ${{ inputs.ignore_errors || false }}
skip_list: ${{ inputs.skip_list }}
run_name: ${{ inputs.run_name }}
enable_unskip: ${{ inputs.enable_unskip || false }}