-
Notifications
You must be signed in to change notification settings - Fork 6
156 lines (142 loc) · 5.21 KB
/
run_tests.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
156
name: Testing the code version
on:
workflow_dispatch:
push:
branches: [main, master]
pull_request:
branches: [main, master]
jobs:
Run_tests:
runs-on: ubuntu-20.04
defaults:
run:
shell: bash --noprofile --norc {0}
steps:
- uses: actions/setup-python@v4
with:
python-version: '3.9'
- uses: actions/checkout@v3
- name: Install Python packages
run: |
pip install -r install/requirements.txt
- name: Cache install ifort
id: cache-install
uses: actions/cache@v3
with:
path: |
/opt/intel/oneapi
key: install-apt
- name: Non-cache install ifort
if: steps.cache-install.outputs.cache-hit != 'true'
timeout-minutes: 6
run: |
wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
rm GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
sudo echo "deb https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list
sudo apt-get update
sudo apt-get install -y intel-oneapi-common-vars
sudo apt-get install -y intel-oneapi-mkl-2023.1.0
sudo apt-get install -y intel-oneapi-compiler-fortran-2023.1.0
- name: Compile (ifort)
timeout-minutes: 2
run: |
source /opt/intel/oneapi/setvars.sh
printenv >> $GITHUB_ENV
sed 's/-DVERS=$(GIT_VERSION)/-Warn\ all\ -check\ all\ -fp-stack-check\ -extend-source\ -init=snan,arrays\ -DVERS=$(GIT_VERSION)/g' -i Makefile.example_linux
sed 's/-O3/-O0/g' -i Makefile.example_linux
make -f Makefile.example_linux -j2
- name: "Test the code (ifort)"
timeout-minutes: 5
run: |
echo "Running the tests using the Intel oneapi fortran compiler"
if [ ! -f bin/winnet ]; then
echo "Could not compile the run!"
echo "Check the code before pushing to master branch!"
echo "Exiting!"
exit 1
fi
# Get the ouput of the tests
echo "Running tests..."
output_tests=$(make -f Makefile.example_linux tests)
last_line=$(echo "$output_tests" | grep 'tests have')
# Check that all tests have passed
if [[ ${last_line} = *"successfully"* ]]; then
:
else
echo "Test failed - push denied. Run tests and confirm they pass before pushing"
echo "The failing tests are:"
fail_tests=$(echo "$output_tests" | grep '[FAIL]')
echo "$fail_tests"
echo "Exiting!"
exit 1
fi
echo "All tests passed!"
- name: Test verbose level 5 (ifort)
timeout-minutes: 5
run: |
sed 's/-DVERS=$(GIT_VERSION)/-DVERS=$(GIT_VERSION)\ -DVERBOSE_LEVEL=5/g' -i Makefile.example_linux
make -f Makefile.example_linux clean
make -f Makefile.example_linux -j2
echo "Running the tests using the Intel oneapi fortran compiler"
echo "Using high verbose level"
if [ ! -f bin/winnet ]; then
echo "Could not compile the run!"
echo "Check the code before pushing to master branch!"
echo "Exiting!"
exit 1
fi
# Get the ouput of the tests
echo "Running tests..."
output_tests=$(make -f Makefile.example_linux tests)
last_line=$(echo "$output_tests" | grep 'tests have')
# Check that all tests have passed
if [[ ${last_line} = *"successfully"* ]]; then
:
else
echo "Test failed - push denied. Run tests and confirm they pass before pushing"
echo "The failing tests are:"
fail_tests=$(echo "$output_tests" | grep '[FAIL]')
echo "$fail_tests"
echo "Exiting!"
exit 1
fi
echo "All tests passed!"
- name: Install hdf5 library
timeout-minutes: 2
run: |
sudo apt-get install -y libhdf5-serial-dev
- name: Compile (gfortran)
timeout-minutes: 2
run: |
make -f Makefile.example_linux clean
sed 's/-fopenmp/-fopenmp\ -g\ -Wall\ -fcheck=all/g' -i Makefile.example_linux
sed 's/-O3/-O0/g' -i Makefile.example_linux
sed 's/FC\ =\ ifort/FC\ =\ h5fc/g' -i Makefile.example_linux
make -f Makefile.example_linux -j2
- name: "Test the code (gfortran)"
timeout-minutes: 5
run: |
echo "Running the tests using the gfortran compiler"
if [ ! -f bin/winnet ]; then
echo "Could not compile the run!"
echo "Check the code before pushing to master branch!"
echo "Exiting!"
exit 1
fi
# Get the ouput of the tests
echo "Running tests..."
output_tests=$(make -f Makefile.example_linux tests)
last_line=$(echo "$output_tests" | grep 'tests have')
# Check that all tests have passed
if [[ ${last_line} = *"successfully"* ]]; then
:
else
echo "Test failed - push denied. Run tests and confirm they pass before pushing"
echo "The failing tests are:"
fail_tests=$(echo "$output_tests" | grep '[FAIL]')
echo "$fail_tests"
echo "Exiting!"
exit 1
fi
echo "All tests passed!"