Skip to content

Commit 649d848

Browse files
committed
add github actions workflow
1 parent 34faa4f commit 649d848

File tree

1 file changed

+108
-0
lines changed

1 file changed

+108
-0
lines changed

.github/workflows/build-wheels.yml

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
3+
4+
name: Build and upload wheels
5+
6+
on:
7+
push:
8+
branches: [ master ]
9+
pull_request:
10+
branches: [ master ]
11+
create:
12+
tags:
13+
# schedule:
14+
# - cron: '0 0 * * 0,3' # 2/weekly
15+
16+
jobs:
17+
build:
18+
19+
runs-on: ${{ matrix.os }}
20+
defaults:
21+
run:
22+
shell: bash
23+
strategy:
24+
25+
fail-fast: false
26+
matrix:
27+
# python-version: ["3.6", "3.7", "3.8", "3.9"]
28+
# os: [ubuntu-latest, macos-latest]
29+
# platform: [x64, x32]
30+
# test on a single platform, python version
31+
python-version: ["3.8"]
32+
os: [ubuntu-latest]
33+
platform: [x64]
34+
MB_ML_VER: [2014]
35+
exclude:
36+
- os: macos-latest
37+
platform: x32
38+
env:
39+
REPO_DIR: netcdf4-python
40+
PKG_NAME: netcdf4-python
41+
BUILD_COMMIT: src_reorg
42+
UNICODE_WIDTH: 32
43+
MB_PYTHON_VERSION: ${{ matrix.python-version }}
44+
TRAVIS_PYTHON_VERSION: ${{ matrix.python-version }}
45+
MB_ML_VER: ${{ matrix.MB_ML_VER }}
46+
TRAVIS_REPO_SLUG: ${{ github.repository }}
47+
TRAVIS_BRANCH: ${{ github.head_ref }}
48+
TRAVIS_PULL_REQUEST: ${{ github.event.number }}
49+
TRAVIS_BUILD_DIR: ${{ github.workspace }}
50+
MULTIBUILD_WHEELS_STAGING_ACCESS: ${{ secrets.MULTIBUILD_WHEELS_STAGING_ACCESS }}
51+
52+
steps:
53+
- uses: actions/checkout@v2
54+
with:
55+
submodules: recursive
56+
- name: Set up Python ${{ matrix.python-version }}
57+
uses: actions/setup-python@v2
58+
with:
59+
python-version: ${{ matrix.python-version }}
60+
- name: Setup Environment variables
61+
run: |
62+
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
63+
if [ "x32" == "${{ matrix.platform }}" ]; then echo "PLAT=i686" >> $GITHUB_ENV; else echo "PLAT=x86_64" >> $GITHUB_ENV; fi
64+
if [ "macos-latest" == "${{ matrix.os }}" ]; then echo "TRAVIS_OS_NAME=osx" >> $GITHUB_ENV; else echo "TRAVIS_OS_NAME=${{ matrix.os }}" >> $GITHUB_ENV; fi
65+
if [ "schedule" == "${{ github.event_name }}" ]; then echo "TRAVIS_EVENT_TYPE=cron" >> $GITHUB_ENV; else echo "TRAVIS_EVENT_TYPE=${{ github.event_name }}" >> $GITHUB_ENV; fi
66+
if [ "schedule" == "${{ github.event_name }}" ]; then echo "BUILD_COMMIT=master" >> $GITHUB_ENV; else echo "BUILD_COMMIT=$BUILD_COMMIT" >> $GITHUB_ENV; fi
67+
- name: Setup Special Environment variables for Linux
68+
if: startsWith(matrix.os,'ubuntu') && matrix.MB_ML_VER == 2010
69+
run: |
70+
echo "DOCKER_TEST_IMAGE=$(echo multibuild/xenial_$PLAT)" >> $GITHUB_ENV
71+
- name: Print some Environment variable
72+
run: |
73+
echo "TRAVIS_BRANCH: ${TRAVIS_BRANCH}"
74+
echo "TRAVIS_PULL_REQUEST: ${TRAVIS_PULL_REQUEST}"
75+
echo "TRAVIS_REPO_SLUG: ${TRAVIS_REPO_SLUG}"
76+
echo "TRAVIS_EVENT_TYPE: ${TRAVIS_EVENT_TYPE}"
77+
echo "TRAVIS_OS_NAME: ${TRAVIS_OS_NAME}"
78+
echo "PLAT: ${PLAT}"
79+
echo "DOCKER_TEST_IMAGE: ${DOCKER_TEST_IMAGE}"
80+
81+
- name: Install VirtualEnv
82+
run: |
83+
python -m pip install --upgrade pip
84+
pip install virtualenv
85+
- name: Build and Install Wheels
86+
run: |
87+
source multibuild/common_utils.sh
88+
source multibuild/travis_steps.sh
89+
echo "------- BEFORE INSTALL --------"
90+
before_install
91+
echo "------- CLEAN CODE --------"
92+
clean_code $REPO_DIR $BUILD_COMMIT
93+
echo "------- BUILD WHEEL --------"
94+
build_wheel $REPO_DIR $PLAT
95+
echo "------- INSTALL_RUN --------"
96+
install_run $PLAT
97+
cd $TRAVIS_BUILD_DIR
98+
pwd
99+
find ./ -name "*.whl" -print
100+
- name: Upload wheels to release
101+
uses: svenstaro/upload-release-action@v2
102+
if: github.event_name == 'create'
103+
with:
104+
repo_token: ${{ secrets.GITHUB_TOKEN }}
105+
file: ${{ github.workspace }}/wheelhouse/netCDF4*whl
106+
tag: ${{ github.ref }}
107+
overwrite: true
108+
file_glob: true

0 commit comments

Comments
 (0)