-
Notifications
You must be signed in to change notification settings - Fork 4
142 lines (136 loc) · 5.65 KB
/
build-wheels.yml
File metadata and controls
142 lines (136 loc) · 5.65 KB
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
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Build and upload wheels
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
create:
tags:
# schedule:
# - cron: '0 0 * * 0,3' # 2/weekly
jobs:
build_macos_linux:
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
python-version: [ "3.7", "3.8", "3.9", "3.10" ]
os: [ubuntu-latest, macos-latest]
platform: [x64, x32, aarch64]
exclude:
- os: macos-latest
platform: x32
- os: macos-latest
platform: aarch64
include:
- python-version: "3.8"
os: macos-10.15
platform: x86_64
- python-version: "3.9"
os: macos-10.15
platform: x86_64
- python-version: "3.10"
os: macos-10.15
platform: x86_64
env:
BUILD_COMMIT: v1.6.2rel
MB_ML_VER: 2014
REPO_DIR: cftime
PKG_NAME: cftime
UNICODE_WIDTH: 32
MB_PYTHON_VERSION: ${{ matrix.python-version }}
TRAVIS_PYTHON_VERSION: ${{ matrix.python-version }}
TRAVIS_REPO_SLUG: ${{ github.repository }}
TRAVIS_BRANCH: ${{ github.head_ref }}
TRAVIS_PULL_REQUEST: ${{ github.event.number }}
TRAVIS_BUILD_DIR: ${{ github.workspace }}
MULTIBUILD_WHEELS_STAGING_ACCESS: ${{ secrets.MULTIBUILD_WHEELS_STAGING_ACCESS }}
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- uses: docker/setup-qemu-action@v1
if: ${{ matrix.platform == 'aarch64' }}
name: Set up QEMU
- name: Pin Numpy version
run: |
if [ "$MB_PYTHON_VERSION" == '3.6' ]; then
echo "NP_DEP=$(echo numpy==1.17.3)" >> $GITHUB_ENV;
elif [ "$MB_PYTHON_VERSION" == '3.7' ]; then
echo "NP_DEP=$(echo numpy==1.17.3)" >> $GITHUB_ENV;
elif [ "$MB_PYTHON_VERSION" == '3.8' ]; then
echo "NP_DEP=$(echo oldest-supported-numpy)" >> $GITHUB_ENV;
elif [ "$MB_PYTHON_VERSION" == '3.9' ]; then
echo "NP_DEP=$(echo oldest-supported-numpy)" >> $GITHUB_ENV;
elif [ "$MB_PYTHON_VERSION" == '3.10' ]; then
echo "NP_DEP=$(echo oldest-supported-numpy)" >> $GITHUB_ENV;
else
echo "None of the defined python version, use default"
fi
- name: Setup Environment variables
run: |
if [ "schedule" == "${{ github.event_name }}" ] || [ "master" == "$BUILD_COMMIT" ]; then echo "TOKEN=$SCIPY_WHEELS_NIGHTLY_ACCESS" >> $GITHUB_ENV; else echo "TOKEN=$MULTIBUILD_WHEELS_STAGING_ACCESS" >> $GITHUB_ENV; fi
if [ "x32" == "${{ matrix.platform }}" ]; then echo "PLAT=i686" >> $GITHUB_ENV; elif [ "aarch64" == "${{ matrix.platform }}" ]; then echo "PLAT=aarch64" >> $GITHUB_ENV; else echo "PLAT=x86_64" >> $GITHUB_ENV; fi
if [ "macos-latest" == "${{ matrix.os }}" ]; then echo "TRAVIS_OS_NAME=osx" >> $GITHUB_ENV; else echo "TRAVIS_OS_NAME=${{ matrix.os }}" >> $GITHUB_ENV; fi
if [ "schedule" == "${{ github.event_name }}" ]; then echo "TRAVIS_EVENT_TYPE=cron" >> $GITHUB_ENV; else echo "TRAVIS_EVENT_TYPE=${{ github.event_name }}" >> $GITHUB_ENV; fi
if [ "schedule" == "${{ github.event_name }}" ]; then echo "BUILD_COMMIT=master" >> $GITHUB_ENV; else echo "BUILD_COMMIT=$BUILD_COMMIT" >> $GITHUB_ENV; fi
# make universal2 wheels on macos 10.15 by cross-compiling
if [ "macos-10.15" == "${{ matrix.os }}" ]; then echo "PLAT=universal2" >> $GITHUB_ENV; fi
- name: Setup Special Environment variables for aarch64
if: startsWith(matrix.platform,'aarch64')
run: |
echo "DOCKER_TEST_IMAGE=$(echo multibuild/focal_arm64v8)" >> $GITHUB_ENV
- name: Print some Environment variable
run: |
echo "TRAVIS_BRANCH: ${TRAVIS_BRANCH}"
echo "TRAVIS_PULL_REQUEST: ${TRAVIS_PULL_REQUEST}"
echo "TRAVIS_REPO_SLUG: ${TRAVIS_REPO_SLUG}"
echo "TRAVIS_EVENT_TYPE: ${TRAVIS_EVENT_TYPE}"
echo "TRAVIS_OS_NAME: ${TRAVIS_OS_NAME}"
echo "PLAT: ${PLAT}"
echo "DOCKER_TEST_IMAGE: ${DOCKER_TEST_IMAGE}"
- name: Install VirtualEnv
run: |
python -m pip install --upgrade pip
pip install virtualenv
- name: Build and Install Wheels
run: |
BUILD_DEPENDS="$NP_DEP cython"
TEST_DEPENDS="$NP_DEP pytest pytest-cov"
source multibuild/common_utils.sh
source multibuild/travis_steps.sh
echo "------- BEFORE INSTALL --------"
before_install
echo "------- CLEAN CODE --------"
python -m pip install --upgrade pip
/bin/rm -rf $REPO_DIR
git clone https://github.com/Unidata/${REPO_DIR}
cd $REPO_DIR
git checkout master
git pull
git checkout $BUILD_COMMIT
#sed -i -e "s/numpy/oldest-supported-numpy/g" pyproject.toml
cd ..
echo "------- BUILD WHEEL --------"
build_wheel $REPO_DIR $PLAT
echo "------- INSTALL_RUN --------"
install_run $PLAT
ls -l wheelhouse/cftime*whl
- name: Upload wheels to release
uses: svenstaro/upload-release-action@v2
if: github.event_name == 'create'
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ github.workspace }}/wheelhouse/cftime*whl
tag: ${{ github.ref }}
overwrite: true
file_glob: true