1
- name : Gubbins extension tests
1
+ name : Gubbins extension Tests
2
2
3
3
on :
4
4
push :
41
41
run : npm --prefix packages/extensions run ts-lint
42
42
43
43
# ============================================================================#
44
- # WARNING: In your CI/CD pipeline, you should remove the following job #
44
+ # WARNING: In your CI/CD pipeline, you should remove the following jobs #
45
45
# ----------------------------------------------------------------------------#
46
- prepare-gubbins-as-a-standalone :
46
+ # By default, the gubbins extension is part of a monorepo and uses a local #
47
+ # version of `diracx-web-components`. This default setup is not #
48
+ # representative of a standalone extension configuration. Here we want to #
49
+ # closely mimic a standalone extension. To do so, we: #
50
+ # - Isolate the packages/extensions directory: Move its content to a new #
51
+ # repository or directory outside the monorepo. #
52
+ # - Update Configuration: Adjust relevant variables to align with a #
53
+ # standalone setup. #
54
+ prepare-gubbins-backend :
55
+ runs-on : ubuntu-latest
56
+ if : ${{ github.event_name != 'push' || github.repository == 'DIRACGrid/diracx-web' }}
57
+ steps :
58
+ - name : Clone source
59
+ run : |
60
+ cd ..
61
+ git clone https://github.com/DIRACGrid/diracx.git
62
+
63
+ - name : Where the magic happens (Move extensions to a temporary directory)
64
+ run : |
65
+ # We have to copy the code to another directory
66
+ # and make it a git repository by itself because otherwise the
67
+ # root in the pyproject to do not make sense once mounted
68
+ # in the containers.
69
+ cp -r ../diracx/extensions/gubbins /tmp/
70
+ sed -i 's@../..@.@g' /tmp/gubbins/pyproject.toml
71
+ sed -i 's@../../@@g' /tmp/gubbins/gubbins-*/pyproject.toml
72
+ git init /tmp/gubbins/
73
+
74
+ - name : Upload artifact
75
+ uses : actions/upload-artifact@v4
76
+ with :
77
+ name : gubbins
78
+ path : /tmp/gubbins
79
+
80
+ - name : Set up QEMU
81
+ uses : docker/setup-qemu-action@v3
82
+ - name : Set up Docker Buildx
83
+ uses : docker/setup-buildx-action@v3
84
+
85
+ - name : Build and export service
86
+ uses : docker/build-push-action@v6
87
+ with :
88
+ context : ../diracx/extensions/containers/services
89
+ tags : gubbins/services:dev
90
+ outputs : type=docker,dest=/tmp/gubbins_services_image.tar
91
+ build-args : |
92
+ EXTRA_PACKAGES_TO_INSTALL=git+https://github.com/DIRACGrid/DIRAC.git@integration
93
+ EXTENSION_CUSTOM_SOURCES_TO_INSTALL=/bindmount/gubbins_db*.whl,/bindmount/gubbins_routers*.whl,/bindmount/gubbins_client*.whl
94
+
95
+ - name : Upload artifact
96
+ uses : actions/upload-artifact@v4
97
+ with :
98
+ name : gubbins-services-img
99
+ path : /tmp/gubbins_services_image.tar
100
+
101
+ prepare-gubbins-frontend-as-a-standalone :
47
102
runs-on : ubuntu-latest
48
103
if : ${{ github.event_name != 'push' || github.repository == 'DIRACGrid/diracx-web' }}
49
104
steps :
@@ -64,37 +119,39 @@ jobs:
64
119
65
120
- name : Where the magic happens (Move extensions to a temporary directory)
66
121
run : |
67
- # Move the library package to the extensions directory
68
- mv packages/diracx-web-components/*.tgz packages/extensions/diracx-web-components.tgz
69
122
# Move the extensions to the temporary directory
70
- mv packages/extensions /tmp/extensions
123
+ cp -r packages/extensions /tmp/gubbins-web
124
+ # Move the library package to the extensions directory
125
+ mv packages/diracx-web-components/*.tgz /tmp/gubbins-web/diracx-web-components.tgz
71
126
# Update the package.json to point to the local diracx-web-components
72
- jq '.dependencies["@dirac-grid/diracx-web-components"] = "file:./diracx-web-components.tgz"' /tmp/extensions /package.json > /tmp/extensions /package.temp.json
73
- mv /tmp/extensions /package.temp.json /tmp/extensions /package.json
127
+ jq '.dependencies["@dirac-grid/diracx-web-components"] = "file:./diracx-web-components.tgz"' /tmp/gubbins-web /package.json > /tmp/gubbins-web /package.temp.json
128
+ mv /tmp/gubbins-web /package.temp.json /tmp/gubbins-web /package.json
74
129
# Update the package.json to point to the correct postinstall script
75
- jq '.scripts.postinstall = "node ./node_modules/@axa-fr/react-oidc/bin/copy-service-worker-files.mjs public"' /tmp/extensions/package.json > /tmp/extensions/package.temp.json
76
- mv /tmp/extensions/package.temp.json /tmp/extensions/package.json
130
+ jq '.scripts.postinstall = "node ./node_modules/@axa-fr/react-oidc/bin/copy-service-worker-files.mjs public"' /tmp/gubbins-web/package.json > /tmp/gubbins-web/package.temp.json
131
+ mv /tmp/gubbins-web/package.temp.json /tmp/gubbins-web/package.json
132
+ # Update the next.config.js to prevent the standalone extension from searching a local version of diracx-web-components that does not exist
133
+ echo 'const nextConfig = { output: "export", images: { unoptimized: true }}; export default nextConfig;' > /tmp/gubbins-web/next.config.js
77
134
78
135
- name : Install extensions dependencies
79
- working-directory : /tmp/extensions
136
+ working-directory : /tmp/gubbins-web
80
137
run : npm install
81
138
82
139
- name : Upload the extensions directory
83
140
uses : actions/upload-artifact@v4
84
141
with :
85
- name : gubbins
86
- path : /tmp/extensions
142
+ name : gubbins-web
143
+ path : /tmp/gubbins-web
87
144
retention-days : 1
88
145
# ----------------------------------------------------------------------------#
89
146
# In the following jobs, you should: #
90
- # - Replace /tmp/extensions with the path to your extension source code #
147
+ # - Replace /tmp/gubbins-web with the path to your extension source code #
91
148
# - Remove the `needs: prepare-gubbins-as-a-standalone` line #
92
149
# ============================================================================#
93
150
94
151
# Build the extension image
95
152
build-gubbins-dev-image :
96
153
runs-on : ubuntu-latest
97
- needs : prepare-gubbins-as-a-standalone
154
+ needs : prepare-gubbins-frontend- as-a-standalone
98
155
if : ${{ github.event_name != 'push' || github.repository == 'DIRACGrid/diracx-web' }}
99
156
steps :
100
157
- uses : actions/checkout@v4
@@ -114,52 +171,72 @@ jobs:
114
171
# ========================================================================#
115
172
# WARNING: In your CI/CD pipeline, you should remove the following steps #
116
173
# ------------------------------------------------------------------------#
117
- - name : Download the extensions directory
174
+ - name : Download gubbins-web
118
175
uses : actions/download-artifact@v4
119
176
with :
120
- name : gubbins
121
- path : /tmp/extensions
177
+ name : gubbins-web
178
+ path : /tmp/gubbins-web
122
179
# ------------------------------------------------------------------------#
123
180
# ========================================================================#
124
181
125
182
# In your extension, you have to push the image to the registry (check deployment.yml)
126
183
- name : Build Docker image (extension example)
127
184
uses : docker/build-push-action@v6
128
185
with :
129
- context : /tmp/extensions
186
+ context : /tmp/gubbins-web
130
187
push : false
131
188
tags : ghcr.io/diracgrid/diracx-web/gubbins:dev
132
189
platforms : linux/amd64,linux/arm64
133
190
134
- # Run the demo with the extension source code
191
+ # Run the demo with the extension source code (frontend and backend)
135
192
run-demo :
136
193
runs-on : ubuntu-latest
137
- needs : prepare-gubbins-as-a-standalone
194
+ needs : [ prepare-gubbins-frontend- as-a-standalone, prepare-gubbins-backend]
138
195
if : github.event_name != 'push' || github.repository == 'DIRACGrid/diracx-web'
139
196
steps :
140
197
- uses : actions/checkout@v4
141
198
142
- - name : Clone source
199
+ - name : Clone source
143
200
run : |
144
201
cd ..
145
202
git clone https://github.com/DIRACGrid/diracx-charts.git
146
203
147
204
# ========================================================================#
148
205
# WARNING: In your CI/CD pipeline, you should remove the following steps #
149
206
# ------------------------------------------------------------------------#
150
- - name : Download the extensions directory
207
+ - name : Download gubbins
151
208
uses : actions/download-artifact@v4
152
209
with :
153
210
name : gubbins
154
- path : /tmp/extensions
211
+ path : /tmp/gubbins
212
+
213
+ - name : Clone diracx source
214
+ run : |
215
+ cd ..
216
+ git clone https://github.com/DIRACGrid/diracx.git
217
+
218
+ - name : Download gubbins:services image
219
+ uses : actions/download-artifact@v4
220
+ with :
221
+ name : gubbins-services-img
222
+ path : /tmp/gubbins_services_image.tar
223
+
224
+ - name : Load docker image
225
+ run : docker load --input /tmp/gubbins_services_image.tar
226
+
227
+ - name : Download gubbins-web
228
+ uses : actions/download-artifact@v4
229
+ with :
230
+ name : gubbins-web
231
+ path : /tmp/gubbins-web
155
232
# ------------------------------------------------------------------------#
156
233
# ========================================================================#
157
234
158
235
# Runs the demo with the extension source code
159
236
- name : Start demo
160
237
run : |
161
238
cd ..
162
- diracx-charts/run_demo.sh --exit-when-done /tmp /extensions/
239
+ diracx-charts/run_demo.sh --exit-when-done --set-value developer.autoReload=false --ci-values ./diracx /extensions/gubbins_values.yaml --load-docker-image "gubbins/services:dev" diracx/ /tmp/gubbins/ /tmp/gubbins-web /
163
240
164
241
- name : Debugging information
165
242
run : |
@@ -194,4 +271,4 @@ jobs:
194
271
with :
195
272
browser : chrome
196
273
config : baseUrl=${{ env.DIRACX_URL }}
197
- project : /tmp/extensions
274
+ project : /tmp/gubbins-web
0 commit comments