-
Notifications
You must be signed in to change notification settings - Fork 62
124 lines (103 loc) · 3.56 KB
/
build-and-test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# 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: false
matrix:
python-version: ["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: Set PYTHONPATH
run: |
echo "PYTHONLIB=$HOME/sandbox/lib/python${{ matrix.python-version }}/site-packages" >> $GITHUB_ENV
mkdir -p $PYTHONLIB
echo "PYTHONPATH=$PYTHONLIB:$PYTHONPATH" >> $GITHUB_ENV
- name: Set PATH
run: |
echo "$HOME/sandbox/bin" >> $GITHUB_PATH
- name: Install core dependencies
run: |
python -c "import setuptools;print(setuptools.__version__)"
pip install six numba numba-scipy --verbose
if [ -f requirements.txt ]; then
pip install -r requirements.txt --prefix=$HOME/sandbox --verbose
fi
python -c "import sys;print(sys.path)"
python -c "import numpy;print(numpy.__file__)"
pip install swig --prefix=$HOME/sandbox
which swig
swig -version
- if: ${{ matrix.cuda == 'true' }}
name: Install CUDA
run: |
echo $cuda
source ./ci_scripts/add_cuda_11_5.sh;
echo "/usr/local/cuda-${CUDA}/bin" >> $GITHUB_PATH
- if: ${{ matrix.parallel == 'true' }}
name: Install MPI
run: |
sudo apt-get install mpich;
sudo apt-get install libmpich-dev;
pip install mpi4py --prefix=$HOME/sandbox
python -c "import mpi4py;print(mpi4py.get_include())";
ls -l $PYTHONLIB
- if: ${{ matrix.parallel != 'true' }}
name: Build serial
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
- if: ${{ matrix.parallel == 'true' }}
name: Build parallel
run: |
python setup.py install --with-gslib --with-parallel --prefix=$SANDBOX
- if: ${{ matrix.parallel != 'true' }}
name: Run serial
run: |
cd test
python run_examples.py -serial -verbose
- if: ${{ matrix.parallel == 'true' }}
name: Run parallel
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-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
echo "artifact=${name}" >> $GITHUB_OUTPUT
- name: Upload Artifact
uses: actions/upload-artifact@v4
if: failure()
with:
name: ${{ steps.generate-name.outputs.artifact }}
path: sandbox.tar.gz
retention-days: 1