-
Notifications
You must be signed in to change notification settings - Fork 0
147 lines (139 loc) · 5.93 KB
/
pypi.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
name: Build Status
on: [push, pull_request]
env:
BOOST_VERSION: 1.84.0
EIGEN_VERSION: 3.4.0
jobs:
build:
strategy:
fail-fast: false
matrix:
# macos-13 is an intel runner, macos-14 is apple silicon
python: [38, 39, 310, 311, 312]
cfg:
- { os: ubuntu-latest, cibw_id: manylinux_x86_64, cc: gcc, cxx: g++, platform: x64, root_install_dir: '/home/runner/work'}
- { os: ubuntu-latest, cibw_id: musllinux_x86_64, cc: gcc, cxx: g++, platform: x64, root_install_dir: '/home/runner/work'}
- { os: macos-13, cibw_id: macosx_x86_64, cc: clang, cxx: clang++, platform: x64, root_install_dir: '/Users/runner/work'} # intel runner
- { os: macos-14, cibw_id: macosx_arm64, cc: clang, cxx: clang++, platform: arm64, root_install_dir: '/Users/runner/work'} # apple silicon runner
- { os: windows-latest, cibw_id: win_amd64, cc: cl, cxx: cl, platform: x64, root_install_dir: 'D:\'}
env:
PYTHON_VENV_ROOT: ${{github.workspace}}/src/python-venv
name: Build and test on ${{ matrix.cfg.os }} for cp${{ matrix.python }}-${{ matrix.cfg.cibw_id }}
runs-on: ${{ matrix.cfg.os }}
steps:
- name: Checkout project
uses: actions/checkout@v4
with:
submodules: recursive
- name: Get history and tags for SCM versioning to work
run: |
git fetch --prune --unshallow
# git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- name: Install dependencies
id: install-dependencies
uses: vinecopulib/vinecopulib/.github/actions/install-dependencies@better-actions
with:
os: ${{ matrix.cfg.os }}
platform: ${{ matrix.cfg.platform }}
boost_install_dir: ${{ matrix.cfg.root_install_dir }}
eigen_install_dir: ${{ matrix.cfg.root_install_dir }}
boost_version: ${{ env.BOOST_VERSION }}
eigen_version: ${{ env.EIGEN_VERSION }}
wdm: 'false'
- name: Lint with flake8
if: matrix.cfg.os != 'windows-latest'
run: |
python3 -m venv ${PYTHON_VENV_ROOT}
source ${PYTHON_VENV_ROOT}/bin/activate
pip3 install flake8
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --exclude=lib
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics --exclude=lib
- name: Build and test wheels
uses: pypa/cibuildwheel@v2.20.0
env:
CIBW_BUILD: cp${{ matrix.python }}-${{ matrix.cfg.cibw_id }}
CIBW_ENVIRONMENT_WINDOWS: Boost_INCLUDE_DIR='${{steps.install-dependencies.outputs.BOOST_ROOT}}\include' EIGEN3_INCLUDE_DIR='C:\ProgramData\chocolatey\lib\eigen\include'
CIBW_ENVIRONMENT_MACOS: "Boost_INCLUDE_DIR=${{steps.install-dependencies.outputs.BOOST_ROOT}}/include EIGEN3_INCLUDE_DIR=${{matrix.cfg.root_install_dir}}/include/eigen3"
CIBW_ENVIRONMENT_LINUX: "Boost_INCLUDE_DIR=/host${{steps.install-dependencies.outputs.BOOST_ROOT}}/include EIGEN3_INCLUDE_DIR=/host${{matrix.cfg.root_install_dir}}/include/eigen3"
CIBW_ENVIRONMENT_PASS_LINUX: "Boost_INCLUDE_DIR EIGEN3_INCLUDE_DIR"
- name: Upload binaries
uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.cfg.os }}-${{ matrix.python }}-${{ matrix.cfg.cibw_id }}
path: ./wheelhouse/*.whl
build_sdist:
runs-on: ubuntu-latest
# needs: build
steps:
- name: Checkout project
uses: actions/checkout@v4
with:
submodules: recursive
- name: Get history and tags for SCM versioning to work
run: |
git fetch --prune --unshallow
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- name: Install dependencies
id: install-dependencies
uses: vinecopulib/vinecopulib/.github/actions/install-dependencies@better-actions
with:
os: 'ubuntu-latest'
boost_install_dir: '/home/runner/work'
eigen_install_dir: '/home/runner/work'
boost_version: ${{ env.BOOST_VERSION }}
eigen_version: ${{ env.EIGEN_VERSION }}
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Upgrade pip and install build dependency
run: |
echo "Boost_INCLUDE_DIR=${{steps.install-dependencies.outputs.BOOST_ROOT}}/include" >> $GITHUB_ENV
echo "EIGEN3_INCLUDE_DIR=/home/runner/work/include/eigen3" >> $GITHUB_ENV
python -m pip install --upgrade pip
pip install build
- name: Create source distribution
run: |
export Boost_INCLUDE_DIR=$Boost_INCLUDE_DIR
export EIGEN3_INCLUDE_DIR=$EIGEN3_INCLUDE_DIR
pipx run build --sdist
- name: Upload binaries
uses: actions/upload-artifact@v4
with:
name: cibw-sdist
path: dist/*.tar.gz
upload_to_pypi:
needs: build
runs-on: ubuntu-latest
environment: pypi
permissions:
id-token: write
steps:
- name: Download cibw artifacts
uses: actions/download-artifact@v4
with:
# unpacks all CIBW artifacts into dist/
pattern: cibw-*
path: dist
merge-multiple: true
- name: Publish distribution Test PyPI
if: |
job.status == 'success'
&& github.base_ref == 'main'
&& github.head_ref == 'dev'
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.test_pypi_password }}
repository_url: https://test.pypi.org/legacy/
- name: Publish distribution to PyPI
if: |
job.status == 'success'
&& github.event_name == 'push'
&& startsWith(github.event.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.pypi_password }}