Skip to content

Commit 39e8ff2

Browse files
committed
feat(extension): use the local diracx-web-components
1 parent 8ac1f13 commit 39e8ff2

20 files changed

+357
-7202
lines changed

.github/workflows/deployment.yml

+1-58
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454
- name: Publish to NPM
5555
env:
5656
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
57-
run: npx lerna publish from-package --no-push --no-private --yes
57+
run: npm publish from-package --no-push --no-private --yes
5858

5959
# Storybook is built and deployed to GitHub Pages
6060
# -----------------------------------------------
@@ -150,61 +150,4 @@ jobs:
150150
context: .
151151
push: true
152152
tags: ghcr.io/diracgrid/diracx-web/static:${{ needs.release-please.outputs.tag_name }}
153-
platforms: linux/amd64,linux/arm64
154-
155-
# gubbins is built and deployed to GitHub Container Registry
156-
# -------------------------------------------------------------
157-
158-
build-deploy-gubbins-dev-image:
159-
runs-on: ubuntu-latest
160-
if: ${{ github.event_name != 'push' || github.repository == 'DIRACGrid/diracx-web' }}
161-
steps:
162-
- uses: actions/checkout@v4
163-
164-
- name: Set up QEMU
165-
uses: docker/setup-qemu-action@v3
166-
- name: Set up Docker Buildx
167-
uses: docker/setup-buildx-action@v3
168-
169-
- name: Login to GitHub container registry
170-
uses: docker/login-action@v3
171-
with:
172-
registry: ghcr.io
173-
username: ${{ github.actor }}
174-
password: ${{ secrets.GITHUB_TOKEN }}
175-
176-
- name: Build Docker image (extension example)
177-
uses: docker/build-push-action@v6
178-
with:
179-
context: ./packages/extensions
180-
push: ${{ github.event_name == 'push' && github.repository == 'DIRACGrid/diracx-web' && github.ref_name == 'main' }}
181-
tags: ghcr.io/diracgrid/diracx-web/gubbins:dev
182-
platforms: linux/amd64,linux/arm64
183-
184-
build-deploy-gubbins-release-image:
185-
runs-on: ubuntu-latest
186-
if: ${{ github.event_name == 'push' && github.repository == 'DIRACGrid/diracx-web' }}
187-
needs: release-please
188-
steps:
189-
- uses: actions/checkout@v4
190-
191-
- name: Set up QEMU
192-
uses: docker/setup-qemu-action@v3
193-
- name: Set up Docker Buildx
194-
uses: docker/setup-buildx-action@v3
195-
196-
- name: Login to GitHub container registry
197-
uses: docker/login-action@v3
198-
with:
199-
registry: ghcr.io
200-
username: ${{ github.actor }}
201-
password: ${{ secrets.GITHUB_TOKEN }}
202-
203-
- name: Build Docker image
204-
if: ${{ needs.release-please.outputs.release_created == 'true' }}
205-
uses: docker/build-push-action@v6
206-
with:
207-
context: ./packages/extensions
208-
push: true
209-
tags: ghcr.io/diracgrid/diracx-web/gubbins:${{ needs.release-please.outputs.tag_name }}
210153
platforms: linux/amd64,linux/arm64

.github/workflows/diracx-web-components-test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ on:
1818
- release-please-**
1919

2020
jobs:
21-
build:
21+
test:
2222
runs-on: ubuntu-latest
2323
if: github.event_name != 'push' || github.repository == 'DIRACGrid/diracx-web'
2424
steps:

.github/workflows/gubbins-test.yml

+118-10
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,11 @@ on:
1212
- release-please-**
1313

1414
jobs:
15+
# Run lint and type checks
1516
run-lint:
1617
runs-on: ubuntu-latest
1718
# Run the tests only if It's a PR or if the repo is DIRACGrid/diracx-web
1819
if: github.event_name != 'push' || github.repository == 'DIRACGrid/diracx-web'
19-
defaults:
20-
run:
21-
working-directory: packages/extensions
2220
steps:
2321
# Checkout the new source code
2422
- uses: actions/checkout@v4
@@ -30,15 +28,114 @@ jobs:
3028

3129
- name: Install dependencies
3230
run: npm ci
31+
32+
# ========================================================================#
33+
# WARNING: In your CI/CD pipeline, you should remove the following step #
34+
# ------------------------------------------------------------------------#
35+
- name: Build Library
36+
run: npm run build:diracx-web-components
37+
# ------------------------------------------------------------------------#
38+
# ========================================================================#
3339

3440
- name: Check code-quality rules
35-
run: npm run lint
41+
run: npm --prefix packages/extensions run lint
3642
- name: Check typescript type validity
37-
run: npm run ts-lint
43+
run: npm --prefix packages/extensions run ts-lint
44+
45+
# ============================================================================#
46+
# WARNING: In your CI/CD pipeline, you should remove the following job #
47+
# ----------------------------------------------------------------------------#
48+
prepare-gubbins-as-a-standalone:
49+
runs-on: ubuntu-latest
50+
if: ${{ github.event_name != 'push' || github.repository == 'DIRACGrid/diracx-web' }}
51+
steps:
52+
- uses: actions/checkout@v4
53+
54+
- uses: actions/setup-node@v4
55+
with:
56+
node-version: 'lts/*'
57+
registry-url: 'https://registry.npmjs.org'
58+
59+
- name: Install dependencies
60+
run: npm ci
3861

62+
- name: Build diracx-web-components
63+
working-directory: packages/diracx-web-components
64+
run: |
65+
npm pack
66+
67+
- name: Where the magic happens (Move extensions to a temporary directory)
68+
run: |
69+
# Move the library package to the extensions directory
70+
mv packages/diracx-web-components/*.tgz packages/extensions/diracx-web-components.tgz
71+
# Move the extensions to the temporary directory
72+
mv packages/extensions /tmp/extensions
73+
# Update the package.json to point to the local diracx-web-components
74+
jq '.dependencies["@dirac-grid/diracx-web-components"] = "file:./diracx-web-components.tgz"' /tmp/extensions/package.json > /tmp/extensions/package.temp.json
75+
mv /tmp/extensions/package.temp.json /tmp/extensions/package.json
76+
# Update the package.json to point to the correct postinstall script
77+
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
78+
mv /tmp/extensions/package.temp.json /tmp/extensions/package.json
79+
80+
- name: Install extensions dependencies
81+
working-directory: /tmp/extensions
82+
run: npm install
83+
84+
- name: Upload the extensions directory
85+
uses: actions/upload-artifact@v4
86+
with:
87+
name: gubbins
88+
path: /tmp/extensions
89+
retention-days: 1
90+
# ----------------------------------------------------------------------------#
91+
# In the following jobs, you should: #
92+
# - Replace /tmp/extensions with the path to your extension source code #
93+
# - Remove the `needs: prepare-gubbins-as-a-standalone` line #
94+
# ============================================================================#
95+
96+
# Build the extension image
97+
build-gubbins-dev-image:
98+
runs-on: ubuntu-latest
99+
needs: prepare-gubbins-as-a-standalone
100+
if: ${{ github.event_name != 'push' || github.repository == 'DIRACGrid/diracx-web' }}
101+
steps:
102+
- uses: actions/checkout@v4
103+
104+
- name: Set up QEMU
105+
uses: docker/setup-qemu-action@v3
106+
- name: Set up Docker Buildx
107+
uses: docker/setup-buildx-action@v3
108+
109+
- name: Login to GitHub container registry
110+
uses: docker/login-action@v3
111+
with:
112+
registry: ghcr.io
113+
username: ${{ github.actor }}
114+
password: ${{ secrets.GITHUB_TOKEN }}
115+
116+
# ========================================================================#
117+
# WARNING: In your CI/CD pipeline, you should remove the following steps #
118+
# ------------------------------------------------------------------------#
119+
- name: Download the extensions directory
120+
uses: actions/download-artifact@v4
121+
with:
122+
name: gubbins
123+
path: /tmp/extensions
124+
# ------------------------------------------------------------------------#
125+
# ========================================================================#
126+
127+
- name: Build Docker image (extension example)
128+
uses: docker/build-push-action@v6
129+
with:
130+
context: /tmp/extensions
131+
push: false
132+
tags: ghcr.io/diracgrid/diracx-web/gubbins:dev
133+
platforms: linux/amd64,linux/arm64
134+
135+
# Run the demo with the extension source code
39136
run-demo:
40137
runs-on: ubuntu-latest
41-
# Run the tests only if It's a PR or if the repo is DIRACGrid/diracx-web
138+
needs: prepare-gubbins-as-a-standalone
42139
if: github.event_name != 'push' || github.repository == 'DIRACGrid/diracx-web'
43140
steps:
44141
# Checkout the new source code
@@ -49,14 +146,25 @@ jobs:
49146
run: |
50147
cd ..
51148
git clone https://github.com/aldbr/diracx-charts.git
52-
cd diracx-charts
53-
git switch main_FEAT_npm-workspaces
149+
150+
# ========================================================================#
151+
# WARNING: In your CI/CD pipeline, you should remove the following steps #
152+
# ------------------------------------------------------------------------#
153+
- name: Download the extensions directory
154+
uses: actions/download-artifact@v4
155+
with:
156+
name: gubbins
157+
path: /tmp/extensions
158+
# ------------------------------------------------------------------------#
159+
# ========================================================================#
54160

55161
# Runs the demo with the extension source code
56162
- name: Start demo
57163
run: |
58164
cd ..
59-
diracx-charts/run_demo.sh --exit-when-done diracx-web/packages/extensions/
165+
ls -la
166+
ls -la diracx-charts
167+
diracx-charts/run_demo.sh --exit-when-done /tmp/extensions/
60168
61169
# Prints some debugging information in case something goes wrong
62170
- name: Debugging information
@@ -92,4 +200,4 @@ jobs:
92200
with:
93201
browser: chrome
94202
config: baseUrl=${{ env.DIRACX_URL }}
95-
project: packages/extensions
203+
project: /tmp/extensions

.release-please-manifest.json

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
".": "0.1.0-a2",
3+
"packages/extensions": "0.1.0-a2",
34
"packages/diracx-web": "0.1.0-a2",
45
"packages/diracx-web-components": "0.1.0-a2"
56
}

README.md

-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ flowchart TD
2727
monorep3["extension[gubbins]"]
2828
end
2929
monorep2 -- images deployed in --> docker[" "]
30-
monorep3 -- images deployed in --> docker
3130
monorep2 -. uses .-> monorep1
3231
monorep3 -. uses .-> monorep1
3332
monorep1 -- documented on --> storybook[" "]

package-lock.json

+103-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"private": true,
55
"workspaces": [
66
"packages/diracx-web-components",
7-
"packages/diracx-web"
7+
"packages/diracx-web",
8+
"packages/extensions"
89
],
910
"devDependencies": {
1011
"husky": "^9.0.11"

0 commit comments

Comments
 (0)