-
Notifications
You must be signed in to change notification settings - Fork 68
202 lines (200 loc) · 6.57 KB
/
gitlab-ci.yml
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
name: GitLab CI
on:
push:
branches:
- main
- develop
pull_request:
branches-ignore:
- documentation
workflow_dispatch:
defaults:
run:
shell: bash
jobs:
#
# Deferred GitLab pipelines on Levante at DKRZ (see .gitlab/levante.yml):
#
levante-init:
if: |
github.repository_owner == 'earth-system-radiation' &&
( github.event_name != 'pull_request' ||
( github.event.pull_request.head.repo.owner.login == github.repository_owner &&
github.event.pull_request.user.login != 'dependabot[bot]' ))
runs-on: ubuntu-latest
outputs:
ref-type: ${{ steps.g-push-rev.outputs.ref-type }}
ref-name: ${{ steps.g-push-rev.outputs.ref-name }}
pipeline-id: ${{ steps.gl-trigger-pipeline.outputs.pipeline-id }}
steps:
#
# Check out GitHub repository
#
- name: Check out GitHub repository
uses: actions/checkout@v4
with:
fetch-depth: 0
#
# Push to GitLab repository
#
- name: Push to GitLab repository
id: g-push-rev
uses: "skosukhin/git-ci-hub-lab/g-push-rev@v1"
with:
remote-url: ${{ vars.DKRZ_GITLAB_SERVER }}/${{ vars.DKRZ_GITLAB_PROJECT }}.git
password: ${{ secrets.DKRZ_GITLAB_TOKEN }}
ref-type: tag
ref-message: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
force-push: true
#
# Trigger GitLab CI/CD Pipeline
#
- name: Trigger GitLab CI/CD Pipeline
id: gl-trigger-pipeline
uses: "skosukhin/git-ci-hub-lab/gl-trigger-pipeline@v1"
with:
server-url: ${{ vars.DKRZ_GITLAB_SERVER }}
project-name: ${{ vars.DKRZ_GITLAB_PROJECT }}
token: ${{ secrets.DKRZ_GITLAB_TRIGGER_TOKEN }}
ref-name: ${{ steps.g-push-rev.outputs.ref-name }}
expected-sha: ${{ github.sha }}
levante:
runs-on: ubuntu-latest
needs: levante-init
strategy:
fail-fast: false
matrix:
config-name:
- nvhpc-gpu-openacc-DP
- nvhpc-gpu-openacc-SP
#- nag-cpu-default-DP
- nag-cpu-default-SP
- nag-cpu-accel-DP
#- nag-cpu-accel-SP
steps:
#
# Build, run and check (fetch the log)
#
- name: Build, run and check (fetch the log)
uses: "skosukhin/git-ci-hub-lab/gl-attach-job@v1"
with:
server-url: ${{ vars.DKRZ_GITLAB_SERVER }}
project-name: ${{ vars.DKRZ_GITLAB_PROJECT }}
token: ${{ secrets.DKRZ_GITLAB_TOKEN }}
pipeline-id: ${{ needs.levante-init.outputs.pipeline-id }}
job-name: ${{ matrix.config-name }}
levante-cleanup:
runs-on: ubuntu-latest
needs: [levante-init, levante]
if: always() && needs.levante-init.result != 'skipped'
continue-on-error: true
steps:
- uses: "skosukhin/git-ci-hub-lab/g-delete-ref@v1"
with:
remote-url: ${{ vars.DKRZ_GITLAB_SERVER }}/${{ vars.DKRZ_GITLAB_PROJECT }}.git
password: ${{ secrets.DKRZ_GITLAB_TOKEN }}
ref-type: ${{ needs.levante-init.outputs.ref-type }}
ref-name: ${{ needs.levante-init.outputs.ref-name }}
force: true
#
# Deferred GitLab pipelines on Lumi at CSC (see .gitlab/lumi.yml):
#
lumi-init:
if: |
false &&
github.repository_owner == 'earth-system-radiation' &&
( github.event_name != 'pull_request' ||
( github.event.pull_request.head.repo.owner.login == github.repository_owner &&
github.event.pull_request.user.login != 'dependabot[bot]' ))
runs-on: ubuntu-latest
outputs:
ref-type: ${{ steps.g-push-rev.outputs.ref-type }}
ref-name: ${{ steps.g-push-rev.outputs.ref-name }}
pipeline-id: ${{ steps.gl-create-pipeline.outputs.pipeline-id }}
steps:
#
# Check out GitHub repository
#
- name: Check out GitHub repository
uses: actions/checkout@v4
with:
fetch-depth: 0
#
# Push to GitLab repository
#
- name: Push to GitLab repository
id: g-push-rev
uses: "skosukhin/git-ci-hub-lab/g-push-rev@v1"
with:
remote-url: ${{ vars.GITLAB_SERVER }}/${{ vars.GITLAB_PROJECT }}.git
password: ${{ secrets.GITLAB_TOKEN }}
rev-id: ${{ github.sha }}
rev-signing-format: ssh
rev-signing-key: ${{ secrets.GITLAB_SIGNING_KEY }}
ref-type: branch
force-push: true
#
# Create GitLab CI/CD Pipeline
#
- name: Create GitLab CI/CD Pipeline
id: gl-create-pipeline
uses: "skosukhin/git-ci-hub-lab/gl-create-pipeline@v1"
with:
server-url: ${{ vars.GITLAB_SERVER }}
project-name: ${{ vars.GITLAB_PROJECT }}
token: ${{ secrets.GITLAB_TOKEN }}
ref-name: ${{ steps.g-push-rev.outputs.ref-name }}
expected-sha: ${{ steps.g-push-rev.outputs.ref-commit }}
#
# Set up Python virtual environment (fetch the log)
#
- name: Set up Python virtual environment (fetch the log)
uses: "skosukhin/git-ci-hub-lab/gl-attach-job@v1"
with:
server-url: ${{ vars.GITLAB_SERVER }}
project-name: ${{ vars.GITLAB_PROJECT }}
token: ${{ secrets.GITLAB_TOKEN }}
pipeline-id: ${{ steps.gl-create-pipeline.outputs.pipeline-id }}
job-name: setup-python
lumi:
runs-on: ubuntu-latest
needs: lumi-init
strategy:
fail-fast: false
matrix:
config-name:
- cce-gpu-openacc-DP
- cce-gpu-openacc-SP
steps:
#
# Build, run and check (fetch the log)
#
- name: Build, run and check (fetch the log)
uses: "skosukhin/git-ci-hub-lab/gl-attach-job@v1"
with:
server-url: ${{ vars.GITLAB_SERVER }}
project-name: ${{ vars.GITLAB_PROJECT }}
token: ${{ secrets.GITLAB_TOKEN }}
pipeline-id: ${{ needs.lumi-init.outputs.pipeline-id }}
job-name: ${{ matrix.config-name }}
lumi-cleanup:
runs-on: ubuntu-latest
needs: [lumi-init, lumi]
if: always() && needs.lumi-init.result != 'skipped'
continue-on-error: true
steps:
- uses: "skosukhin/git-ci-hub-lab/gl-cancel-pipeline@v1"
with:
server-url: ${{ vars.GITLAB_SERVER }}
project-name: ${{ vars.GITLAB_PROJECT }}
token: ${{ secrets.GITLAB_TOKEN }}
pipeline-id: ${{ needs.lumi-init.outputs.pipeline-id }}
force: true
- uses: "skosukhin/git-ci-hub-lab/gl-delete-ref@v1"
with:
server-url: ${{ vars.GITLAB_SERVER }}
project-name: ${{ vars.GITLAB_PROJECT }}
token: ${{ secrets.GITLAB_TOKEN }}
ref-type: ${{ needs.lumi-init.outputs.ref-type }}
ref-name: ${{ needs.lumi-init.outputs.ref-name }}
force: true