Skip to content

Commit 2f227ec

Browse files
committed
clean up
1 parent 3a74f9d commit 2f227ec

File tree

2 files changed

+35
-45
lines changed

2 files changed

+35
-45
lines changed

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

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ on:
44
issue_comment:
55
types: [created]
66

7+
env:
8+
GITLAB_PROJECT_PATH: "amrex/amrex"
9+
GITLAB_PROJECT_ID: "70"
10+
711
jobs:
812
run-hpsf-gitlab-ci:
913
if: |
@@ -15,6 +19,7 @@ jobs:
1519
steps:
1620
- name: Determine PR merge ref
1721
id: setref
22+
shell: bash
1823
run: |
1924
PR_NUMBER=${{ github.event.issue.number }}
2025
MERGE_REF="refs/pull/$PR_NUMBER/merge"
@@ -23,15 +28,18 @@ jobs:
2328
2429
- name: Trigger GitLab pipeline
2530
id: trigger
31+
shell: bash
2632
run: |
2733
MERGE_REF="${{ steps.setref.outputs.merge_ref }}"
2834
echo "Triggering GitLab pipeline for ref: $MERGE_REF"
2935
3036
RESPONSE=$(curl -s -X POST \
3137
-F token=${{ secrets.HPSF_GITLAB_TRIGGER_TOKEN }} \
3238
-F ref=development \
33-
-F "variables[GITHUB_PR_NUMBER]=$PR_NUMBER" \
34-
"https://gitlab.spack.io/api/v4/projects/${{ secrets.HPSF_GITLAB_PROJECT_ID }}/trigger/pipeline")
39+
-F "variables[GITHUB_PR_NUMBER]=${{ github.event.issue.number }}" \
40+
-F "variables[GITHUB_MERGE_REF]=refs/pull/${{ github.event.issue.number }}/merge" \
41+
-F "variables[GITHUB_TRIGGER_ACTOR]=${{ github.actor }}" \
42+
"https://gitlab.spack.io/api/v4/projects/${{ env.GITLAB_PROJECT_ID }}/trigger/pipeline")
3543
3644
echo "GitLab response: $RESPONSE"
3745
@@ -42,12 +50,13 @@ jobs:
4250
exit 1
4351
fi
4452
53+
echo "Pipeline URL: https://gitlab.spack.io/${{ env.GITLAB_PROJECT_PATH }}/-/pipelines/$PIPELINE_ID"
4554
echo "pipeline_id=$PIPELINE_ID" >> $GITHUB_OUTPUT
4655
4756
- name: Wait for GitLab pipeline to finish
4857
id: wait
58+
shell: bash
4959
run: |
50-
PROJECT_ID=${{ secrets.HPSF_GITLAB_PROJECT_ID }}
5160
PIPELINE_ID=${{ steps.trigger.outputs.pipeline_id }}
5261
5362
echo "Waiting on GitLab pipeline $PIPELINE_ID..."
@@ -56,20 +65,23 @@ jobs:
5665
while [[ "$STATUS" == "running" || "$STATUS" == "pending" ]]; do
5766
sleep 300
5867
STATUS=$(curl -s \
59-
"https://gitlab.spack.io/api/v4/projects/$PROJECT_ID/pipelines/$PIPELINE_ID" \
68+
"https://gitlab.spack.io/api/v4/projects/${{ env.GITLAB_PROJECT_ID }}/pipelines/$PIPELINE_ID" \
6069
| jq -r '.status')
6170
echo "Status: $STATUS"
6271
done
6372
6473
echo "final_status=$STATUS" >> $GITHUB_OUTPUT
6574
6675
- name: Post result back to GitHub PR
76+
shell: bash
6777
run: |
6878
STATUS=${{ steps.wait.outputs.final_status }}
69-
COMMENT="GitLab CI finished with status: **$STATUS**"
79+
PIPELINE_ID=${{ steps.trigger.outputs.pipeline_id }}
80+
PIPELINE_URL="https://gitlab.spack.io/${{ env.GITLAB_PROJECT_PATH }}/-/pipelines/$PIPELINE_ID"
81+
COMMENT="GitLab CI finished with status: **$STATUS**. See details at ${PIPELINE_URL}."
7082
7183
gh api \
7284
repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/comments \
73-
-f body="$COMMENT"
85+
-f body="$COMMENT" || echo "Failed to post comment to GitHub"
7486
env:
7587
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitlab/hpsf-gitlab-ci.yml

Lines changed: 17 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,22 @@
1-
stages:
2-
- prepare
3-
- test
4-
5-
fetch-github-pr:
6-
stage: prepare
7-
tags: [hpsf]
8-
image: ubuntu:24.04
9-
variables:
10-
GIT_STRATEGY: fetch
11-
rules:
12-
- if: '$GITHUB_PR_NUMBER' # GITHUB_PR_NUMBER is provided by a GitHub Action
13-
when: always
14-
- when: never # For non-github-pr job, the script part will be skipped.
15-
script:
16-
- apt-get update && apt-get install -y git
17-
- echo "GITHUB_PR_NUMBER=$GITHUB_PR_NUMBER"
18-
- MERGE_REF="refs/pull/${GITHUB_PR_NUMBER}/merge"
19-
- echo "Fetching GitHub PR merge ref $MERGE_REF"
20-
- git fetch origin +${MERGE_REF}:refs/remotes/origin/pr-${GITHUB_PR_NUMBER}
21-
- git checkout pr-${GITHUB_PR_NUMBER}
1+
.dependency-n-fetch-pr:
2+
stage: test
3+
before_script:
4+
- apt-get update && apt-get install -y git cmake python3 libopenmpi-dev openmpi-bin
5+
- |
6+
if [ -n "$GITHUB_PR_NUMBER" ]; then
7+
echo "GITHUB_PR_NUMBER=$GITHUB_PR_NUMBER"
8+
echo "GITHUB_MERGE_REF=$GITHUB_MERGE_REF"
9+
echo "GITHUB_TRIGGER_ACTOR=$GITHUB_TRIGGER_ACTOR"
10+
git remote add github https://github.com/amrex-codes/amrex.git
11+
git fetch --depth=1 github "${GITHUB_MERGE_REF}"
12+
git checkout FETCH_HEAD -b pr-${GITHUB_PR_NUMBER}
13+
fi
2214
2315
Nvidia-H100-single-precision:
24-
stage: test
16+
extends: .dependency-n-fetch-pr
2517
tags: [nvidia-h100]
2618
image: nvcr.io/nvidia/cuda:12.8.0-devel-ubuntu24.04
27-
rules:
28-
- when: always
29-
dependencies:
30-
- fetch-github-pr
3119
script:
32-
- apt-get update && apt-get install -y cmake git python3 libopenmpi-dev openmpi-bin
3320
- |
3421
cmake -S . -B build \
3522
-DCMAKE_VERBOSE_MAKEFILE=ON \
@@ -54,15 +41,10 @@ Nvidia-H100-single-precision:
5441
- ctest -j 2 --test-dir build --output-on-failure
5542

5643
AMD-MI300A:
57-
stage: test
44+
extends: .dependency-n-fetch-pr
5845
tags: [amd-mi300]
5946
image: rocm/dev-ubuntu-24.04:6.4.3-complete
60-
rules:
61-
- when: always
62-
dependencies:
63-
- fetch-github-pr
6447
script:
65-
- apt-get update && apt-get install -y cmake git libopenmpi-dev openmpi-bin
6648
- export ROCM_PATH=/opt/rocm-6.4.3
6749
- export PATH=$ROCM_PATH/bin:$ROCM_PATH/llvm/bin:$PATH
6850
- export LD_LIBRARY_PATH=$ROCM_PATH/lib:$ROCM_PATH/lib64:$LD_LIBRARY_PATH
@@ -89,15 +71,10 @@ AMD-MI300A:
8971
- ctest -j 2 --test-dir build --output-on-failure
9072

9173
#Intel-PVC:
92-
# stage: test
74+
# extends: .dependency-n-fetch-pr
9375
# tags: [intel-data-center-max-1100]
9476
# image: intel/oneapi-basekit:2025.3.0-0-devel-ubuntu24.04
95-
# rules:
96-
# - when: always
97-
# dependencies:
98-
# - fetch-github-pr
9977
# script:
100-
# - apt-get update && apt-get install -y git
10178
# - sycl-ls
10279
# - export ONEAPI_DEVICE_SELECTOR=level_zero:gpu
10380
# - |
@@ -116,3 +93,4 @@ AMD-MI300A:
11693
# - cmake --build build -j 16
11794
# - export AMREX_THE_ARENA_INIT_SIZE=1e9
11895
# - ctest -j 4 --test-dir build --output-on-failure
96+

0 commit comments

Comments
 (0)