-
Notifications
You must be signed in to change notification settings - Fork 0
81 lines (70 loc) · 2.72 KB
/
Copy pathgpu_ci_trigger.yml
File metadata and controls
81 lines (70 loc) · 2.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# SETUP INSTRUCTIONS:
# ------------------
# This workflow synchronizes the code to GitLab via SSH to trigger GPU-enabled CI.
#
# 1. GENERATE SSH KEY PAIR (on your local machine):
# ssh-keygen -t ed25519 -f ~/.ssh/gitlab_sync_key -N "" -C "github-to-gitlab-sync"
#
# 2. CONFIGURE GITLAB (The Target):
# - Go to GitLab project > Settings > Repository > Deploy keys.
# - Add the content of '~/.ssh/gitlab_sync_key.pub'.
# - IMPORTANT: Check "Allow write access to this repository".
#
# 3. CONFIGURE GITHUB (The Source):
# - Go to GitHub repo > Settings > Secrets and variables > Actions.
# - Add new Repository Secrets:
# - Name: GITLAB_SSH_PRIVATE_KEY
# Value: Paste the entire content of '~/.ssh/gitlab_sync_key'.
# - Name: GITLAB_TOKEN
# Value: Your GitLab Personal Access Token (with 'api' and 'read_repository' scopes).
#
name: Sync to GitLab and Run GPU CI
on:
push:
branches: [main, devel]
pull_request:
branches: [main, devel]
workflow_dispatch:
jobs:
sync-and-test:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install SSH Key
uses: webfactory/ssh-agent@v0.9.0
with:
ssh-private-key: ${{ secrets.GITLAB_SSH_PRIVATE_KEY }}
- name: Push to GitLab via SSH & Provide Link
id: push
run: |
# 1. Setup SSH known hosts
mkdir -p ~/.ssh
ssh-keyscan gitlab.mpcdf.mpg.de >> ~/.ssh/known_hosts
# 2. Determine target branch
if [ "${{ github.event_name }}" == "pull_request" ]; then
TARGET_BRANCH="gpu-test-pr-${{ github.event.number }}"
else
SOURCE_REF="${{ github.ref_name }}"
SAFE_REF="${SOURCE_REF//\//-}"
TARGET_BRANCH="gpu-test-${SAFE_REF}"
fi
echo "TARGET_BRANCH=$TARGET_BRANCH" >> $GITHUB_ENV
# 3. Add GitLab SSH remote
git remote add gitlab git@gitlab.mpcdf.mpg.de:maxlin/cunumpy.git
# 4. Force push (This automatically starts the GitLab Pipeline)
git push -f gitlab HEAD:refs/heads/$TARGET_BRANCH
# 5. Provide the direct link
PIPELINE_URL="https://gitlab.mpcdf.mpg.de/maxlin/cunumpy/-/pipelines?ref=$TARGET_BRANCH"
echo "::notice::GitLab GPU CI Pipeline started automatically via Push!"
echo "::notice::View Pipeline: $PIPELINE_URL"
- name: Wait for GitLab Pipeline
uses: docker://gitlab/glab:latest
env:
GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }}
GITLAB_HOST: gitlab.mpcdf.mpg.de
with:
entrypoint: glab
args: ci status --live --branch ${{ env.TARGET_BRANCH }} --repo maxlin/cunumpy