Skip to content

Commit

Permalink
Merge pull request #71 from eclipse-mnestix/staging-fix
Browse files Browse the repository at this point in the history
Release 1.3.3
  • Loading branch information
GailMelanie authored Jan 17, 2025
2 parents 9afd544 + b63768f commit e13022d
Show file tree
Hide file tree
Showing 98 changed files with 2,303 additions and 709 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @GailMelanie @hofermo @JonathanXITASO @pawel-baran-se @XAlinaGS @Xmilofranke @NilsXitaso
17 changes: 0 additions & 17 deletions .github/workflows/autoAddReviewer.yaml

This file was deleted.

129 changes: 103 additions & 26 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,66 +2,143 @@ name: Docker

on:
push:
branches: [ '**' ]
branches: [ 'main', 'dev', 'staging' ]
tags: [ 'v*.*.*' ]
pull_request:
branches: [ '**' ]
branches: [ 'main', 'dev', 'staging' ]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
# github.repository as <account>/<repo>
IMAGE_NAME: mnestix-browser
IMAGE_TAG: latest
# Update the version manually
IMAGE_TAG_VERSION: 1.3.2
IMAGE_TAG_VERSION: 1.3.3
REGISTRY_USER: ${{ secrets.DOCKER_USERNAME }}
REGISTRY_PASS: ${{ secrets.DOCKER_API_TOKEN }}

jobs:
default:
name: build, test and push image
unit-tests:
name: Unit Tests
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Extract branch name
id: extract_branch
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT

- name: Checkout repository
uses: actions/checkout@v4

# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into docker hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ env.REGISTRY_USER }}
password: ${{ env.REGISTRY_PASS }}

- name: Test units
- name: Run unit tests
id: test_units
run: yarn install && npx jest

build-browser-image:
name: Build browser image
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Build image
id: build
run: docker compose build mnestix-browser

- name: E2E test
- name: Save mnestix-browser image
run: docker save mnestix/mnestix-browser:latest -o mnestix-browser.tar

- name: Upload mnestix-browser artifact
uses: actions/upload-artifact@v4
with:
retention-days: 1
name: mnestix-browser
path: mnestix-browser.tar

e2e-tests:
name: e2e test matrix
runs-on: ubuntu-latest
needs: [ 'build-browser-image' ]
permissions:
contents: read
strategy:
fail-fast: false
matrix:
# add more containers to run more tests in parallel
containers: [ 1, 2, 3, 4 ]

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Download mnestix-browser artifact
uses: actions/download-artifact@v4
with:
name: mnestix-browser

- name: Load mnestix-browser image
run: docker load -i mnestix-browser.tar

# image too big to be reused
- name: prepare tests
run: |
docker compose -f compose.yml -f docker-compose/compose.test.yml --profile tests build cypress-test
docker compose -f compose.yml -f docker-compose/compose.test.yml --profile tests pull
- name: Run e2e tests
id: test
run: docker compose -f compose.yml -f docker-compose/compose.test.yml --profile tests up -d &&
run: |
docker compose -f compose.yml -f docker-compose/compose.test.yml --profile tests up -d &&
docker compose -f compose.yml -f docker-compose/compose.test.yml attach cypress-test
env:
SPLIT: ${{ strategy.job-total }}
SPLIT_INDEX: ${{ strategy.job-index }}

- name: E2E test collect artifact
id: test_artifact
if: always()
uses: actions/upload-artifact@master
uses: actions/upload-artifact@v4
with:
name: cypress-artifacts
name: cypress-artifacts-${{ matrix.containers }}
path: cypress-artifacts/

push-image:
name: Push image to registry
needs: [ 'build-browser-image', 'unit-tests', 'e2e-tests' ]
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/dev'
permissions:
contents: read
packages: write

steps:
- name: Extract branch name
id: extract_branch
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT

- name: Checkout repository
uses: actions/checkout@v4

- name: Download mnestix-browser artifact
uses: actions/download-artifact@v4
with:
name: mnestix-browser

- name: Load mnestix-browser image
run: docker load -i mnestix-browser.tar

# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into docker hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ env.REGISTRY_USER }}
password: ${{ env.REGISTRY_PASS }}

- name: Push Image to Production
id: push-prod
if: github.ref == 'refs/heads/main'
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,9 @@ NEXTAUTH_SECRET: '<<YOUR_SECRET>>'
**Mnestix Browser on port 3000 - http://localhost:3000**
<br><br>
- **docker-compose/compose.frontend.yml** - runs Mnestix Browser with a Basyx environment (AAS-Environment with MongoDB, Discovery Service, AAS/Submodel Registry) but without the Mnestix-API.<br>
**Mnestix Browser on port 3000 - http://localhost:3000**
- **docker-compose/compose.dev.yml** - override file to run Mnestix Browser in a development environment. A development
image will be built if it is not found in the local Docker Image Cache.<br>
**Mnestix Browser on port 3000 - http://localhost:3000** <br>
Expand Down Expand Up @@ -416,7 +419,7 @@ MNESTIX_BACKEND_API_URL: '{{MNESTIX_BACKEND_API_URL}}'
This is the easiest configuration, for when you only want to visualize and browse through AAS.
If you choose to run the Mnestix Browser without the Mnestix API, the Feature Flags `AUTHENTICATION_FEATURE_FLAG`
and `AAS_LIST_FEATURE_FLAG` will be overwritten to `false` as these Features use the functionality of the API.
The other environment variables should be configured [as described](#frontend-configuration).
The other environment variables should be configured [as described](#frontend-configuration). If you want to run Mnestix Browser with an Basyx environment you can simply use the compose.frontend file which is described [here](#Docker-Compose-files).

#### How to configure the BaSyx AAS Repository

Expand Down
3 changes: 2 additions & 1 deletion compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ services:
AAS_REPO_API_URL: 'http://mnestix-api:5064/repo'
SUBMODEL_REPO_API_URL: 'http://mnestix-api:5064/repo'
MNESTIX_BACKEND_API_URL: 'http://mnestix-api:5064'
MNESTIX_BACKEND_API_KEY: ${MNESTIX_BACKEND_API_KEY:-verySecureApiKey}
AAS_LIST_FEATURE_FLAG: "true"
AAS_LIST_V2_FEATURE_FLAG: "false"
TRANSFER_FEATURE_FLAG: "false"
Expand All @@ -41,7 +42,7 @@ services:
- mnestix-database:/app/prisma/database

mnestix-api:
image: mnestix/mnestix-api:1.2.4
image: mnestix/mnestix-api:1.2.5
container_name: mnestix-api
profiles: [ "", "backend", "tests" ]
ports:
Expand Down
5 changes: 5 additions & 0 deletions cypress.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { defineConfig } from 'cypress';
import * as dotenv from 'dotenv';
import cypressSplit from 'cypress-split';

dotenv.config();

Expand All @@ -21,6 +22,10 @@ export default defineConfig({
excludeSpecPattern: '**/ignoredTestFiles/*.js',
specPattern: 'cypress/e2e/**/*.spec.{js,jsx,ts,tsx}',
experimentalRunAllSpecs: true,
setupNodeEvents(on, config) {
cypressSplit(on, config);
return config;
},
},
env: {
AAS_REPO_API_URL: 'http://localhost:5064/repo',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import resolutions from '../fixtures/resolutions.json';
// intentionally named a_ to run this test in first batch
import resolutions from '../fixtures/resolutions.json';
import testAAS from '../fixtures/testAAS.json';
import AASBomComponent from '../fixtures/cypress_e2e/cyTestAas_BoM_Component.json';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import resolutions from '../fixtures/resolutions.json';
// intentionally named z_ to run this test in last batch
import resolutions from '../fixtures/resolutions.json';
import compareAAS from '../fixtures/cypress_e2e/CompareMockData/cy_compareAas.json';

describe('Test compare feature view', function () {
Expand Down Expand Up @@ -163,28 +164,23 @@ describe('Test compare feature view', function () {

it('Clicking the image of an AAS in compare view redirects to the detail page', function () {
cy.setResolution(resolutions[0]);

// go to compare view with all three test data
const url = `/compare?aasId=${compareAAS[0].id}&aasId=${compareAAS[1].id}&aasId=${compareAAS[2].id}`;
cy.visit(url);
cy.getByTestId('compare-aas-2').should('be.visible');

// click second image
cy.getByTestId('compare-aas-1')
.findByTestId('image-with-fallback')
.click();

cy.getByTestId('compare-aas-1').findByTestId('image-with-fallback').click();

// check if url is correct
const b64Url = btoa(compareAAS[1].id)
.replace(/=*$/, '');
const b64Url = btoa(compareAAS[1].id).replace(/=*$/, '');
cy.url().should('contain', `/viewer/${b64Url}`);

// check if loaded aas id is correct
cy.getByTestId('aas-data')
.findByTestId('data-row-value')
.should('contain', compareAAS[1].id);
cy.getByTestId('aas-data').findByTestId('data-row-value').should('contain', compareAAS[1].id);
});

after(function () {
cy.deleteCompareMockData();
});
Expand Down
Loading

0 comments on commit e13022d

Please sign in to comment.