Skip to content

Commit 400d01d

Browse files
authored
Add GitHub Actions workflow for integration and unit tests
1 parent 067e2c2 commit 400d01d

1 file changed

Lines changed: 185 additions & 0 deletions

File tree

Lines changed: 185 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
name: Integration Test and Unit Test
2+
3+
on:
4+
pull_request:
5+
6+
concurrency:
7+
group: ${{ github.workflow }}-${{ github.ref }}
8+
cancel-in-progress: true
9+
10+
jobs:
11+
test:
12+
name: Test
13+
runs-on: X64
14+
if: github.repository_owner == 'deepmodeling'
15+
container:
16+
image: ghcr.io/deepmodeling/abacus-gnu
17+
volumes:
18+
- /tmp/ccache:/github/home/.ccache
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@v6
22+
with:
23+
fetch-depth: 0
24+
# We will handle submodules manually after fixing ownership
25+
submodules: 'false'
26+
27+
- name: Take ownership of the workspace and update submodules
28+
run: |
29+
sudo chown -R $(whoami) .
30+
git submodule update --init --recursive
31+
- name: Install CI tools
32+
run: |
33+
sudo apt-get update
34+
sudo apt-get install -y ccache ca-certificates python-is-python3 python3-pip
35+
sudo pip install clang-format clang-tidy
36+
- name: Configure
37+
run: |
38+
cmake -B build -DBUILD_TESTING=ON -DENABLE_MLALGO=ON -DENABLE_LIBXC=ON -DENABLE_LIBRI=ON -DENABLE_GOOGLEBENCH=ON -DENABLE_RAPIDJSON=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -DENABLE_FLOAT_FFTW=ON
39+
# Temporarily removed because no one maintains this now.
40+
# And it will break the CI test workflow.
41+
42+
# - uses: pre-commit/action@v3.0.1
43+
# with:
44+
# extra_args:
45+
# --from-ref ${{ github.event.pull_request.base.sha }}
46+
# --to-ref ${{ github.event.pull_request.head.sha }}
47+
# continue-on-error: true
48+
# - uses: pre-commit-ci/lite-action@v1.0.3
49+
50+
- name: Build
51+
run: |
52+
cmake --build build -j8
53+
cmake --install build
54+
- name: Integrated Tests Preparation
55+
env:
56+
GTEST_COLOR: 'yes'
57+
OMP_NUM_THREADS: '2'
58+
run: |
59+
ctest --test-dir build -V --timeout 1700 -R integrated_test
60+
61+
- name: Module_Base Unittests
62+
env:
63+
GTEST_COLOR: 'yes'
64+
OMP_NUM_THREADS: '2'
65+
run: |
66+
ctest --test-dir build -V --timeout 1700 -R MODULE_BASE
67+
68+
- name: Module_IO Unittests
69+
env:
70+
GTEST_COLOR: 'yes'
71+
OMP_NUM_THREADS: '2'
72+
run: |
73+
ctest --test-dir build -V --timeout 1700 -R MODULE_IO
74+
75+
- name: Module_HSolver Unittests
76+
env:
77+
GTEST_COLOR: 'yes'
78+
OMP_NUM_THREADS: '2'
79+
run: |
80+
ctest --test-dir build -V --timeout 1700 -R MODULE_HSOLVER
81+
82+
- name: Module_Cell Unittests
83+
env:
84+
GTEST_COLOR: 'yes'
85+
OMP_NUM_THREADS: '2'
86+
run: |
87+
ctest --test-dir build -V --timeout 1700 -R MODULE_CELL
88+
89+
- name: Module_MD Unittests
90+
env:
91+
GTEST_COLOR: 'yes'
92+
OMP_NUM_THREADS: '2'
93+
run: |
94+
ctest --test-dir build -V --timeout 1700 -R MODULE_MD
95+
96+
- name: source_psi Unittests
97+
env:
98+
GTEST_COLOR: 'yes'
99+
OMP_NUM_THREADS: '2'
100+
run: |
101+
ctest --test-dir build -V --timeout 1700 -R source_psi
102+
103+
- name: Module_RI Unittests
104+
env:
105+
GTEST_COLOR: 'yes'
106+
OMP_NUM_THREADS: '2'
107+
run: |
108+
ctest --test-dir build -V --timeout 1700 -R MODULE_RI
109+
110+
- name: 01_PW Test
111+
env:
112+
GTEST_COLOR: 'yes'
113+
OMP_NUM_THREADS: '2'
114+
run: |
115+
ctest --test-dir build -V --timeout 1700 -R 01_PW
116+
117+
- name: 02_NAO_Gamma Test
118+
env:
119+
GTEST_COLOR: 'yes'
120+
OMP_NUM_THREADS: '2'
121+
run: |
122+
ctest --test-dir build -V --timeout 1700 -R 02_NAO_Gamma
123+
124+
- name: 03_NAO_multik Test
125+
env:
126+
GTEST_COLOR: 'yes'
127+
OMP_NUM_THREADS: '2'
128+
run: |
129+
ctest --test-dir build -V --timeout 1700 -R 03_NAO_multik
130+
131+
- name: 04_FF Test
132+
env:
133+
GTEST_COLOR: 'yes'
134+
OMP_NUM_THREADS: '2'
135+
run: |
136+
ctest --test-dir build -V --timeout 1700 -R 04_FF
137+
138+
- name: 05_rtTDDFT Test
139+
env:
140+
GTEST_COLOR: 'yes'
141+
OMP_NUM_THREADS: '2'
142+
run: |
143+
ctest --test-dir build -V --timeout 1700 -R 05_rtTDDFT
144+
145+
- name: 06_SDFT Test
146+
env:
147+
GTEST_COLOR: 'yes'
148+
OMP_NUM_THREADS: '2'
149+
run: |
150+
ctest --test-dir build -V --timeout 1700 -R 06_SDFT
151+
152+
- name: 07_OFDFT Test
153+
env:
154+
GTEST_COLOR: 'yes'
155+
OMP_NUM_THREADS: '2'
156+
run: |
157+
ctest --test-dir build -V --timeout 1700 -R 07_OFDFT
158+
159+
- name: 08_EXX Test
160+
env:
161+
GTEST_COLOR: 'yes'
162+
OMP_NUM_THREADS: '2'
163+
run: |
164+
ctest --test-dir build -V --timeout 1700 -R 08_EXX
165+
166+
- name: 09_DeePKS Test
167+
env:
168+
GTEST_COLOR: 'yes'
169+
OMP_NUM_THREADS: '2'
170+
run: |
171+
ctest --test-dir build -V --timeout 1700 -R 09_DeePKS
172+
173+
- name: 10_others Test
174+
env:
175+
GTEST_COLOR: 'yes'
176+
OMP_NUM_THREADS: '2'
177+
run: |
178+
ctest --test-dir build -V --timeout 1700 -R 10_others
179+
180+
- name: Other Unittests
181+
env:
182+
GTEST_COLOR: 'yes'
183+
OMP_NUM_THREADS: '2'
184+
run: |
185+
ctest --test-dir build -V --timeout 1700 -E 'integrate_test|01_PW|02_NAO_Gamma|03_NAO_multik|04_FF|05_rtTDDFT|06_SDFT|07_OFDFT|08_EXX|09_DeePKS|10_others|11_PW_GPU|12_NAO_Gamma_GPU|13_NAO_multik_GPU|15_rtTDDFT_GPU|16_SDFT_GPU|MODULE_BASE|MODULE_IO|MODULE_HSOLVER|MODULE_CELL|MODULE_MD|source_psi|MODULE_RI'

0 commit comments

Comments
 (0)