forked from openscd/open-scd
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
223 changed files
with
148,741 additions
and
858 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# SPDX-FileCopyrightText: 2022 Alliander N.V. | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
version: 2 | ||
|
||
updates: | ||
# Maintain dependencies for GitHub Actions | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "daily" | ||
open-pull-requests-limit: 5 | ||
- package-ecosystem: "docker" | ||
directory: "/" | ||
schedule: | ||
interval: "daily" | ||
open-pull-requests-limit: 5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# SPDX-FileCopyrightText: 2022 Alliander N.V. | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
changelog: | ||
exclude: | ||
labels: | ||
- wontfix | ||
- duplicate | ||
- invalid | ||
categories: | ||
- title: New Features | ||
labels: | ||
- enhancement | ||
- title: Bugfixes | ||
labels: | ||
- bug | ||
- title: Tooling changes | ||
labels: | ||
- tooling | ||
- title: Dependency updates | ||
labels: | ||
- dependencies | ||
- title: Other Changes | ||
labels: | ||
- "*" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# SPDX-FileCopyrightText: 2022 Alliander N.V. | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
name: Add issues and pull request to project boards | ||
|
||
on: [ issues, pull_request, pull_request_target ] | ||
|
||
jobs: | ||
github-actions-automate-projects: | ||
runs-on: ubuntu-latest | ||
|
||
if: ${{ (github.event_name != 'pull_request_target' && github.actor != 'dependabot[bot]') || (github.actor == 'dependabot[bot]' && github.event_name == 'pull_request_target') }} | ||
steps: | ||
- name: add-new-issues-to-organization-based-project-column | ||
if: github.event_name == 'issues' && github.event.action == 'opened' | ||
uses: alex-page/[email protected] | ||
with: | ||
project: CoMPAS Issues Overview Board | ||
column: To do | ||
repo-token: ${{ secrets.ORG_GITHUB_ACTION_SECRET }} | ||
- name: add-new-pull-request-to-organization-based-project-column | ||
if: (github.event_name == 'pull_request' || github.event_name == 'pull_request_target') && github.event.action == 'opened' | ||
uses: alex-page/[email protected] | ||
with: | ||
project: CoMPAS Pull Request Overview Board | ||
column: To do | ||
repo-token: ${{ secrets.ORG_GITHUB_ACTION_SECRET }} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# SPDX-FileCopyrightText: 2022 Alliander N.V. | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
name: Build Project | ||
|
||
on: | ||
push: | ||
branches: | ||
- '**' | ||
pull_request: | ||
branches: | ||
- 'main' | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 45 | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/[email protected] | ||
|
||
- name: Cache Docker Register | ||
if: ${{ github.event_name == 'pull_request' }} | ||
uses: actions/cache@v3 | ||
with: | ||
path: /tmp/.buildx-cache | ||
key: ${{ runner.os }}-buildx-${{ hashFiles('**/Dockerfile') }} | ||
|
||
- name: Set up Docker Buildx | ||
id: buildx | ||
if: ${{ github.event_name == 'pull_request' }} | ||
uses: docker/setup-buildx-action@v3 | ||
- name: Use Node.js 14.x | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: '14.x' | ||
|
||
- name: Test application with npm | ||
timeout-minutes: 45 | ||
if: ${{ github.event_name == 'push' }} | ||
run: | | ||
npm ci | ||
npm run-script test | ||
- name: Build application with npm | ||
if: ${{ github.event_name == 'pull_request' }} | ||
timeout-minutes: 45 | ||
run: | | ||
npm ci | ||
npm run-script build | ||
- name: Build docker image | ||
if: ${{ github.event_name == 'pull_request' }} | ||
uses: docker/build-push-action@v5 | ||
with: | ||
# Set the context to use the current directory and not execute it's own git checkout. | ||
context: . | ||
push: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# SPDX-FileCopyrightText: 2022 Alliander N.V. | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
name: Release Project | ||
|
||
on: | ||
release: | ||
types: [released] | ||
|
||
jobs: | ||
push_to_registry: | ||
name: Build and publish | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 45 | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/[email protected] | ||
|
||
- name: Cache Docker Register | ||
uses: actions/cache@v3 | ||
with: | ||
path: /tmp/.buildx-cache | ||
key: ${{ runner.os }}-buildx-${{ hashFiles('**/Dockerfile') }} | ||
|
||
- name: Extract tag name | ||
id: extract_tagname | ||
shell: bash | ||
# Extra the tagname form the git reference, value of GITHUB_REF will be something like refs/tags/<tag_name>. | ||
run: echo "##[set-output name=tagname;]$(echo ${GITHUB_REF##*/})" | ||
- name: Set up Docker Buildx | ||
id: buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- name: Login to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKER_HUB_USERNAME }} | ||
password: ${{ secrets.DOCKER_HUB_TOKEN }} | ||
- name: Use Node.js 14.x | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: '14.x' | ||
|
||
- name: Build application with npm | ||
run: | | ||
npm ci | ||
npm run-script build | ||
- name: Build and push docker image to Docker Hub | ||
uses: docker/build-push-action@v5 | ||
with: | ||
# Set the context to use the current directory and not execute it's own git checkout. | ||
context: . | ||
push: true | ||
# Tag the images using the tagname and also latest. | ||
tags: | | ||
lfenergy/compas-open-scd:${{ steps.extract_tagname.outputs.tagname }} | ||
lfenergy/compas-open-scd:latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,3 +20,6 @@ | |
/_site/ | ||
/build/ | ||
/out-tsc/ | ||
|
||
/public/cim/ | ||
!/public/cim/README.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
<!-- | ||
SPDX-FileCopyrightText: 2021 Alliander N.V. | ||
SPDX-License-Identifier: Apache-2.0 | ||
--> | ||
|
||
# Development for CoMPAS OpenSCD | ||
|
||
## Building | ||
|
||
If you want to build CoMPAS OpenSCD yourself in order to make some changes to your local installation or to contribute | ||
to the project, you may first want to install [Node.js](https://nodejs.org/) in order to be able to use our local | ||
development setup. | ||
|
||
Once Node.js is installed on your system, you may get started by entering the following lines in your command prompt: | ||
|
||
``` | ||
git clone https://github.com/com-pas/compas-open-scd | ||
cd compas-open-scd | ||
npm install | ||
npm start | ||
``` | ||
|
||
This will start a local development server and open a browser window which will automatically be reloaded as soon as you | ||
save any changes to your local source code files. | ||
|
||
## Linting & Formatting | ||
|
||
If you use VSCode to develop, we recommend you install and use | ||
the [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) | ||
and [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) extensions in order to | ||
automatically lint and format your code as you edit it. There are similar plugins available for | ||
using [ESLint](https://eslint.org/) and [Prettier](https://prettier.io/) from within other IDEs and text editors. | ||
|
||
## TypeDoc | ||
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/). | ||
|
||
## Scripts | ||
|
||
We provide the following `npm` scripts for your convenience: | ||
|
||
- `npm start` runs `CoMPAS OpenSCD` for development, reloading on file changes | ||
- `npm test` runs the test suite with Web Test Runner | ||
- `npm run lint` runs the linter (fixes problems in your code) | ||
- `npm run format` runs the formatter (formats your code in a unified way) | ||
- `npm run doc` builds HTML documentation into the `doc` directory | ||
- `npm run build` builds a deployable version of the project into the `build` directory | ||
|
||
## Docker | ||
|
||
It's also possible to run CoMPAS OpenSCD as a docker. Of every release a docker image is created and pushed to Docker | ||
Hub. To run the docker container use the following command. | ||
|
||
``` | ||
docker run -it --rm -d -p 8080:8080 --name compas-open-scd lfenergy/compas-open-scd:latest | ||
``` | ||
|
||
Now open a browser and go to "http://localhost:8080". CoMPAS OpenSCD is shown. | ||
|
||
## CoMPAS Service | ||
|
||
During development, it is sometimes handy to use running backend services, like CIM Mapping or SCL Data Service. | ||
The problem is that these services need an Authorization Header to work. Normally these are injected by a reverse proxy | ||
or something like that. | ||
|
||
There is a work-around and that is using the ModHeader Extension of the Browser (Chrome, Firefox, ...). | ||
With this extension the header 'Authorization' can be added with a value 'Bearer <access token>'. | ||
|
||
![ModHeader Screenshot](ModHeader.png) | ||
|
||
URL Filters is used to only send this Request Header to the configured URLs. | ||
|
||
To retrieve an Access Token from a running KeyCloak instance there is a Postman collection, see below. | ||
|
||
### CoMPAS Services depends on a running KeyCloak instance | ||
|
||
A KeyCloak instance needs to be running on port 8089 by default in dev mode. If a custom KeyCloak instance is used see | ||
[Security](README.md#security) for more details. | ||
|
||
There is a preconfigured Demo KeyCloak instance available for CoMPAS in the | ||
[CoMPAS Deployment Repository](https://github.com/com-pas/compas-deployment). This repository can be cloned and | ||
used to execute the following commands to create a local Docker Image with the CoMPAS Demo configuration. | ||
|
||
```shell | ||
cd <CoMPAS Deployment Repository Directory>/compas/keycloak | ||
docker build -t compas_keycloak . | ||
``` | ||
|
||
A Docker Image `compas_keycloak` is created that can be started using the following command | ||
|
||
```shell | ||
docker run --rm --name compas_keycloak \ | ||
-p 8089:8080 | ||
-d compas_keycloak:latest | ||
``` | ||
|
||
There are now 3 users available to be used, `scl-data-editor`, `scl-data-reader`, `scd-reader`. See | ||
[CoMPAS Deployment Repository](https://github.com/com-pas/compas-deployment) for more information about the users. | ||
|
||
### Postman | ||
|
||
To make a call to the CoMPAS Backend Service work in CoMPAS OpenSCD we need to import an environment and authorisation | ||
collection. These files can be found in [CoMPAS Deployment Repository](https://github.com/com-pas/compas-deployment) | ||
in the directory `postman` (`auth.collection.json` and `local.environment.json`). | ||
|
||
In the authorisation collection there are called for the 3 users known within the Demo KeyCloak instance. | ||
If one of these calls are executed you can switch to the tab `Visualize`. There is a button to copy the bearer to the | ||
clipboard. This will also be done automatically when switching to the tab (label becomes `Copied!`). | ||
The value of the clipboard can be copied in ModHeader Extension as Authorization Header. | ||
|
||
Hint: `Bearer` is included in the value of the clipboard, so the complete value in ModHeader can be replaced. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FROM bitnami/nginx:1.25.2 | ||
COPY build/. /app/ | ||
|
||
VOLUME /opt/bitnami/nginx/conf/server_blocks/ | ||
VOLUME /app/public/cim | ||
VOLUME /app/public/conf | ||
VOLUME /app/public/nsdoc |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.