2424 with :
2525 submodules : recursive
2626
27+ - name : Cache GFortran install
28+ if : ${{ contains(matrix.os, 'windows') }}
29+ id : cache
30+ uses : actions/cache@v2
31+ with :
32+ path : ./mingw-w64
33+ key : gcc-${{ matrix.gcc }}-${{ matrix.os }}
34+
2735 - name : Install GFortran (MacOS)
2836 if : ${{ contains(matrix.os, 'macos') }}
2937 run : |
4048 --slave /usr/bin/gcov gcov /usr/bin/gcov-${{ matrix.gcc }}
4149
4250 - name : Install GFortran (Windows)
43- if : ${{ contains(matrix.os, 'windows') }}
51+ if : ${{ contains(matrix.os, 'windows') && steps.cache.outputs.cache-hit != 'true' }}
4452 run : |
4553 Invoke-WebRequest -Uri ${{ env.DOWNLOAD }} -OutFile mingw-w64.zip
4654 Expand-Archive mingw-w64.zip
9098 if : ${{ matrix.build == 'meson' }}
9199 run : >-
92100 meson setup _build
101+ --libdir=lib
93102 --prefix=${{ contains(matrix.os, 'windows') && '$pwd\_dist' || '$PWD/_dist' }}
94103
95104 - name : Compile project (meson)
@@ -104,6 +113,146 @@ jobs:
104113 if : ${{ matrix.build == 'meson' }}
105114 run : meson install -C _build --no-rebuild
106115
116+ - name : Create package (Unix)
117+ if : ${{ matrix.build == 'meson' && ! contains(matrix.os, 'windows') }}
118+ run : |
119+ tar cvf ${{ env.OUTPUT }} _dist
120+ xz -T0 ${{ env.OUTPUT }}
121+ echo "MINPACK_OUTPUT=${{ env.OUTPUT }}.xz" >> $GITHUB_ENV
122+ env :
123+ OUTPUT : minpack-${{ matrix.os }}.tar
124+
125+ - name : Create package (Windows)
126+ if : ${{ matrix.build == 'meson' && contains(matrix.os, 'windows') }}
127+ run : |
128+ tar cvf ${{ env.OUTPUT }} _dist
129+ xz -T0 ${{ env.OUTPUT }}
130+ echo "MINPACK_OUTPUT=${{ env.OUTPUT }}.xz" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
131+ env :
132+ OUTPUT : minpack-${{ matrix.os }}.tar
133+
134+ - name : Upload package
135+ if : ${{ matrix.build == 'meson' }}
136+ uses : actions/upload-artifact@v2
137+ with :
138+ name : ${{ env.MINPACK_OUTPUT }}
139+ path : ${{ env.MINPACK_OUTPUT }}
140+
141+
142+ Python :
143+ needs :
144+ - Build
145+ runs-on : ${{ matrix.os }}
146+ defaults :
147+ run :
148+ shell : ${{ contains(matrix.os, 'windows') && 'powershell' || 'bash -l {0}' }}
149+ strategy :
150+ fail-fast : false
151+ matrix :
152+ build : [meson]
153+ os : [ubuntu-latest, macos-latest]
154+ gcc : [10]
155+ python : ['3.7', '3.8', '3.9']
156+
157+ # Additional test for setuptools build
158+ include :
159+ - build : setuptools
160+ os : ubuntu-latest
161+ gcc : 10
162+ python : ' 3.9'
163+
164+ env :
165+ FC : gfortran
166+ CC : gcc
167+ MINPACK_OUTPUT : minpack-${{ matrix.os }}.tar.xz
168+
169+ steps :
170+ - name : Checkout code
171+ uses : actions/checkout@v2
172+
173+ - name : Cache GFortran install
174+ if : ${{ contains(matrix.os, 'windows') }}
175+ id : cache
176+ uses : actions/cache@v2
177+ with :
178+ path : ./mingw-w64
179+ key : gcc-${{ matrix.gcc }}-${{ matrix.os }}
180+
181+ - name : Install dependencies
182+ uses : mamba-org/provision-with-micromamba@main
183+ with :
184+ environment-file : config/ci/python-env.yaml
185+ extra-specs : |
186+ python=${{ matrix.python }}
187+
188+ - name : Install GFortran (MacOS)
189+ if : ${{ contains(matrix.os, 'macos') }}
190+ run : |
191+ brew install gcc@${{ matrix.gcc }}
192+ ln -s /usr/local/bin/gfortran-${{ matrix.gcc }} /usr/local/bin/gfortran
193+ ln -s /usr/local/bin/gcc-${{ matrix.gcc }} /usr/local/bin/gcc
194+
195+ - name : Install GFortran (Linux)
196+ if : ${{ contains(matrix.os, 'ubuntu') }}
197+ run : |
198+ sudo update-alternatives \
199+ --install /usr/bin/gcc gcc /usr/bin/gcc-${{ matrix.gcc }} 100 \
200+ --slave /usr/bin/gfortran gfortran /usr/bin/gfortran-${{ matrix.gcc }} \
201+ --slave /usr/bin/gcov gcov /usr/bin/gcov-${{ matrix.gcc }}
202+
203+ - name : Install GFortran (Windows)
204+ if : ${{ contains(matrix.os, 'windows') && steps.cache.outputs.cache-hit != 'true' }}
205+ run : |
206+ Invoke-WebRequest -Uri ${{ env.DOWNLOAD }} -OutFile mingw-w64.zip
207+ Expand-Archive mingw-w64.zip
208+ echo "$pwd\mingw-w64\mingw64\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
209+ shell : pwsh
210+ env :
211+ DOWNLOAD : " https://github.com/brechtsanders/winlibs_mingw/releases/download/10.3.0-12.0.0-9.0.0-r2/winlibs-x86_64-posix-seh-gcc-10.3.0-mingw-w64-9.0.0-r2.zip"
212+
213+ - name : Download package
214+ uses : actions/download-artifact@v2
215+ with :
216+ name : ${{ env.MINPACK_OUTPUT }}
217+
218+ - name : Unpack package (Unix)
219+ if : ${{ ! contains(matrix.os, 'windows') }}
220+ run : |
221+ tar xvf ${{ env.MINPACK_OUTPUT }}
222+ echo "MINPACK_PREFIX=$PWD/_dist" >> $GITHUB_ENV
223+
224+ - name : Unpack package (Windows)
225+ if : ${{ contains(matrix.os, 'windows') }}
226+ run : |
227+ tar xvf ${{ env.MINPACK_OUTPUT }}
228+ echo "MINPACK_OUTPUT=${{ env.OUTPUT }}.xz" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
229+
230+ - name : Install Python extension module (pip)
231+ if : ${{ matrix.build == 'setuptools' }}
232+ run : pip3 install . -vv
233+ working-directory : python
234+ env :
235+ PKG_CONFIG_PATH : ${{ env.PKG_CONFIG_PATH }}:${{ env.MINPACK_PREFIX }}/lib/pkgconfig
236+ LD_RUNPATH_SEARCH_PATH : ${{ env.MINPACK_PREFIX }}/lib
237+
238+ - name : Install Python extension module (meson)
239+ if : ${{ matrix.build == 'meson' }}
240+ run : |
241+ set -ex
242+ meson setup _build --prefix=$CONDA_PREFIX --libdir=lib
243+ meson compile -C _build
244+ meson install -C _build
245+ working-directory : python
246+ env :
247+ PKG_CONFIG_PATH : ${{ env.PKG_CONFIG_PATH }}:${{ env.MINPACK_PREFIX }}/lib/pkgconfig
248+
249+ - name : Test Python API
250+ run : pytest --doctest-modules --pyargs minpack --cov=minpack -vv
251+ env :
252+ LD_LIBRARY_PATH : ${{ env.LD_LIBRARY_PATH }}:${{ env.MINPACK_PREFIX }}/lib
253+ DYLD_LIBRARY_PATH : ${{ env.DYLD_LIBRARY_PATH }}:${{ env.MINPACK_PREFIX }}/lib
254+
255+
107256 Docs :
108257 runs-on : ubuntu-latest
109258 defaults :
0 commit comments