Skip to content

Commit 0b7542a

Browse files
committed
Merge branch 'main' into updating-v0.26.0
2 parents 42fddb8 + d714f45 commit 0b7542a

File tree

205 files changed

+25110
-6708
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

205 files changed

+25110
-6708
lines changed

.github/dependabot.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# SPDX-FileCopyrightText: 2022 Alliander N.V.
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
version: 2
6+
7+
updates:
8+
# Maintain dependencies for GitHub Actions
9+
- package-ecosystem: "github-actions"
10+
directory: "/"
11+
schedule:
12+
interval: "daily"
13+
open-pull-requests-limit: 5
14+
- package-ecosystem: "docker"
15+
directory: "/"
16+
schedule:
17+
interval: "daily"
18+
open-pull-requests-limit: 5

.github/release.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# SPDX-FileCopyrightText: 2022 Alliander N.V.
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
changelog:
6+
exclude:
7+
labels:
8+
- wontfix
9+
- duplicate
10+
- invalid
11+
categories:
12+
- title: New Features
13+
labels:
14+
- enhancement
15+
- title: Bugfixes
16+
labels:
17+
- bug
18+
- title: Tooling changes
19+
labels:
20+
- tooling
21+
- title: Dependency updates
22+
labels:
23+
- dependencies
24+
- title: Other Changes
25+
labels:
26+
- "*"
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# SPDX-FileCopyrightText: 2022 Alliander N.V.
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
name: Add issues and pull request to project boards
6+
7+
on: [ issues, pull_request, pull_request_target ]
8+
9+
jobs:
10+
github-actions-automate-projects:
11+
runs-on: ubuntu-latest
12+
13+
if: ${{ (github.event_name != 'pull_request_target' && github.actor != 'dependabot[bot]') || (github.actor == 'dependabot[bot]' && github.event_name == 'pull_request_target') }}
14+
steps:
15+
- name: add-new-issues-to-organization-based-project-column
16+
if: github.event_name == 'issues' && github.event.action == 'opened'
17+
uses: alex-page/github-project-automation-plus@v0.8.2
18+
with:
19+
project: CoMPAS Issues Overview Board
20+
column: To do
21+
repo-token: ${{ secrets.ORG_GITHUB_ACTION_SECRET }}
22+
- name: add-new-pull-request-to-organization-based-project-column
23+
if: (github.event_name == 'pull_request' || github.event_name == 'pull_request_target') && github.event.action == 'opened'
24+
uses: alex-page/github-project-automation-plus@v0.8.2
25+
with:
26+
project: CoMPAS Pull Request Overview Board
27+
column: To do
28+
repo-token: ${{ secrets.ORG_GITHUB_ACTION_SECRET }}

.github/workflows/build-and-deploy.yml

Lines changed: 0 additions & 30 deletions
This file was deleted.

.github/workflows/build-project.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# SPDX-FileCopyrightText: 2022 Alliander N.V.
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
name: Build Project
6+
7+
on:
8+
push:
9+
branches:
10+
- '**'
11+
pull_request:
12+
branches:
13+
- 'main'
14+
15+
jobs:
16+
build:
17+
name: Build
18+
runs-on: ubuntu-latest
19+
timeout-minutes: 30
20+
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v3
24+
25+
- name: Cache Docker Register
26+
if: ${{ github.event_name == 'pull_request' }}
27+
uses: actions/cache@v3
28+
with:
29+
path: /tmp/.buildx-cache
30+
key: ${{ runner.os }}-buildx-${{ hashFiles('**/Dockerfile') }}
31+
32+
- name: Set up Docker Buildx
33+
id: buildx
34+
if: ${{ github.event_name == 'pull_request' }}
35+
uses: docker/setup-buildx-action@v2
36+
- name: Use Node.js 14.x
37+
uses: actions/setup-node@v3
38+
with:
39+
node-version: '14.x'
40+
41+
- name: Test application with npm
42+
if: ${{ github.event_name == 'push' }}
43+
run: |
44+
npm ci
45+
npm run-script test
46+
47+
- name: Build application with npm
48+
if: ${{ github.event_name == 'pull_request' }}
49+
run: |
50+
npm ci
51+
npm run-script build
52+
- name: Build docker image
53+
if: ${{ github.event_name == 'pull_request' }}
54+
uses: docker/build-push-action@v3
55+
with:
56+
# Set the context to use the current directory and not execute it's own git checkout.
57+
context: .
58+
push: false

.github/workflows/release-project.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# SPDX-FileCopyrightText: 2022 Alliander N.V.
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
name: Release Project
6+
7+
on:
8+
release:
9+
types: [released]
10+
11+
jobs:
12+
push_to_registry:
13+
name: Build and publish
14+
runs-on: ubuntu-latest
15+
timeout-minutes: 30
16+
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v3
20+
21+
- name: Cache Docker Register
22+
uses: actions/cache@v3
23+
with:
24+
path: /tmp/.buildx-cache
25+
key: ${{ runner.os }}-buildx-${{ hashFiles('**/Dockerfile') }}
26+
27+
- name: Extract tag name
28+
id: extract_tagname
29+
shell: bash
30+
# Extra the tagname form the git reference, value of GITHUB_REF will be something like refs/tags/<tag_name>.
31+
run: echo "##[set-output name=tagname;]$(echo ${GITHUB_REF##*/})"
32+
- name: Set up Docker Buildx
33+
id: buildx
34+
uses: docker/setup-buildx-action@v2
35+
- name: Login to Docker Hub
36+
uses: docker/login-action@v2
37+
with:
38+
username: ${{ secrets.DOCKER_HUB_USERNAME }}
39+
password: ${{ secrets.DOCKER_HUB_TOKEN }}
40+
- name: Use Node.js 14.x
41+
uses: actions/setup-node@v3
42+
with:
43+
node-version: '14.x'
44+
45+
- name: Build application with npm
46+
run: |
47+
npm ci
48+
npm run-script build
49+
- name: Build and push docker image to Docker Hub
50+
uses: docker/build-push-action@v3
51+
with:
52+
# Set the context to use the current directory and not execute it's own git checkout.
53+
context: .
54+
push: true
55+
# Tag the images using the tagname and also latest.
56+
tags: |
57+
lfenergy/compas-open-scd:${{ steps.extract_tagname.outputs.tagname }}
58+
lfenergy/compas-open-scd:latest

.github/workflows/test-and-build.yml

Lines changed: 0 additions & 19 deletions
This file was deleted.

.github/workflows/test.yml

Lines changed: 0 additions & 22 deletions
This file was deleted.

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,6 @@
2020
/_site/
2121
/build/
2222
/out-tsc/
23+
24+
/public/cim/
25+
!/public/cim/README.md

DEVELOPMENT.md

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
<!--
2+
SPDX-FileCopyrightText: 2021 Alliander N.V.
3+
4+
SPDX-License-Identifier: Apache-2.0
5+
-->
6+
7+
# Development for CoMPAS OpenSCD
8+
9+
## Building
10+
11+
If you want to build CoMPAS OpenSCD yourself in order to make some changes to your local installation or to contribute
12+
to the project, you may first want to install [Node.js](https://nodejs.org/) in order to be able to use our local
13+
development setup.
14+
15+
Once Node.js is installed on your system, you may get started by entering the following lines in your command prompt:
16+
17+
```
18+
git clone https://github.com/com-pas/compas-open-scd
19+
cd compas-open-scd
20+
npm install
21+
npm start
22+
```
23+
24+
This will start a local development server and open a browser window which will automatically be reloaded as soon as you
25+
save any changes to your local source code files.
26+
27+
## Linting & Formatting
28+
29+
If you use VSCode to develop, we recommend you install and use
30+
the [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint)
31+
and [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) extensions in order to
32+
automatically lint and format your code as you edit it. There are similar plugins available for
33+
using [ESLint](https://eslint.org/) and [Prettier](https://prettier.io/) from within other IDEs and text editors.
34+
35+
## TypeDoc
36+
This project uses [TypeDoc](https://typedoc.org/) to transform documentation comments in the source code into a rendered HTML document that can be queried and navigated through. If you want to consult the generated documentation for the TypeScript components, mixins, modules and other relevant artifacts of this project, you can [do it here](https://openscd.github.io/doc/).
37+
38+
## Scripts
39+
40+
We provide the following `npm` scripts for your convenience:
41+
42+
- `npm start` runs `CoMPAS OpenSCD` for development, reloading on file changes
43+
- `npm test` runs the test suite with Web Test Runner
44+
- `npm run lint` runs the linter (fixes problems in your code)
45+
- `npm run format` runs the formatter (formats your code in a unified way)
46+
- `npm run doc` builds HTML documentation into the `doc` directory
47+
- `npm run build` builds a deployable version of the project into the `build` directory
48+
49+
## Docker
50+
51+
It's also possible to run CoMPAS OpenSCD as a docker. Of every release a docker image is created and pushed to Docker
52+
Hub. To run the docker container use the following command.
53+
54+
```
55+
docker run -it --rm -d -p 8080:8080 --name compas-open-scd lfenergy/compas-open-scd:latest
56+
```
57+
58+
Now open a browser and go to "http://localhost:8080". CoMPAS OpenSCD is shown.
59+
60+
## CoMPAS Service
61+
62+
During development, it is sometimes handy to use running backend services, like CIM Mapping or SCL Data Service.
63+
The problem is that these services need an Authorization Header to work. Normally these are injected by a reverse proxy
64+
or something like that.
65+
66+
There is a work-around and that is using the ModHeader Extension of the Browser (Chrome, Firefox, ...).
67+
With this extension the header 'Authorization' can be added with a value 'Bearer <access token>'.
68+
69+
![ModHeader Screenshot](ModHeader.png)
70+
71+
URL Filters is used to only send this Request Header to the configured URLs.
72+
73+
To retrieve an Access Token from a running KeyCloak instance there is a Postman collection, see below.
74+
75+
### CoMPAS Services depends on a running KeyCloak instance
76+
77+
A KeyCloak instance needs to be running on port 8089 by default in dev mode. If a custom KeyCloak instance is used see
78+
[Security](README.md#security) for more details.
79+
80+
There is a preconfigured Demo KeyCloak instance available for CoMPAS in the
81+
[CoMPAS Deployment Repository](https://github.com/com-pas/compas-deployment). This repository can be cloned and
82+
used to execute the following commands to create a local Docker Image with the CoMPAS Demo configuration.
83+
84+
```shell
85+
cd <CoMPAS Deployment Repository Directory>/compas/keycloak
86+
docker build -t compas_keycloak .
87+
```
88+
89+
A Docker Image `compas_keycloak` is created that can be started using the following command
90+
91+
```shell
92+
docker run --rm --name compas_keycloak \
93+
-p 8089:8080
94+
-d compas_keycloak:latest
95+
```
96+
97+
There are now 3 users available to be used, `scl-data-editor`, `scl-data-reader`, `scd-reader`. See
98+
[CoMPAS Deployment Repository](https://github.com/com-pas/compas-deployment) for more information about the users.
99+
100+
### Postman
101+
102+
To make a call to the CoMPAS Backend Service work in CoMPAS OpenSCD we need to import an environment and authorisation
103+
collection. These files can be found in [CoMPAS Deployment Repository](https://github.com/com-pas/compas-deployment)
104+
in the directory `postman` (`auth.collection.json` and `local.environment.json`).
105+
106+
In the authorisation collection there are called for the 3 users known within the Demo KeyCloak instance.
107+
If one of these calls are executed you can switch to the tab `Visualize`. There is a button to copy the bearer to the
108+
clipboard. This will also be done automatically when switching to the tab (label becomes `Copied!`).
109+
The value of the clipboard can be copied in ModHeader Extension as Authorization Header.
110+
111+
Hint: `Bearer` is included in the value of the clipboard, so the complete value in ModHeader can be replaced.

0 commit comments

Comments
 (0)