Skip to content

Commit e1d3874

Browse files
committed
Merge branch 'main' into edit-resources
2 parents 2a8f6f8 + b6d489a commit e1d3874

File tree

16 files changed

+740
-650
lines changed

16 files changed

+740
-650
lines changed

.github/workflows/build.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535

3636
- name: Upload Cypress Screenshots
3737
if: always() # Run this step even if tests fail
38-
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
38+
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5
3939
with:
4040
name: cypress-screenshots
4141
path: |

.github/workflows/main.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ jobs:
2727
attestations: write
2828

2929
steps:
30+
- name: Install Go-Task
31+
uses: arduino/setup-task@v2
32+
with:
33+
version: 3.x
34+
repo-token: ${{ secrets.GITHUB_TOKEN }}
35+
3036
- name: Checkout code
3137
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
3238

@@ -64,3 +70,12 @@ jobs:
6470
annotations: ${{ steps.meta.outputs.annotations }}
6571
cache-from: type=gha
6672
cache-to: type=gha,mode=max
73+
74+
- name: Build OCM component
75+
run: task build:ocm
76+
env:
77+
IMAGE_VERSION: "main"
78+
OCM_COMPONENT_VERSION: "v0.0.0-main"
79+
80+
- name: Publish OCM component
81+
run: task publish:ocm OCM_TRANSFER_ARGS="--overwrite"

.github/workflows/on-release.yaml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
workflow_dispatch:
88
inputs:
99
nextVersion:
10-
description: 'specify the release version in the semver format v[major].[minor].[patch] e.g. v0.0.0'
10+
description: "specify the release version in the semver format v[major].[minor].[patch] e.g. v0.0.0"
1111
required: true
1212

1313
# base permissions for all jobs should be minimal
@@ -71,6 +71,20 @@ jobs:
7171
sbom: true
7272
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest,${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.event.inputs.nextVersion }}
7373

74+
- name: Install Go-Task
75+
uses: arduino/setup-task@v2
76+
with:
77+
version: 3.x
78+
repo-token: ${{ secrets.GITHUB_TOKEN }}
79+
80+
- name: Build OCM component
81+
run: task build:ocm
82+
env:
83+
OCM_COMPONENT_VERSION: ${{ github.event.inputs.nextVersion }}
84+
85+
- name: Publish OCM component
86+
run: task publish:ocm
87+
7488
- name: Create Release with autogenerated release notes
7589
env:
7690
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ dist
1212
dist-ssr
1313
*.local
1414

15+
.bin
16+
1517
# Editor directories and files
1618
.vscode/*
1719
!.vscode/extensions.json
@@ -33,3 +35,6 @@ public/frontend-config.json
3335

3436
# Sentry Config File
3537
.env.sentry-build-plugin
38+
39+
# OCM build artifacts
40+
.ctf/

Taskfile.yml

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
version: '3'
2+
3+
vars:
4+
# Variables for Docker image
5+
REGISTRY: '{{.REGISTRY | default (print "ghcr.io/openmcp-project") }}'
6+
IMAGE_NAME: mcp-ui-frontend
7+
IMAGE_TAG: '{{.TAG | default "latest"}}'
8+
DOCKER_IMAGE: '{{.REGISTRY}}/{{.IMAGE_NAME}}:{{.IMAGE_TAG}}'
9+
10+
# Variables for OCM component
11+
OCM_COMPONENT_NAME: github.com/openmcp-project/ui
12+
OCM_COMPONENT_VERSION: '{{.OCM_COMPONENT_VERSION | default .IMAGE_TAG}}'
13+
OCM_PROVIDER: openmcp-project
14+
OCM_TARGET_REPO: '{{.OCM_TARGET_REPO | default (print .REGISTRY "/components") }}'
15+
OCM_OUTPUT_DIR: '{{.ROOT_DIR}}/.ctf'
16+
OCM_DESCRIPTOR: '{{.ROOT_DIR}}/ocm/component-descriptor.yaml'
17+
18+
ROOT_DIR2: '{{.ROOT_DIR | trimSuffix "/common" | trimSuffix "/hack"}}'
19+
LOCALBIN: '{{ env "LOCALBIN" | default ( .LOCALBIN | default (print .ROOT_DIR2 "/.bin") ) }}'
20+
OCM: '{{ .OCM | default (print .LOCALBIN "/ocm") }}'
21+
22+
tasks:
23+
default:
24+
desc: Show available tasks
25+
cmds:
26+
- task --list
27+
28+
build:ocm:
29+
desc: 'Builds the ocm component. Usage: task build:ocm'
30+
deps:
31+
- install:ocm
32+
cmds:
33+
- rm -rf {{.OCM_OUTPUT_DIR}}
34+
- |
35+
{{.OCM}} add components --create \
36+
--lookup {{.OCM_TARGET_REPO}} \
37+
--file {{.OCM_OUTPUT_DIR}} \
38+
{{.OCM_DESCRIPTOR}} -- \
39+
VERSION={{.OCM_COMPONENT_VERSION}} \
40+
IMAGE_VERSION={{.IMAGE_VERSION}} \
41+
COMPONENT_NAME={{.OCM_COMPONENT_NAME}} \
42+
PROVIDER={{.OCM_PROVIDER}}
43+
vars:
44+
IMAGE_VERSION: '{{.IMAGE_VERSION | default (print .OCM_COMPONENT_VERSION)}}'
45+
46+
publish:ocm:
47+
desc: 'Publishes the ocm component to the registry. Usage: task publish:ocm [OCM_TRANSFER_ARGS="--overwrite"]'
48+
deps:
49+
- install:ocm
50+
cmds:
51+
- |
52+
{{.OCM}} transfer ctf \
53+
{{.OCM_OUTPUT_DIR}} {{.OCM_TARGET_REPO}} {{.OCM_TRANSFER_ARGS}}
54+
55+
build:image:local:
56+
desc: 'Builds the docker image for local testing. Usage: task test:build-image TAG=v-local-test'
57+
cmds:
58+
- docker build -t {{.DOCKER_IMAGE}} .
59+
60+
publish:image:local:
61+
desc: 'Publishes the docker image for local testing. Usage: task test:publish-image TAG=v-local-test'
62+
cmds:
63+
- docker push {{.DOCKER_IMAGE}}
64+
65+
localbin:
66+
desc: ' Ensure that the folder specified in LOCALBIN exists.'
67+
run: once
68+
requires:
69+
vars:
70+
- LOCALBIN
71+
status:
72+
- test -d {{.LOCALBIN}}
73+
cmds:
74+
- 'echo "localbin: {{.LOCALBIN}}"'
75+
- mkdir -p {{.LOCALBIN}}
76+
internal: true
77+
78+
install:ocm:
79+
desc: ' Ensure that the ocm CLI is installed.'
80+
run: once
81+
requires:
82+
vars:
83+
- OCM
84+
deps:
85+
- localbin
86+
status:
87+
- 'test -x "{{.OCM}}"'
88+
- '"{{.OCM}}" --version | grep -q "{{.OCM_VERSION | trimPrefix "v"}}"'
89+
vars:
90+
# renovate: datasource=github-releases depName=ocm packageName=open-component-model/ocm
91+
OCM_VERSION: '{{ env "OCM_VERSION" | default ( .OCM_VERSION | default "v0.30.0" ) }}'
92+
tmpdir:
93+
sh: 'mktemp -d'
94+
cmds:
95+
- 'curl -sSfL https://ocm.software/install.sh | OCM_VERSION="{{.OCM_VERSION | trimPrefix "v"}}" bash -s "{{.tmpdir}}"'
96+
- 'mv "{{.tmpdir}}/ocm" "{{.OCM}}"'

cypress/support/commands.d.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
declare global {
2+
namespace Cypress {
3+
interface Chainable<Subject = unknown> {
4+
/**
5+
* Deep-compares two objects after normalising them with
6+
* JSON.stringify/parse (removes proxies, undefined, symbols …).
7+
*
8+
* @example
9+
* cy.wrap(actual).deepEqualJson(expected)
10+
*/
11+
deepEqualJson(expected: unknown): Chainable<Subject>;
12+
}
13+
}
14+
}
15+
16+
export {};

cypress/support/commands.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,9 @@
11
import '@ui5/webcomponents-cypress-commands';
2-
import "../../src/utils/i18n/i18n";
2+
import '../../src/utils/i18n/i18n';
3+
4+
const toPlain = <T>(o: T): T => JSON.parse(JSON.stringify(o));
5+
6+
Cypress.Commands.add('deepEqualJson', { prevSubject: true }, (subject, expected) => {
7+
expect(toPlain(subject)).to.deep.equal(toPlain(expected));
8+
return subject;
9+
});

ocm/component-descriptor.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: ${COMPONENT_NAME}
2+
version: ${VERSION}
3+
provider:
4+
name: ${PROVIDER}
5+
sources: []
6+
componentReferences: []
7+
resources:
8+
- name: mcp-ui-frontend-image
9+
type: ociImage
10+
version: ${VERSION}
11+
access:
12+
type: ociArtifact
13+
imageReference: ghcr.io/openmcp-project/mcp-ui-frontend:${IMAGE_VERSION}

0 commit comments

Comments
 (0)