-
Notifications
You must be signed in to change notification settings - Fork 5
129 lines (129 loc) · 4.42 KB
/
wheels.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
name: Build Wheels
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
release:
types:
- published
jobs:
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- name: Install Deps
run: |
sudo apt-get update
sudo apt-get install libcfitsio-dev python-is-python3 libboost-python-dev ninja-build
curl -L https://github.com/icecube/photospline/archive/refs/tags/v2.2.1.tar.gz | tar xz
cmake -S photospline-2.2.1 -B photospline -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr
sudo make install -C photospline
- uses: actions/checkout@v4
- name: Build sdist
run: pipx run build --sdist
- name: Test sdist
run: |
python -m pip install meson pytest
python -m pip install dist/nuflux-*.tar.gz
python tests/test_fluxes.py --junit-xml=test-results-cibw-sdist.junit.xml
- uses: actions/upload-artifact@v4
with:
name: cibw-sdist
path: |
dist/nuflux-*.tar.gz
test-results-cibw-sdist.junit.xml
build_wheels:
name: Build wheels cp${{ matrix.python }}-manylinux_x86_64
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python: ["37", "38", "39", "310", "311", "312"]
steps:
- uses: actions/checkout@v4
- name: Build wheels
uses: pypa/cibuildwheel@v2.16.2
env:
CIBW_BUILD: cp${{ matrix.python }}-manylinux_x86_64
- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-cp${{ matrix.python }}
path: ./wheelhouse/*.whl
test_wheels:
name: Test Wheel with Python ${{ matrix.python-version }} on ${{ matrix.os }}
needs: build_wheels
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Download wheel
uses: actions/download-artifact@v4
with:
path: artifact
- name: Display structure of downloaded files
run: |
PYNAME=$(echo cp${{matrix.python-version}} | sed 's/\.//')
FNAME=artifact/cibw-wheels-${PYNAME}/nuflux-*-${PYNAME}-*.whl
python3 -m pip install pytest $FNAME
- uses: actions/checkout@v4
- name: Test
working-directory: tests
run: ./test_fluxes.py --junit-xml=test-results-cibw-${{ matrix.python-version }}.junit.xml
cvmfs_test_wheel:
name: Test Wheel with cvmfs ${{matrix.cvmfs}}
needs: build_wheels
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
cvmfs: [py3-v4.1.1, py3-v4.2.1, py3-v4.3.0]
include:
- cvmfs: py3-v4.1.1
python-tag: cp37
- cvmfs: py3-v4.2.1
python-tag: cp310
- cvmfs: py3-v4.3.0
python-tag: cp311
steps:
- uses: cvmfs-contrib/github-action-cvmfs@v3
- name: Checkout nuflux
uses: actions/checkout@v4
- name: Download wheel
uses: actions/download-artifact@v4
with:
pattern: cibw-wheels-${{ matrix.python-tag }}
merge-multiple: true
- name: Build and Run Tests in Docker
uses: addnab/docker-run-action@v3
with:
options: -v /cvmfs/icecube.opensciencegrid.org/:/cvmfs/icecube.opensciencegrid.org/ -v /home/runner/work/nuflux/nuflux:/nuflux
image: centos:centos7.9.2009
run: |
eval $(/cvmfs/icecube.opensciencegrid.org/${{matrix.cvmfs}}/setup.sh)
python3 -m pip install --user 'pytest>=7,<8' /nuflux/nuflux-*-${{matrix.python-tag}}-*.whl
python3 /nuflux/tests/test_fluxes.py --junit-xml=test-results-cibw-cvmfs-${{ matrix.cvmfs }}.junit.xml
upload_pypi:
needs: [cvmfs_test_wheel, test_wheels, build_sdist]
runs-on: ubuntu-latest
environment: pypi
permissions:
id-token: write
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/download-artifact@v4
with:
pattern: cibw-*
path: dist
merge-multiple: true
- uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}