add setuptools for cpymad build #628
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow builds and tests cpymad against MAD-X to check if there are | |
# any major breaking changes that should be conveyed to the cpymad developers. | |
name: cpymad | |
on: | |
push: | |
pull_request: | |
jobs: | |
madx-linux: | |
runs-on: ubuntu-latest | |
env: | |
MADXDIR: ${{ github.workspace }}/dist | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install build dependencies | |
run: | | |
sudo apt-get install -qy \ | |
libblas-dev \ | |
liblapack-dev \ | |
gfortran | |
- name: Configure | |
run: | | |
cmake . \ | |
-DMADX_X11=OFF \ | |
-DMADX_STATIC=ON \ | |
-DMADX_ONLINE=OFF \ | |
-DMADX_FORCE_32=OFF \ | |
-DMADX_INSTALL_DOC=OFF \ | |
-DBUILD_SHARED_LIBS=OFF \ | |
-DCMAKE_INSTALL_PREFIX=$MADXDIR \ | |
-DCMAKE_BUILD_TYPE=Release | |
- name: Build | |
run: cmake --build . --target install | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: madx-static-ubuntu-64 | |
path: ${{ env.MADXDIR }} | |
madx-macos: | |
runs-on: macos-latest | |
env: | |
MADXDIR: ${{ github.workspace }}/dist | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Configure | |
run: | | |
cmake . \ | |
-DCMAKE_OSX_ARCHITECTURES=x86_64 \ | |
-DCMAKE_C_COMPILER=gcc-12 \ | |
-DCMAKE_CXX_COMPILER=g++-12 \ | |
-DCMAKE_Fortran_COMPILER=gfortran-12 \ | |
-DBUILD_SHARED_LIBS=OFF \ | |
-DMADX_STATIC=OFF \ | |
-DCMAKE_INSTALL_PREFIX=$MADXDIR \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
-DMADX_INSTALL_DOC=OFF \ | |
-DMADX_ONLINE=OFF \ | |
-DMADX_FORCE_32=OFF \ | |
-DMADX_X11=OFF | |
- name: Build | |
run: cmake --build . --target install | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: madx-static-macos-64 | |
path: ${{ env.MADXDIR }} | |
cpymad: | |
runs-on: ${{ matrix.os }}-latest | |
needs: [madx-linux, madx-macos] | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu, macos] | |
version: [master, v1.9.3] | |
env: | |
MADXDIR: madx | |
steps: | |
- name: Checkout cpymad | |
uses: actions/checkout@v3 | |
with: | |
repository: hibtc/cpymad | |
ref: ${{ matrix.version }} | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
- name: Download MAD-X | |
uses: actions/download-artifact@v2 | |
with: | |
name: madx-static-${{ matrix.os }}-64 | |
path: ${{ env.MADXDIR }} | |
- name: Install python setup dependencies | |
run: | | |
pip install cython | |
pip install pytest | |
pip install setuptools | |
- name: Build cpymad | |
run: | | |
if [[ ${{ matrix.os }} == macos ]]; then | |
export CC=gcc-12 | |
fi | |
export X11=0 BLAS=1 LAPACK=1 | |
python setup.py build_ext -lm | |
pip install -e . | |
- name: Run tests | |
run: | | |
set -ex | |
python test/test_madx.py | |
python test/test_util.py | |
env: | |
GFORTRAN_UNBUFFERED_PRECONNECTED: y |