-
Notifications
You must be signed in to change notification settings - Fork 147
/
.travis.yml
156 lines (144 loc) · 5.28 KB
/
.travis.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
# (C) Copyright 2020, 2021, 2022, 2023, 2024 IBM. All Rights Reserved.
#
# Licensed under the MIT license. See LICENSE file in the project root for details.
notifications:
email: false
# Disable double triggering when issuing a PR from a branch in the main repo.
branches:
only:
- "master"
- /^release\/.*$/
stages:
- Test and lint
- Test multiple python versions
- Build wheels
# Parent stage definition, to avoid copy-pasting.
job_compile_common: &job_compile_common
os: linux
dist: focal
language: python
before_install:
- sudo apt-get -qq install -y ca-certificates
- sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
- sudo apt-get update
- sudo apt-get install -y libopenblas-dev gcc-9 g++-9
- sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 60 --slave /usr/bin/g++ g++ /usr/bin/g++-9
install:
# Set the python executable, to force cmake picking the right one.
- PYTHON_EXECUTABLE=~/virtualenv/python$TRAVIS_PYTHON_VERSION/bin/python$TRAVIS_PYTHON_VERSION
- $PYTHON_EXECUTABLE -m pip install travis-wait-improved
- travis-wait-improved --timeout 60m $PYTHON_EXECUTABLE -m pip install -r requirements.txt
- $PYTHON_EXECUTABLE -m pip install -r requirements-dev.txt
- $PYTHON_EXECUTABLE -m pip install -r requirements-examples.txt
# Install the package in editable mode.
- VERBOSE=1 $PYTHON_EXECUTABLE -m pip install -v -e ".[visualization, fitting]"
script:
- make pytest
build_deploy_common: &build_deploy_common
deploy:
provider: s3
access_key_id: $COS_ACCESS_KEY_ID
secret_access_key: $COS_SECRET_ACCESS_KEY
bucket: $COS_BUCKET
skip_cleanup: true
local_dir: wheelhouse
endpoint: https://$COS_ENDPOINT
on:
all_branches: true
jobs:
include:
- name: "Compile and test. Python 3.10"
<<: *job_compile_common
stage: Test and lint
python: "3.10"
env:
- TEST_DATASET=true
- name: "Compile and lint. Python 3.10"
<<: *job_compile_common
stage: Test and lint
python: "3.10"
script:
- make pycodestyle
- make pylint
- make mypy
- name: "Compile and test. Python 3.8"
<<: *job_compile_common
stage: Test multiple python versions
python: "3.8"
- name: "Compile and test. Python 3.9"
<<: *job_compile_common
stage: Test multiple python versions
python: "3.9"
- name: "Build wheel for Python 3.8, 3.9, 3.10 on Linux x86_64"
os: linux
dist: focal
language: python
services: docker
stage: Build wheels
if: branch =~ /^release\/.*$/
env:
# Use a specific torch version.
- CIBW_ENVIRONMENT="TORCH_VERSION_SPECIFIER='==2.4.1'"
- CIBW_BEFORE_BUILD="pip install torch==2.4.1 torchvision && pip install -r requirements.txt"
- CIBW_MANYLINUX_X86_64_IMAGE="aihwkit/manylinux2014_x86_64_aihwkit"
- CIBW_REPAIR_WHEEL_COMMAND="auditwheel repair -w {dest_dir} {wheel} --exclude libtorch_python.so"
- CIBW_BUILD="cp38-manylinux_x86_64 cp39-manylinux_x86_64 cp310-manylinux_x86_64 cp311-manylinux_x86_64"
before_install:
- docker pull aihwkit/manylinux2014_x86_64_aihwkit
install:
- python3 -m pip install cibuildwheel==2.8.1
script:
# Build the wheels into './wheelhouse'.
- python3 -m cibuildwheel --output-dir wheelhouse
<<: *build_deploy_common
- name: "Build wheel for Python 3.8, 3.9 on OS X"
os: osx
osx_image: xcode12.4
stage: Build wheels
if: branch =~ /^release\/.*$/
addons:
homebrew:
packages:
- openblas
update: true
env:
# Use a specific torch version.
- CIBW_ENVIRONMENT="TORCH_VERSION_SPECIFIER='==2.0.1'"
- CIBW_BEFORE_BUILD="pip install torch==2.0.1 torchvision && pip install ./delocate && pip install -r requirements.txt"
- CIBW_BUILD="cp38-macosx_x86_64 cp39-macosx_x86_64"
before_install:
- git clone -b aihwkit https://github.com/aihwkit-bot/delocate.git
install:
- python3 -m pip install cibuildwheel==2.8.1
script:
# Build the wheels into './wheelhouse'.
- python3 -m cibuildwheel --output-dir wheelhouse --platform macos
<<: *build_deploy_common
- name: "Build wheel for Python 3.8, 3.9, 3.10 on win64"
os: windows
language: shell
stage: Build wheels
if: branch =~ /^release\/win.*$/
env:
# Use a specific torch version.
- CIBW_ENVIRONMENT="TORCH_VERSION_SPECIFIER='==2.4.1'"
- CIBW_BEFORE_BUILD="pip install torch==2.4.1 && pip install -r requirements.txt"
- CIBW_BUILD="cp38-win_amd64 cp39-win_amd64 cp310-win_amd64"
# Use unzipped OpenBLAS.
- OPENBLAS_ROOT=C:\\BLAS
- OPENBLAS_ROOT_DIR=C:\\BLAS
before_install:
# Install base python, and ensure it's on the PATH.
- choco install python --version 3.8.6
- export PATH="/c/Python38:/c/Python38/Scripts:$PATH"
- ln -s /c/Python38/python.exe /c/Python38/python3.exe
# Download and unzip OpenBLAS.
- wget https://github.com/xianyi/OpenBLAS/releases/download/v0.3.12/OpenBLAS-0.3.12-x64.zip -q -O openblas.zip
- mkdir C:\\BLAS
- 7z x openblas.zip -oc:\\BLAS
install:
- python3 -m pip install cibuildwheel==2.8.1
script:
# Build the wheels into './wheelhouse'.
- python3 -m cibuildwheel --output-dir wheelhouse
<<: *build_deploy_common