-
Notifications
You must be signed in to change notification settings - Fork 0
89 lines (85 loc) · 3.05 KB
/
build_python.yml
File metadata and controls
89 lines (85 loc) · 3.05 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
# Adapted from https://github.com/RalfG/python-wheels-manylinux-build/blob/master/full_workflow_example.yml
name: libmcphase
on:
push:
branches: [main]
pull_request:
branches: [main]
types: [opened, reopened, synchronize]
workflow_dispatch:
concurrency :
group: ${{ github.workflow }}-${{ github.ref == 'refs/head/main' && github.run_number || github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash -l {0}
jobs:
build_and_test:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-14, macos-15-intel]
name: Build and test, ${{ matrix.os }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: mamba-org/setup-micromamba@v1
with:
cache-downloads: true
- name: Tag if release
if: contains(github.event.pull_request.title, 'RELEASE')
run: |
git tag $(python release.py --version_check)
- name: Build wheels
run: |
$MAMBA_EXE create -n cibuildwheel python=3.12 eigen pybind11=3.0.1
eval "$($MAMBA_EXE shell activate cibuildwheel)"
python -m pip install cibuildwheel
if [[ $OSTYPE == "linux-gnu" ]]
then
export CIBW_ENVIRONMENT="CONDA_PREFIX=/host/$CONDA_PREFIX"
fi
python -m cibuildwheel --output-dir wheelhouse
env:
CIBW_BUILD: "cp310-* cp311-* cp312-* cp313-* cp314-*"
CIBW_SKIP: "*musllinux* *win32* *i686*"
CIBW_ARCHS_MACOS: "native"
CIBW_BUILD_VERBOSITY: 1
- name: Install wheels and run test
run: |
# set -e makes sure the script fails if any command in the loop fails
set -e
for pyver in 3.10 3.11 3.12 3.13 3.14
do
$MAMBA_EXE create -n py$pyver -c conda-forge python=$pyver numpy
eval "$($MAMBA_EXE shell activate py$pyver)"
python -m pip install wheelhouse/*cp$(echo $pyver | sed s/\\.//)*
cd tests
python -m unittest
cd ..
done
- name: Build and test Pyodide wheel
if: matrix.os == 'ubuntu-latest'
run: |
eval "$($MAMBA_EXE shell activate cibuildwheel)"
CIBW_BUILD="cp312*" python -m cibuildwheel --output-dir dist --platform pyodide
mamba install nodejs
npm install
npm test
mv dist/*wasm*.whl wheelhouse/
- name: Upload release wheels
if: |
contains(github.event.pull_request.title, 'RELEASE') &&
github.event.pull_request.merged
run: |
python -m pip install requests numpy
python release.py --notest --github --create_tag --token=${{ secrets.GH_TOKEN }}
- uses: actions/upload-artifact@v4
if: |
${{ github.event_name == 'pull_request' }} &&
contains(github.event.pull_request.labels.*.name, 'save_wheels')
with:
name: ${{ matrix.os }}_artifacts.zip
path: wheelhouse/*
#- name: Setup tmate
# if: ${{ failure() }}
# uses: mxschmitt/action-tmate@v3