Repository navigation
143 lines (120 loc) · 4.46 KB
/
Copy pathpython-package.yml
File metadata and controls
143 lines (120 loc) · 4.46 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
143
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Python package
on:
push:
branches: [ "master" ]
tags: [ "v*" ]
pull_request:
branches: [ "master" ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v7
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python-version }}
- name: Install C dependencies
run: |
sudo apt-get install libfftw3-dev
sudo apt-get install liblapack-dev
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
python -m pip install pytest
python -m pip install scons
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Install python package
run: |
python -m pip install -e .
- name: Test with pytest
run: |
pytest
# OS-X build. The runner is Apple Silicon, so this is what exercises the
# /opt/homebrew path in SConstruct - nothing had built this project on a
# Mac in years.
#
# The steps are deliberately the same ones doc/source/install.rst tells
# users to run. If this needs a workaround that the instructions do not
# mention, then the instructions are wrong and should be fixed instead.
macos:
runs-on: macos-latest
continue-on-error: true
steps:
- uses: actions/checkout@v7
- name: Set up Python
uses: actions/setup-python@v7
with:
python-version: "3.12"
- name: Install C dependencies
run: brew install fftw lapack
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
python -m pip install pytest scons
- name: Install python package
run: python -m pip install -e .
- name: Test with pytest
run: pytest
# Windows build. This replaces the Appveyor job that was removed in 2023,
# and produces the DLLs so that Windows users do not have to install a C
# compiler themselves.
windows:
runs-on: windows-latest
# Needed by the release step below; the default token is read only.
permissions:
contents: write
steps:
- uses: actions/checkout@v7
- name: Set up Python
uses: actions/setup-python@v7
with:
python-version: "3.12"
# SConstruct's 'compiler=mingw' path needs gcc on PATH. The runner image
# ships MSYS2, which is where the 64 bit toolchain comes from. Appveyor
# used to get this from conda's m2w64-toolchain instead.
- name: Add MinGW-w64 to PATH
run: |
echo "C:\msys64\mingw64\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Check the compiler
run: gcc --version
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
python -m pip install pytest scons build wheel
# This builds the C libraries too, see _custom_build.py. FFTW and LAPACK
# are not installed on the runner, so the build picks up the DLLs that
# are checked in under storm_analysis/c_libraries.
- name: Install python package
run: python -m pip install -e .
- name: Test with pytest
run: pytest
# MANIFEST.in already pulls *.dll into the distribution, so the wheel
# carries both the libraries just built and the FFTW/LAPACK ones that
# ship with the repository. setuptools sees no C extensions - scons
# builds them out of band - so it tags the wheel py3-none-any, which
# would let pip install these Windows DLLs on any platform. Retag it.
- name: Build wheel
run: |
python -m build --wheel
$whl = (Get-ChildItem dist\*.whl)[0].FullName
python -m wheel tags --platform-tag win_amd64 --remove $whl
Get-ChildItem dist
- name: Upload wheel
uses: actions/upload-artifact@v7
with:
name: storm-analysis-windows-wheel
path: dist/*.whl
# Workflow artifacts expire and need a GitHub login to download, so
# tagged versions also get the wheel attached to the release.
- name: Attach wheel to release
if: startsWith(github.ref, 'refs/tags/v')
uses: softprops/action-gh-release@v3
with:
files: dist/*.whl