Skip to content

Build and Test on diverse OS #91

Build and Test on diverse OS

Build and Test on diverse OS #91

name: Build and Test on diverse OS
on: workflow_dispatch
permissions:
contents: read
jobs:
build:
env:
pyodide-python-version: "3.11"
pyodide-os: "ubuntu-latest"
strategy:
matrix:
# python-version: ["3.11"]
python-version: ["3.9", "3.10", "3.11"]
# os: ["ubuntu-latest"]
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
runs-on: ${{ matrix.os }}
continue-on-error: true
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup conda
uses: s-weigand/setup-conda@v1
with:
update-conda: true
python-version: ${{ matrix.python-version }}
conda-channels: anaconda, conda-forge
- name: Install dependencies for MacOs
if: startsWith(matrix.os, 'macos')
run: |
conda install -c conda-forge -y plantuml suitesparse
brew install llvm libomp
echo "/usr/local/opt/llvm/bin" >> $GITHUB_PATH
echo 'CC=/usr/local/opt/llvm/bin/clang' >> $GITHUB_ENV
echo 'LDFLAGS=-L/usr/local/opt/llvm/lib' >> $GITHUB_ENV
echo 'CFLAGS=-I/usr/local/opt/llvm/include' >> $GITHUB_ENV
- name: Prepare MSVC
if: startsWith(matrix.os, 'windows')
uses: bus1/cabuild/action/msdevshell@v1
with:
architecture: x64
- name: Install dependencies for Windows
if: startsWith(matrix.os, 'windows')
run: |
conda install -c conda-forge -y suitesparse plantuml
echo 'INCLUDE=C:\Miniconda\envs\__setup_conda\Library\include\suitesparse;C:\Miniconda\envs\__setup_conda\Lib\site-packages\sparseqr' >> $env:GITHUB_ENV
echo 'LIB=C:\Miniconda\envs\__setup_conda\Library\include\suitesparse;C:\Miniconda\envs\__setup_conda\Lib\site-packages\sparseqr' >> $env:GITHUB_ENV
- name: Install dependencies for Ubuntu
if: startsWith(matrix.os, 'ubuntu')
run: |
conda install -c conda-forge -y suitesparse clang plantuml openmp
- name: Build Test Docs
continue-on-error: true
run: |
pip install --upgrade pip wheel
pip install .[cli,docs,test,build]
python setup.py build_ext --inplace
python -m build
python -c 'import choreo'
pytest
python ./scripts/run_all_examples.py
cd docs
make html
cd ..
- name: Read Emscripten version number
id: emscripten-version
if: matrix.os == env.pyodide-os && matrix.python-version == env.pyodide-python-version
run: |
pip install .[full]
echo EMSCRIPTEN_VERSION=$(pyodide config get emscripten_version) >> $GITHUB_ENV
- name: Setup Emscripten
if: matrix.os == env.pyodide-os && matrix.python-version == env.pyodide-python-version
uses: mymindstorm/setup-emsdk@v11
with:
version: ${{ env.EMSCRIPTEN_VERSION }}
- name: Build for Pyodide
if: matrix.os == env.pyodide-os && matrix.python-version == env.pyodide-python-version
run: |
pyodide build
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.os }}-${{ matrix.python-version }}
path: './dist/'
gather-dists:
runs-on: ubuntu-latest
needs: build
env:
python-version-source: "ubuntu-latest-3.11"
if: success() || failure()
steps:
- name: Download reports' artifacts
uses: actions/download-artifact@v3
with:
path: ./artifacts-dl
- name: Copy artifacts
run: |
mkdir choreo-dist
mkdir choreo-dist/dist
find ./artifacts-dl/${{ env.python-version-source }}/ -name '*.tar.gz' -exec cp {} ./choreo-dist/dist \;
find ./artifacts-dl -name '*.whl' -exec cp {} ./choreo-dist/dist \;
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: choreo-dist
path: './choreo-dist/'