Skip to content

Commit 0436afd

Browse files
committed
add github workflow yaml for toolchain check
1 parent fa360d4 commit 0436afd

2 files changed

Lines changed: 228 additions & 0 deletions

File tree

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
name: Toolchain Full Build Test
2+
on:
3+
schedule:
4+
- cron: "0 0 * * 0"
5+
workflow_dispatch:
6+
inputs:
7+
variants:
8+
description: "Comma-separated variants: gnu,intel,cuda"
9+
required: false
10+
default: "gnu,intel,cuda"
11+
jobs:
12+
full-build-gnu:
13+
if: contains(inputs.variants || 'gnu,intel,cuda', 'gnu')
14+
runs-on: X64
15+
container:
16+
image: ghcr.io/deepmodeling/abacus-gnu
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v6
20+
- name: Install requirements
21+
run: |
22+
set -euo pipefail
23+
cd toolchain/root_requirements
24+
sudo ./install_requirements_ubuntu.sh
25+
- name: Build toolchain
26+
run: |
27+
set -euo pipefail
28+
cd toolchain
29+
./toolchain_gnu.sh
30+
- name: Build ABACUS
31+
run: |
32+
set -euo pipefail
33+
cd toolchain
34+
./build_abacus_gnu.sh
35+
cd ..
36+
./bin/abacus --version || true
37+
- name: Upload logs
38+
if: always()
39+
uses: actions/upload-artifact@v4
40+
with:
41+
name: toolchain-full-gnu
42+
path: |
43+
toolchain/compile.log
44+
toolchain/compile.err
45+
toolchain/install/setup
46+
toolchain/build/**/make.log
47+
toolchain/build/**/configure.log
48+
toolchain/build/**/cmake.log
49+
if-no-files-found: ignore
50+
51+
full-build-intel:
52+
if: contains(inputs.variants || 'gnu,intel,cuda', 'intel')
53+
runs-on: X64
54+
container:
55+
image: ghcr.io/deepmodeling/abacus-intel
56+
steps:
57+
- name: Checkout
58+
uses: actions/checkout@v6
59+
- name: Install requirements
60+
run: |
61+
set -euo pipefail
62+
cd toolchain/root_requirements
63+
sudo ./install_requirements_ubuntu.sh
64+
- name: Build toolchain
65+
run: |
66+
set -euo pipefail
67+
cd toolchain
68+
./toolchain_intel.sh
69+
- name: Build ABACUS
70+
run: |
71+
set -euo pipefail
72+
cd toolchain
73+
./build_abacus_intel.sh
74+
cd ..
75+
./bin/abacus --version || true
76+
- name: Upload logs
77+
if: always()
78+
uses: actions/upload-artifact@v4
79+
with:
80+
name: toolchain-full-intel
81+
path: |
82+
toolchain/compile.log
83+
toolchain/compile.err
84+
toolchain/install/setup
85+
toolchain/build/**/make.log
86+
toolchain/build/**/configure.log
87+
toolchain/build/**/cmake.log
88+
if-no-files-found: ignore
89+
90+
full-build-cuda:
91+
if: contains(inputs.variants || 'gnu,intel,cuda', 'cuda')
92+
runs-on: nvidia
93+
steps:
94+
- name: Checkout
95+
uses: actions/checkout@v6
96+
- name: Install requirements
97+
run: |
98+
set -euo pipefail
99+
if [ -f /etc/os-release ]; then . /etc/os-release; fi
100+
if [ "${ID:-}" = "ubuntu" ] || [ "${ID_LIKE:-}" = "debian" ]; then
101+
sudo ./toolchain/root_requirements/install_requirements_ubuntu.sh
102+
elif [ "${ID:-}" = "fedora" ] || [ "${ID_LIKE:-}" = "rhel fedora" ]; then
103+
sudo ./toolchain/root_requirements/install_requirements_fedora.sh
104+
else
105+
exit 1
106+
fi
107+
- name: Prepare CUDA and NVHPC
108+
run: |
109+
set -euo pipefail
110+
if command -v nvidia-smi >/dev/null 2>&1; then
111+
nvidia-smi
112+
cap="$(nvidia-smi --query-gpu=compute_cap --format=csv,noheader | head -n 1 | tr -d '.' | xargs || true)"
113+
fi
114+
if [ -z "${cap:-}" ]; then cap="70"; fi
115+
echo "GPU_CAP=${cap}" >> "$GITHUB_ENV"
116+
if command -v module >/dev/null 2>&1; then
117+
module use /opt/nvidia/hpc_sdk/modulefiles || true
118+
module load nvhpc/26.1 || module load nvhpc-hpcx-cuda12/25.3
119+
else
120+
exit 1
121+
fi
122+
if [ -d /usr/local/cuda ]; then
123+
echo "CUDA_PATH=/usr/local/cuda" >> "$GITHUB_ENV"
124+
fi
125+
- name: Build toolchain
126+
run: |
127+
set -euo pipefail
128+
cd toolchain
129+
./toolchain_gnu.sh --enable-cuda --gpu-ver "${GPU_CAP}"
130+
- name: Build ABACUS
131+
run: |
132+
set -euo pipefail
133+
cd toolchain
134+
./build_abacus_gnu.sh
135+
cd ..
136+
./bin/abacus --version || true
137+
- name: Upload logs
138+
if: always()
139+
uses: actions/upload-artifact@v4
140+
with:
141+
name: toolchain-full-cuda
142+
path: |
143+
toolchain/compile.log
144+
toolchain/compile.err
145+
toolchain/install/setup
146+
if-no-files-found: ignore
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: Toolchain Quick Test
2+
on:
3+
pull_request:
4+
paths:
5+
- toolchain/**
6+
- .github/workflows/toolchain_quick.yml
7+
push:
8+
branches:
9+
- develop
10+
paths:
11+
- toolchain/**
12+
- .github/workflows/toolchain_quick.yml
13+
workflow_dispatch:
14+
jobs:
15+
lint-and-sanity:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v6
20+
- name: Install tools
21+
run: |
22+
sudo apt-get update
23+
sudo apt-get install -y dos2unix shellcheck
24+
- name: Shell syntax
25+
run: |
26+
set -euo pipefail
27+
while IFS= read -r -d '' f; do
28+
bash -n "$f"
29+
done < <(find toolchain -type f -name '*.sh' -print0)
30+
- name: Python syntax
31+
run: |
32+
python3 -m compileall toolchain
33+
- name: CRLF check
34+
run: |
35+
set -euo pipefail
36+
if grep -RIl $'\r' toolchain | head -n 1 | grep -q .; then
37+
grep -RIl $'\r' toolchain | head -n 50
38+
exit 1
39+
fi
40+
- name: Shellcheck
41+
run: |
42+
set -euo pipefail
43+
shellcheck --version
44+
find toolchain -type f -name '*.sh' -print0 | xargs -0 -n1 shellcheck -x || true
45+
46+
dry-run-matrix:
47+
runs-on: ubuntu-latest
48+
strategy:
49+
fail-fast: false
50+
matrix:
51+
variant: [gnu, intel, cuda]
52+
steps:
53+
- name: Checkout
54+
uses: actions/checkout@v6
55+
- name: Install tools
56+
run: |
57+
sudo apt-get update
58+
sudo apt-get install -y dos2unix
59+
- name: Dry run
60+
run: |
61+
set -euo pipefail
62+
cd toolchain
63+
rm -rf build install
64+
find . -type f -name '*.sh' -exec chmod +x {} +
65+
if [ "${{ matrix.variant }}" = "gnu" ]; then
66+
./toolchain_gnu.sh --dry-run --skip-system-checks
67+
elif [ "${{ matrix.variant }}" = "intel" ]; then
68+
./toolchain_intel.sh --dry-run --skip-system-checks
69+
elif [ "${{ matrix.variant }}" = "cuda" ]; then
70+
./toolchain_gnu.sh --dry-run --skip-system-checks --enable-cuda --gpu-ver 70
71+
fi
72+
- name: Upload setup
73+
if: always()
74+
uses: actions/upload-artifact@v4
75+
with:
76+
name: toolchain-${{ matrix.variant }}-dryrun
77+
path: |
78+
toolchain/install/setup
79+
toolchain/compile.log
80+
toolchain/compile.err
81+
if-no-files-found: ignore
82+

0 commit comments

Comments
 (0)