CI #101
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 is a basic workflow to help you get started with Actions | |
name: CI | |
# Controls when the workflow will run | |
on: | |
# Triggers the workflow on push or pull request events but only for the main branch | |
pull_request: | |
paths-ignore: | |
- 'docs/**' | |
#push: | |
# paths-ignore: | |
# - 'docs/**' | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
conda: | |
name: conda | |
runs-on: ${{matrix.os}}-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
#- {os: macos, version: 1.12.0, channel: conda-forge, rust: stable} | |
#- {os: windows, version: 1.12.0, channel: conda-forge, rust: stable} | |
- {os: ubuntu, version: 1.12.0, channel: conda-forge, rust: stable, python-version: 3.9} | |
defaults: | |
run: | |
shell: bash -l {0} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
with: {submodules: true} | |
- name: Install Rust (${{matrix.rust}}) | |
uses: actions-rs/toolchain@v1 | |
with: {toolchain: '${{matrix.rust}}', profile: minimal, override: true} | |
- uses: "actions/checkout@v2" | |
- name: "Install miniconda" | |
run: | | |
if [[ ! -z $INSTALL_MINICONDA ]]; then source .github/workflows/install_miniconda.sh; fi | |
- name: Install conda | |
uses: conda-incubator/setup-miniconda@v3 | |
with: | |
auto-update-conda: true | |
python-version: "${{ matrix.python-version }}" | |
channels: "conda-forge,anaconda" | |
activate-environment: testenv | |
- name: Install mamba | |
run: | | |
# hdf5 version 1.14 not currently supported yet so we restrict hdf5 to 1.13 at most | |
echo "hdf5<=1.13" > $CONDA_PREFIX/conda-meta/pinned | |
conda install -y -c ${{matrix.channel}} mamba | |
- name: Install HDF5 (${{matrix.version}}${{matrix.mpi && '-' || ''}}${{matrix.mpi}}) | |
run: | | |
[ "${{matrix.mpi}}" != "" ] && MPICC_PKG=${{matrix.mpi}}-mpicc | |
mamba install -y -c ${{matrix.channel}} 'hdf5=${{matrix.version}}=*${{matrix.mpi}}*' $MPICC_PKG | |
- name: Build Rust version | |
run: | | |
export HDF5_DIR="$CONDA_PREFIX" | |
export PYO3_PYTHON=python3 | |
[ "${{runner.os}}" != "Windows" ] && export RUSTFLAGS="-C link-args=-Wl,-rpath,$CONDA_PREFIX/lib" | |
cargo check | |
- name: "Install dependencies" | |
run: | | |
pwd | |
export HDF5_DIR="$CONDA_PREFIX" | |
export PYO3_PYTHON=python3 | |
which python | |
python -VV | |
python -m site | |
python -m pip install --upgrade pip setuptools | |
[ "${{runner.os}}" != "Windows" ] && export RUSTFLAGS="-C link-args=-Wl,-rpath,$CONDA_PREFIX/lib" | |
mamba install --file requirements_test.txt | |
- name: Install up4 on python | |
run: | | |
export HDF5_DIR="$CONDA_PREFIX" | |
export PYO3_PYTHON=python3 | |
python3 -m pip install . | |
python3 -c "import up4" | |
python3 -c "import upppp_rust; print(upppp_rust.__file__)" | |
- name: Run tests | |
run: | | |
export LD_LIBRARY_PATH="$CONDA_PREFIX/lib" | |
python3 -c "import up4; print(up4.__file__)" | |
python3 -m pytest tests/test_all.py | |
- name: Setup Sphinx | |
run: | | |
mamba install -y -c ${{matrix.channel}} --file docs/requirements.txt | |
- name: Generate Rust docs | |
run: | | |
export HDF5_DIR="$CONDA_PREFIX" | |
cargo doc --no-deps --target-dir docs/source/_static/ | |
- name: Build HTML | |
run: | | |
pwd | |
export HDF5_DIR="$CONDA_PREFIX" | |
export PYO3_PYTHON=python3 | |
export LD_LIBRARY_PATH="$CONDA_PREFIX/lib" | |
cd docs | |
python3 -c "import up4; print(up4.__file__)" | |
make html | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v2 | |
with: | |
name: html-doc | |
path: docs/build/html | |
- name: Deploy to GitHub Pages | |
uses: JamesIves/[email protected] | |
with: | |
branch: gh-pages | |
folder: docs/build/html | |