-
Notifications
You must be signed in to change notification settings - Fork 8
131 lines (115 loc) · 4.89 KB
/
Copy pathtrigger-lrz-gitlab-ci.yaml
File metadata and controls
131 lines (115 loc) · 4.89 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
name: LRZ GitLab CI
on:
push:
branches: [develop, main]
pull_request_target:
types: [opened, synchronize, reopened, unlabeled, labeled]
schedule:
- cron: '00 8 * * 0' # Runs at 10 AM CEST (08:00 UTC) every Sunday
workflow_dispatch: # Allows manual trigger
concurrency:
group: >
${{ github.workflow }}-
${{ github.event_name }}-
${{ github.event.pull_request.number || github.ref_name }}
cancel-in-progress: true
jobs:
build-and-test-pyGinkgo:
name: Build and test pyGinkgo
runs-on: ubuntu-latest
timeout-minutes: 1440 # 24 hours
outputs:
branch: ${{ steps.branch.outputs.branch }}
skip-nvidia: ${{ steps.skip-labels.outputs.skip-nvidia }}
skip-amd: ${{ steps.skip-labels.outputs.skip-amd }}
skip-intel: ${{ steps.skip-labels.outputs.skip-intel }}
if: >
github.event_name != 'pull_request_target' ||
!contains(github.event.pull_request_target.labels.*.name, 'skip-build')
env:
LRZ_GROUP: greole
LRZ_HOST: gitlab-ce.lrz.de
REPO_NAME: ${{ github.event.repository.name }}
PYGINKGO_REPO: pyGinkgo
PYGINKGO_PROJECT_TOKEN: ${{ secrets.LRZ_GITLAB_PROJECT_TOKEN }}
PYGINKGO_TRIGGER_TOKEN: ${{ secrets.LRZ_GITLAB_TRIGGER_TOKEN }}
MAX_WAIT_MINUTES: 1440
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Determine branch
id: branch
run: |
if [[ "$GITHUB_EVENT_NAME" == "pull_request_target"* ]]; then
BRANCH="$GITHUB_HEAD_REF"
else
BRANCH=${GITHUB_REF_NAME#refs/heads/}
fi
echo "Determined pyGinkgo branch: $BRANCH"
echo "branch=$BRANCH" >> $GITHUB_OUTPUT
- name: Determine skip labels
id: skip-labels
run: |
# default values
echo "skip-nvidia=false" >> $GITHUB_OUTPUT
echo "skip-amd=false" >> $GITHUB_OUTPUT
echo "skip-intel=false" >> $GITHUB_OUTPUT
# Only check labels if this is a PR
if [[ "$GITHUB_EVENT_NAME" == "pull_request_target" ]]; then
labels=$(jq -r '.pull_request.labels[].name // empty' "$GITHUB_EVENT_PATH")
for label in $labels; do
case "$label" in
skip-nvidia) echo "skip-nvidia=true" >> $GITHUB_OUTPUT ;;
skip-amd) echo "skip-amd=true" >> $GITHUB_OUTPUT ;;
skip-intel) echo "skip-intel=true" >> $GITHUB_OUTPUT ;;
esac
done
fi
- name: Debug skip outputs
run: |
echo "skip-nvidia=${{ steps.skip-labels.outputs.skip-nvidia }}"
echo "skip-amd=${{ steps.skip-labels.outputs.skip-amd }}"
echo "skip-intel=${{ steps.skip-labels.outputs.skip-intel }}"
- name: Push commit to pyGinkgo LRZ GitLab
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git remote add lrz https://oauth2:${PYGINKGO_PROJECT_TOKEN}@${{ env.LRZ_HOST }}/${{ env.LRZ_GROUP }}/${{ env.REPO_NAME }}.git
# git remote add incoming ${{ github.event.pull_request.head.repo.clone_url }}
# git fetch incoming ${{ steps.branch.outputs.branch }}
git checkout -B ${{ steps.branch.outputs.branch }} origin/${{ steps.branch.outputs.branch }}
git reset --hard origin/${{ steps.branch.outputs.branch }}
git push --force lrz HEAD:refs/heads/${{ steps.branch.outputs.branch }}
- name: Cancel running/pending pyGinkgo LRZ CI pipelines
if: ${{ github.event_name != 'push' }}
run: |
./ci/github/cancel_triggered_pipelines.sh \
"${{ env.REPO_NAME }}" \
"${{ steps.branch.outputs.branch }}" \
"${PYGINKGO_PROJECT_TOKEN}"
- name: Trigger pyGinkgo LRZ GitLab CI pipeline
id: trigger-pyGinkgo
run: |
./ci/github/trigger_pipeline.sh \
"${{ env.REPO_NAME }}" \
"${{ steps.branch.outputs.branch }}" \
"${PYGINKGO_PROJECT_TOKEN}" \
"${PYGINKGO_TRIGGER_TOKEN}" \
"variables[BENCHMARK]=false" \
"variables[SKIP_NVIDIA]=${{ steps.skip-labels.outputs.skip-nvidia }}" \
"variables[SKIP_AMD]=${{ steps.skip-labels.outputs.skip-amd }}" \
"variables[SKIP_INTEL]=${{ steps.skip-labels.outputs.skip-intel }}"
- name: Wait for pyGinkgo LRZ GitLab CI pipeline
run: |
./ci/github/wait_pipeline.sh \
"${{ env.REPO_NAME }}" \
"${{ steps.trigger-pyGinkgo.outputs.pipeline_id }}" \
"${PYGINKGO_PROJECT_TOKEN}"
- name: Cancel running/pending NeoFOAM LRZ CI pipelines
run: |
./ci/github/cancel_triggered_pipelines.sh \
"${{ env.PYGINKGO_REPO }}" \
"${{ steps.branch.outputs.branch }}" \
"${PYGINKGO_PROJECT_TOKEN}"