-
Notifications
You must be signed in to change notification settings - Fork 62
155 lines (131 loc) · 4.77 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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# This is a clean-up/refactor of test_with_MFEM_release.yml
name: Build and Test
on:
workflow_dispatch:
pull_request:
jobs:
build-and-test:
# if: contains(github.event.pull_request.labels.*.name, 'in-test-with-mfem-release')
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest]
#, macos-latest]
python-version: [3.9]
#"3.7", "3.8", "3.9", "3.10"]
# right now, default is a hardcoded sha defined in setup.py:repos_sha
# mfem-branch: [master, default]
# parallel: [false, true]
# cuda: [false, true]
# temporary: only test cuda
mfem-branch: [default]
parallel: [false]
cuda: [true]
libceed: [false]
gslib: [true]
# When phases==true, run each individual build step explicitly: mfem -> swig -> pymfem
phases: [false]
exclude:
# CUDA does not support MacOS
- os: macos-latest
cuda: true
# include:
# # Include a single example where the build is executed in phases
# - os: ubuntu-latest
# python-version: 3.9
# mfem-branch: default
# parallel: false
# cuda: false
# libceed: false
# gslib: true
# phases: true
runs-on: ${{ matrix.os }}
# https://7tonshark.com/posts/github-actions-ternary-operator/
name: >-
${{ matrix.os }},
${{ matrix.python-version }},
${{ matrix.mfem-branch }},
(${{ matrix.parallel && 'parallel' || 'serial' }}${{ matrix.cuda && ' + cuda' || '' }}${{ matrix.libceed && ' + libceed' || '' }}${{ matrix.gslib && ' + gslib' || '' }})
env:
build-flags: >-
${{ matrix.parallel && '--with-parallel' || '' }}
${{ matrix.cuda && '--with-cuda' || '' }}
${{ matrix.libceed && '--with-libceed' || '' }}
${{ matrix.gslib && '--with-gslib' || '' }}
${{ (!(matrix.mfem-branch == 'default') && format('--mfem-branch=''{0}''', matrix.mfem-branch)) || '' }}
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install core dependencies via requirements.txt
run: |
pip install -r requirements.txt --verbose
# The --silent flag will bypass user-input, e.g. implicitly accepting the EULA
- name: Install CUDA
if: ${{ matrix.cuda == true }}
run: |
# apt
# sudo apt-get update
# sudo apt-get install nvidia-cuda-toolkit -y
# script
source ./ci_scripts/add_cuda_11_5.sh;
# run file
# wget -q https://developer.download.nvidia.com/compute/cuda/12.4.1/local_installers/cuda_12.4.1_550.54.15_linux.run
# sudo sh cuda_12.4.1_550.54.15_linux.run --silent --toolkit --driver
# paths
export "/usr/local/cuda-12.4/bin" >> $GITHUB_PATH
# check
which nvcc
nvcc --version
- name: Install MPI
if: ${{ matrix.parallel == true }}
run: |
sudo apt-get install mpich libmpich-dev
pip install mpi4py
- name: Print python package versions
run: |
pip list
- name: Build MFEM (step 1)
if: ${{ matrix.phases == true }}
run: |
python setup.py clean --swig
python setup.py install --ext-only --verbose ${{ env.build-flags }}
- name: Build SWIG wrappers (step 2)
if: ${{ matrix.phases == true }}
run: |
python setup.py install --swig --verbose ${{ env.build-flags }}
- name: Build PyMFEM (step 3)
if: ${{ matrix.phases == true }}
run: |
python setup.py install --skip-ext --skip-swig --verbose ${{ env.build-flags }}
- name: Build all (steps 1-3)
if: ${{ matrix.phases == false }}
run: |
python setup.py install ${{ env.build-flags }}
- name: Run tests (serial)
if: ${{ matrix.parallel == false }}
run: |
cd test
python run_examples.py -serial -verbose
- name: Run tests (parallel)
if: ${{ matrix.parallel == true }}
run: |
cd test
python run_examples.py -parallel -verbose -np 2
- name: Generate test results artifact
id: generate-artifact
run: |
tar -cvzf sandbox.tar.gz test/sandbox
# generate a name for the artifact
txt=$(python -c "import datetime;print(datetime.datetime.now().strftime('%H_%M_%S_%f'))")
echo name="test_results_"${txt}"_"${{ github.run_id }}".tar.gz" >> $GITHUB_OUTPUT
- name: Upload Artifact
uses: actions/upload-artifact@v4
if: failure()
with:
name: ${{ steps.generate-artifact.outputs.name }}
path: sandbox.tar.gz
retention-days: 1