Skip to content

Commit 2edc538

Browse files
authored
Enable Intel in GitLab CI (#4789)
This also adds timeout to avoid infinite loop. Post a comment immediately after being triggered.
1 parent 93a1a7e commit 2edc538

File tree

2 files changed

+73
-26
lines changed

2 files changed

+73
-26
lines changed

.github/workflows/trigger-hpsf-gitlab-ci.yml

Lines changed: 48 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,14 @@ jobs:
2020
- name: Determine PR merge ref
2121
id: setref
2222
shell: bash
23+
env:
24+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2325
run: |
2426
PR_NUMBER=${{ github.event.issue.number }}
2527
MERGE_REF="refs/pull/$PR_NUMBER/merge"
28+
PR_TITLE=$(gh api repos/${{ github.repository }}/pulls/$PR_NUMBER --jq '.title')
2629
echo "merge_ref=$MERGE_REF" >> $GITHUB_OUTPUT
30+
echo "pr_title=$PR_TITLE" >> $GITHUB_OUTPUT
2731
echo "Using merge ref: $MERGE_REF"
2832
2933
- name: Trigger GitLab pipeline
@@ -39,6 +43,7 @@ jobs:
3943
-F "variables[GITHUB_PR_NUMBER]=${{ github.event.issue.number }}" \
4044
-F "variables[GITHUB_MERGE_REF]=refs/pull/${{ github.event.issue.number }}/merge" \
4145
-F "variables[GITHUB_TRIGGER_ACTOR]=${{ github.actor }}" \
46+
-F "variables[GITHUB_PR_TITLE]=${{ steps.setref.outputs.pr_title }}" \
4247
"https://gitlab.spack.io/api/v4/projects/${{ env.GITLAB_PROJECT_ID }}/trigger/pipeline")
4348
4449
echo "GitLab response: $RESPONSE"
@@ -50,9 +55,32 @@ jobs:
5055
exit 1
5156
fi
5257
53-
echo "Pipeline URL: https://gitlab.spack.io/${{ env.GITLAB_PROJECT_PATH }}/-/pipelines/$PIPELINE_ID"
58+
PIPELINE_URL="https://gitlab.spack.io/${{ env.GITLAB_PROJECT_PATH }}/-/pipelines/$PIPELINE_ID"
59+
echo "Pipeline URL: $PIPELINE_URL"
60+
echo "pipeline_url=$PIPELINE_URL" >> $GITHUB_OUTPUT
5461
echo "pipeline_id=$PIPELINE_ID" >> $GITHUB_OUTPUT
5562
63+
# Update pipeline name
64+
PIPELINE_NAME="GitHub #${{ github.event.issue.number }}: ${{ steps.setref.outputs.pr_title }}"
65+
curl --request PUT \
66+
--header "PRIVATE-TOKEN: ${{ secrets.HPSF_GITLAB_API_TOKEN }}" \
67+
--data-urlencode "name=${PIPELINE_NAME}" \
68+
"https://gitlab.spack.io/api/v4/projects/${{ env.GITLAB_PROJECT_ID }}/pipelines/${PIPELINE_ID}/metadata"
69+
|| echo "Warning: Failed to update pipline name (possibly expired token)"
70+
echo "Updated pipeline name to: $PIPELINE_NAME"
71+
72+
- name: Post status to GitHub PR
73+
shell: bash
74+
run: |
75+
PIPELINE_URL=${{ steps.trigger.outputs.pipeline_url }}
76+
COMMENT="GitLab CI has started at ${PIPELINE_URL}."
77+
78+
gh api \
79+
repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/comments \
80+
-f body="$COMMENT" || echo "Failed to post comment to GitHub"
81+
env:
82+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
83+
5684
- name: Wait for GitLab pipeline to finish
5785
id: wait
5886
shell: bash
@@ -62,11 +90,29 @@ jobs:
6290
echo "Waiting on GitLab pipeline $PIPELINE_ID..."
6391
6492
STATUS="running"
93+
MAX_WAIT=14400 # 4 hours
94+
ELAPSED=0
95+
6596
while [[ "$STATUS" == "running" || "$STATUS" == "pending" ]]; do
97+
if [ $ELAPSED -ge $MAX_WAIT ]; then
98+
echo "Timeout waiting for pipeline after $MAX_WAIT seconds"
99+
echo "final_status=timeout" >> $GITHUB_OUTPUT
100+
exit 1
101+
fi
102+
66103
sleep 300
104+
ELAPSED=$((ELAPSED + 300))
105+
67106
STATUS=$(curl -s \
68107
"https://gitlab.spack.io/api/v4/projects/${{ env.GITLAB_PROJECT_ID }}/pipelines/$PIPELINE_ID" \
69108
| jq -r '.status')
109+
110+
if [ "$STATUS" == "null" ] || [ -z "$STATUS" ]; then
111+
echo "Failed to get pipeline status. Response: $RESPONSE"
112+
echo "final_status=error" >> $GITHUB_OUTPUT
113+
exit 1
114+
fi
115+
70116
echo "Status: $STATUS"
71117
done
72118
@@ -76,8 +122,7 @@ jobs:
76122
shell: bash
77123
run: |
78124
STATUS=${{ steps.wait.outputs.final_status }}
79-
PIPELINE_ID=${{ steps.trigger.outputs.pipeline_id }}
80-
PIPELINE_URL="https://gitlab.spack.io/${{ env.GITLAB_PROJECT_PATH }}/-/pipelines/$PIPELINE_ID"
125+
PIPELINE_URL=${{ steps.trigger.outputs.pipeline_url }}
81126
COMMENT="GitLab CI finished with status: **$STATUS**. See details at ${PIPELINE_URL}."
82127
83128
gh api \

.gitlab/hpsf-gitlab-ci.yml

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
echo "GITHUB_PR_NUMBER=$GITHUB_PR_NUMBER"
88
echo "GITHUB_MERGE_REF=$GITHUB_MERGE_REF"
99
echo "GITHUB_TRIGGER_ACTOR=$GITHUB_TRIGGER_ACTOR"
10+
echo "GITHUB_PR_TITLE=$GITHUB_PR_TITLE"
1011
git remote add github https://github.com/amrex-codes/amrex.git
1112
git fetch --depth=1 github "${GITHUB_MERGE_REF}"
1213
git checkout FETCH_HEAD -b pr-${GITHUB_PR_NUMBER}
@@ -70,27 +71,28 @@ AMD-MI300A:
7071
- export AMREX_THE_ARENA_INIT_SIZE=1e9
7172
- ctest -j 2 --test-dir build --output-on-failure
7273

73-
#Intel-PVC:
74-
# extends: .dependency-n-fetch-pr
75-
# tags: [intel-data-center-max-1100]
76-
# image: intel/oneapi-basekit:2025.3.0-0-devel-ubuntu24.04
77-
# script:
78-
# - sycl-ls
79-
# - export ONEAPI_DEVICE_SELECTOR=level_zero:gpu
80-
# - |
81-
# cmake -S . -B build \
82-
# -DCMAKE_VERBOSE_MAKEFILE=ON \
83-
# -DAMReX_MPI=OFF \
84-
# -DAMReX_SPACEDIM="1;2;3" \
85-
# -DAMReX_FFT=ON \
86-
# -DAMReX_EB=ON \
87-
# -DAMReX_ENABLE_TESTS=ON \
88-
# -DAMReX_FORTRAN=OFF \
89-
# -DAMReX_GPU_BACKEND=SYCL \
90-
# -DCMAKE_C_COMPILER=$(which icx) \
91-
# -DCMAKE_CXX_COMPILER=$(which icpx) \
92-
# -DAMReX_PARALLEL_LINK_JOBS=8
93-
# - cmake --build build -j 16
94-
# - export AMREX_THE_ARENA_INIT_SIZE=1e9
95-
# - ctest -j 4 --test-dir build --output-on-failure
74+
Intel-PVC:
75+
extends: .dependency-n-fetch-pr
76+
tags: [intel-data-center-max-1100]
77+
image: intel/oneapi-basekit:2025.3.0-0-devel-ubuntu24.04
78+
script:
79+
- sycl-ls
80+
- export ONEAPI_DEVICE_SELECTOR=level_zero:gpu
81+
- |
82+
cmake -S . -B build \
83+
-DCMAKE_VERBOSE_MAKEFILE=ON \
84+
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
85+
-DAMReX_MPI=OFF \
86+
-DAMReX_SPACEDIM="1;2;3" \
87+
-DAMReX_FFT=ON \
88+
-DAMReX_EB=ON \
89+
-DAMReX_ENABLE_TESTS=ON \
90+
-DAMReX_FORTRAN=OFF \
91+
-DAMReX_GPU_BACKEND=SYCL \
92+
-DCMAKE_C_COMPILER=$(which icx) \
93+
-DCMAKE_CXX_COMPILER=$(which icpx) \
94+
-DAMReX_PARALLEL_LINK_JOBS=8
95+
- cmake --build build -j 16
96+
- export AMREX_THE_ARENA_INIT_SIZE=1e9
97+
- ctest -j 4 --test-dir build --output-on-failure
9698

0 commit comments

Comments
 (0)