Make pip wheel with Dakota+Carolina #78
Workflow file for this run
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
name: Python package | |
env: | |
DAKOTA_VERSION: 6.18.0 | |
on: | |
pull_request: | |
branches: [main] | |
workflow_dispatch: | |
jobs: | |
build-dakota: | |
name: Build Dakota | |
runs-on: ubuntu-22.04 | |
strategy: | |
matrix: | |
python-version: ["3.10"] | |
steps: | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Cache Dakota | |
id: cache-dakota | |
uses: actions/cache@v3 | |
with: | |
path: dakota-${{ env.DAKOTA_VERSION }}.tar.gz | |
key: dakota | |
- name: Install Dakota build dependencies | |
if: steps.cache-dakota.outputs.cache-hit != 'true' | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install numpy | |
sudo apt-get update | |
sudo apt-get install libboost-python-dev libboost-all-dev cmake gfortran libblas-dev liblapack-dev | |
- name: Download Dakota | |
if: steps.cache-dakota.outputs.cache-hit != 'true' | |
run: | | |
wget --no-check-certificate https://github.com/snl-dakota/dakota/releases/download/v${{ env.DAKOTA_VERSION }}/dakota-${{ env.DAKOTA_VERSION }}-public-src-cli.tar.gz | |
- name: Build Dakota | |
if: steps.cache-dakota.outputs.cache-hit != 'true' | |
run: | | |
mkdir local | |
tar zxf dakota-${{ env.DAKOTA_VERSION }}-public-src-cli.tar.gz | |
cd dakota-${{ env.DAKOTA_VERSION }}-public-src-cli | |
mkdir build | |
cd build | |
cmake \ | |
-DCMAKE_CXX_STANDARD=14 \ | |
-DBUILD_SHARED_LIBS=ON \ | |
-DDAKOTA_PYTHON_DIRECT_INTERFACE=ON \ | |
-DDAKOTA_PYTHON_DIRECT_INTERFACE_NUMPY=ON \ | |
-DDAKOTA_DLL_API=OFF \ | |
-DHAVE_X_GRAPHICS=OFF \ | |
-DDAKOTA_ENABLE_TESTS=OFF \ | |
-DDAKOTA_ENABLE_TPL_TESTS=OFF \ | |
-DCMAKE_BUILD_TYPE="Release" \ | |
-DDAKOTA_NO_FIND_TRILINOS:BOOL=TRUE \ | |
-DCMAKE_INSTALL_PREFIX="$GITHUB_WORKSPACE/local" \ | |
.. | |
make -j4 install | |
- name: Make a tar file | |
if: steps.cache-dakota.outputs.cache-hit != 'true' | |
run: | | |
tar zcf dakota-${{ env.DAKOTA_VERSION }}.tar.gz local | |
tests: | |
name: "Run tests" | |
needs: build-dakota | |
if: ${{ always() && needs.build-dakota.result != 'failed' }} | |
runs-on: ubuntu-22.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.10"] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Restore Dakota build from cache | |
uses: actions/cache/restore@v3 | |
with: | |
key: dakota | |
path: dakota-${{ env.DAKOTA_VERSION }}.tar.gz | |
- name: Unpack Dakota binaries | |
run: | | |
cd $HOME | |
mv $GITHUB_WORKSPACE/dakota-${{ env.DAKOTA_VERSION }}.tar.gz . | |
tar zxf dakota-${{ env.DAKOTA_VERSION }}.tar.gz | |
- name: Install Dakota/Carolina dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install libboost-python-dev libboost-all-dev | |
- name: Install Python dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install pytest | |
- name: Install Carolina | |
run: | | |
export PATH=${PATH}:${HOME}/local/bin | |
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${HOME}/local/lib | |
python -m pip install . | |
- name: Run Tests | |
run: | | |
export PATH=${PATH}:${HOME}/local/bin | |
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${HOME}/local/lib | |
python -m pytest |