Skip to content

Commit 86bad23

Browse files
committed
support self-hosted, comment triggered, build
1 parent 73f4962 commit 86bad23

File tree

2 files changed

+177
-0
lines changed

2 files changed

+177
-0
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: comment_on_pr
2+
3+
# read-write repo token
4+
# access to secrets
5+
on:
6+
workflow_run:
7+
workflows: ["pr_comment_trigger_self_hosted"]
8+
types:
9+
- completed
10+
11+
jobs:
12+
upload:
13+
permissions:
14+
actions: read
15+
issues: write
16+
pull-requests: write
17+
runs-on: ubuntu-latest
18+
if: |
19+
github.event.workflow_run.conclusion == 'success' ||
20+
github.event.workflow_run.conclusion == 'failure'
21+
steps:
22+
- name: 'Download artifact'
23+
uses: actions/download-artifact@v4
24+
with:
25+
name: pr
26+
run-id: ${{ github.event.workflow_run.id }}
27+
github-token: ${{ github.token }}
28+
29+
- name: 'Comment on PR'
30+
uses: actions/[email protected]
31+
with:
32+
github-token: ${{ secrets.GITHUB_TOKEN }}
33+
script: |
34+
var fs = require('fs');
35+
var issue_number = Number(fs.readFileSync('./issueNumber'));
36+
var message = String(fs.readFileSync('./message'));
37+
await github.rest.issues.createComment({
38+
owner: context.repo.owner,
39+
repo: context.repo.repo,
40+
issue_number: issue_number,
41+
body: message
42+
});
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
name: pr_comment_trigger_self_hosted
2+
3+
# Controls when the workflow will run
4+
on:
5+
issue_comment:
6+
types: [created]
7+
8+
# Allows you to run this workflow manually from the Actions tab
9+
workflow_dispatch:
10+
11+
jobs:
12+
build_and_test:
13+
permissions:
14+
contents: read
15+
# The type of runner that the job will run on
16+
runs-on: self-hosted
17+
18+
if: |
19+
github.event.issue.pull_request &&
20+
contains(github.event.comment.body, '/runtests') &&
21+
((github.event.comment.user.login == 'cwsmith') ||
22+
(github.event.comment.user.login == 'jacobmerson'))
23+
steps:
24+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
25+
- uses: actions/checkout@v4
26+
with:
27+
ref: refs/pull/${{ github.event.issue.number }}/head
28+
submodules: recursive
29+
path: 'meshfields_${{ github.event.issue.number }}' #under $GITHUB_WORKSPACE
30+
31+
- name: build
32+
id: build
33+
shell: bash
34+
run: |
35+
set +e #avoid exiting when lua modules return non-zero on 'warning' messages
36+
source /etc/profile #provides module command
37+
module use /opt/scorec/spack/rhel9/v0201_4/lmod/linux-rhel9-x86_64/Core/
38+
module load gcc/12.3.0-iil3lno
39+
module load mpich/4.1.1-xpoyz4t
40+
module load cmake/3.26.3-2duxfcd
41+
module load cuda/12.1.1-zxa4msk
42+
set -e
43+
44+
echo "github.workspace ${{github.workspace}}"
45+
46+
date=`date +%F-%H-%M`
47+
workDir=${{github.workspace}}/meshfieldsCI_${date}
48+
mkdir -p $workDir
49+
echo "MESHFIELDS_WORK_DIR=$(echo $workDir)" >> $GITHUB_ENV
50+
echo "workDir $workDir"
51+
52+
# kokkos
53+
git clone -b develop [email protected]:kokkos/kokkos.git ${workDir}/kokkos
54+
kkbdir=${workDir}/build-kokkos
55+
cmake -S ${workDir}/kokkos -B $kkbdir \
56+
-DCMAKE_BUILD_TYPE=Release \
57+
-DBUILD_SHARED_LIBS=ON \
58+
-DCMAKE_CXX_COMPILER=${workDir}/kokkos/bin/nvcc_wrapper \
59+
-DKokkos_ARCH_AMPERE80=ON \
60+
-DKokkos_ENABLE_SERIAL=ON \
61+
-DKokkos_ENABLE_OPENMP=off \
62+
-DKokkos_ENABLE_CUDA=on \
63+
-DKokkos_ENABLE_CUDA_LAMBDA=on \
64+
-DKokkos_ENABLE_DEBUG=off \
65+
-DCMAKE_INSTALL_PREFIX=$kkbdir/install
66+
cmake --build $kkbdir --target install -j 4
67+
68+
#kokkos kernels
69+
git clone [email protected]:kokkos/kokkos-kernels.git
70+
kernbdir=${workDir}/buildKokkosKernelsCuda
71+
cmake -S kokkos-kernels -B $kernbdir \
72+
-DCMAKE_CXX_COMPILER=g++ \
73+
-DKokkos_ROOT=$kkbdir/install \
74+
-DCMAKE_INSTALL_PREFIX=$kernbdir/install
75+
cmake --build $kernbdir -j 4 --target install
76+
77+
##cabana
78+
git clone [email protected]:ECP-copa/Cabana.git cabana
79+
cabbdir=${workDir}/build-cab
80+
cmake -S cabana -B $cabbdir \
81+
-DCMAKE_BUILD_TYPE="Release" \
82+
-DCMAKE_CXX_COMPILER=${workDir}/kokkos/bin/nvcc_wrapper \
83+
-DKokkos_ROOT=$kkbdir/install \
84+
-DCabana_ENABLE_MPI=OFF \
85+
-DCabana_ENABLE_CAJITA=OFF \
86+
-DCabana_ENABLE_TESTING=OFF \
87+
-DCabana_ENABLE_EXAMPLES=OFF \
88+
-DCabana_ENABLE_Cuda=ON \
89+
-DCMAKE_INSTALL_PREFIX=$cabbdir/install
90+
cmake --build $cabbdir -j 4 --target install
91+
92+
# omegah
93+
git clone [email protected]:SCOREC/omega_h.git omegah
94+
ohbdir=${workDir}/build-omegah
95+
cmake -S omegah -B $ohbdir \
96+
-DCMAKE_INSTALL_PREFIX=$ohbdir/install \
97+
-DCMAKE_BUILD_TYPE=Release \
98+
-DBUILD_TESTING=on \
99+
-DOmega_h_USE_Kokkos=on \
100+
-DOmega_h_CUDA_ARCH="80" \
101+
-DCMAKE_CUDA_ARCHITECTURES="80" \
102+
-DKokkos_PREFIX=$kkbdir/install \
103+
-DBUILD_SHARED_LIBS=on
104+
cmake --build $ohbdir -j 4 --target install
105+
106+
#meshfields
107+
mfbdir=${workDir}/build-meshfields
108+
cmake -S meshFields_${{ github.event.issue.number }} -B $mfbdir \
109+
-DOmega_h_ROOT=$ohbdir/install \
110+
-DKokkos_ROOT=$kkbdir/install \
111+
-DKokkosKernels_ROOT=$kernbdir/install \
112+
-DCabana_ROOT=$cabbdir/install
113+
cmake --build $mfbdir -j4
114+
ctest --test-dir $mfbdir
115+
116+
- name: Save Result Link
117+
if: ${{ !cancelled() }} #prepare report unless the job was cancelled
118+
run: |
119+
mkdir -p ./pr
120+
echo "${{ github.event.issue.number }}" > ./pr/issueNumber
121+
echo -n "Test Result: ${{ steps.build.outcome }} " > ./pr/message
122+
echo "[(details)](https://github.com/${{github.repository}}/actions/runs/${{ github.run_id }})" >> ./pr/message
123+
124+
- name: Upload Result
125+
if: ${{ !cancelled() }} #upload unless the job was cancelled
126+
uses: actions/upload-artifact@v4
127+
with:
128+
name: pr
129+
path: pr/
130+
131+
- name: Cleanup
132+
if: ${{ !cancelled() }}
133+
run: |
134+
echo "MESHFIELDS_WORK_DIR $MESHFIELDS_WORK_DIR"
135+
rm -rf $MESHFIELDS_WORK_DIR

0 commit comments

Comments
 (0)