Workflows #9
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 clean-up/refactor of test_with_MFEM_release.yml | |
name: build-and-test | |
on: | |
workflow_dispatch: | |
pull_request: | |
jobs: | |
build: | |
# if: contains(github.event.pull_request.labels.*.name, 'in-test-with-mfem-release') | |
strategy: | |
fail-fast: true | |
matrix: | |
python-version: ["3.9"] | |
#"3.7", "3.8", "3.9", "3.10"] | |
os: [ubuntu-latest] | |
#, macos-latest] | |
# os: [ubuntu-20.04] | |
cuda: [false] | |
parallel: [true, false] | |
libceed: [false] | |
runs-on: ${{ matrix.os }} | |
env: | |
CUDA: "11.5" | |
SANDBOX: $HOME/sandbox | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Create PYTHONLIB and set PYTHONPATH | |
run: | | |
PYTHONLIB=${HOME}/sandbox/lib/python${{ matrix.python-version }}/site-packages | |
mkdir -p $PYTHONLIB | |
echo "PYTHONPATH=$PYTHONLIB:$PYTHONPATH" >> $GITHUB_ENV | |
- name: Set PATH | |
run: | | |
echo "$HOME/sandbox/bin" >> $GITHUB_PATH | |
- name: Install core dependencies via requirements.txt | |
run: | | |
pip install -r requirements.txt --prefix=$HOME/sandbox --verbose | |
- name: Print versions of installed python packages | |
run: | | |
packages=("setuptools" "numpy" "numba" "scipy" "swig" "cmake" "mpi4py") | |
for package in "${packages[@]}" | |
do | |
echo -n "Checking for $package... " | |
pip freeze | grep "$package" | |
done | |
- name: Install CUDA | |
if: ${{ matrix.cuda == true }} | |
run: | | |
echo $cuda | |
source ./ci_scripts/add_cuda_11_5.sh; | |
echo "/usr/local/cuda-${CUDA}/bin" >> $GITHUB_PATH | |
- name: Install MPI | |
if: ${{ matrix.parallel == true }} | |
run: | | |
sudo apt-get install mpich libmpich-dev | |
pip install mpi4py --prefix=$HOME/sandbox | |
python -c "import mpi4py;print(mpi4py.get_include())"; | |
- name: Build serial | |
if: ${{ matrix.parallel == false }} | |
run: | | |
# test workflow to manually run swig | |
python setup.py clean --swig | |
python setup.py install --ext-only --with-gslib --verbose | |
python setup.py install --swig --with-gslib --verbose | |
python setup.py install --skip-ext --skip-swig --with-gslib --verbose | |
- name: Build parallel | |
if: ${{ matrix.parallel == true }} | |
run: | | |
python setup.py install --with-gslib --with-parallel --prefix=$SANDBOX | |
- name: Run serial | |
if: ${{ matrix.parallel == false }} | |
run: | | |
cd test | |
python run_examples.py -serial -verbose | |
- name: Run parallel | |
if: ${{ matrix.parallel == true }} | |
run: | | |
which mpicc | |
cd test | |
python run_examples.py -parallel -verbose -np 2 | |
- name: Generate Artifact | |
if: always() | |
run: | | |
tar -cvzf sandbox.tar.gz test/sandbox | |
- name: Generate artifact name | |
if: always() | |
id: generate-artifact-name | |
run: | | |
txt=$(python -c "import datetime;print(datetime.datetime.now().strftime('%H_%M_%S_%f'))") | |
name="test_result_"${txt}"_"${{ github.run_id }}".tar.gz" | |
echo "name=${name}" >> $GITHUB_OUTPUT | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v4 | |
# if: failure() | |
with: | |
name: ${{ steps.generate-artifact-name.outputs.name }} | |
path: sandbox.tar.gz | |
retention-days: 1 |