diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml new file mode 100644 index 0000000000000000000000000000000000000000..3786df80d8901d80c015a4621987b400f5348a56 --- /dev/null +++ b/.github/workflows/e2e.yml @@ -0,0 +1,59 @@ +name: e2e + +# on: +# pull_request: +# branches: +# - dev + +on: [push] + +env: + DOCKER_IMAGE_NAME: interactive-viewer + DOCKER_SAVE_FILENAME: iav.tar.gz + ARTEFACT_NAME: iav_docker_image + DOCKER_CONTAINER_NAME: github-actions-iav-dkr-container + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v1 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - name: build docker container + run: | + docker build --build-arg BACKEND_URL=${BACKEND_URL} -t ${DOCKER_IMAGE_NAME} . + env: + BACKEND_URL: http://localhost:3001 + - name: export docker image as an artefact + run: | + docker save ${DOCKER_IMAGE_NAME} -o ${DOCKER_SAVE_FILENAME} + - name: Upload docker image + uses: actions/upload-artifact@v1 + with: + name: ${{ env.ARTEFACT_NAME }} + path: ${{ env.DOCKER_SAVE_FILENAME }} + + test: + runs-on: self-hosted + steps: + - name: Download docker image artefact + uses: actions/upload-artifact@v1 + with: + name: ${{ env.ARTEFACT_NAME }} + run: | + docker load -i ${ARTEFACT_NAME}/${DOCKER_SAVE_FILENAME} + - uses: actions/checkout@v2 + with: + fetch-depth: 2 + repository: 'https://github.com/FZJ-INM1-BDA/iv-automated-tests.git' + - name: Install dependencies + run: | + npm i + - name: run docker container + run: docker run -p 3001:3000 --rm --name ${DOCKER_CONTAINER_NAME} -dit + - name: run pptr tests + run: node ./node_modules/.bin/mocha ./test/databrowser.spec.js --timeout 1800000 \ No newline at end of file diff --git a/.github/workflows/frontend.yml b/.github/workflows/frontend.yml index 70bced49b2ad5078b3062d299545379285996412..48755fe031d00a582cfa96298bb1dfac0b4e57e4 100644 --- a/.github/workflows/frontend.yml +++ b/.github/workflows/frontend.yml @@ -20,6 +20,7 @@ jobs: - name: npm install and test run: | npm i + npm run lint npm test env: NODE_ENV: test \ No newline at end of file diff --git a/src/main-aot.ts b/src/main-aot.ts index fa498f035dea25a705429a78775d9ed76dcb0674..6555323d09903fc1bd7e145c57749d76755e8e6c 100644 --- a/src/main-aot.ts +++ b/src/main-aot.ts @@ -1,19 +1,9 @@ -import 'zone.js' - -import 'third_party/testSafari.js' - import { enableProdMode } from '@angular/core'; -import { platformBrowserDynamic } from '@angular/platform-browser-dynamic' -import { MainModule } from './main.module'; - -const requireAll = (r: any) => {r.keys().forEach(r)} -requireAll(require.context('./res/ext', false, /\.json$/)) -requireAll(require.context('./res/images', true, /\.jpg$|\.png$|\.svg$/)) -requireAll(require.context(`./plugin_examples`, true)) -/* aot === production mode */ enableProdMode() -if (PRODUCTION) { this.log.log(`Interactive Atlas Viewer: ${VERSION}`) } +import './main-common' + +/* aot === production mode */ -platformBrowserDynamic().bootstrapModule(MainModule) +if (PRODUCTION) { console.log(`Interactive Atlas Viewer: ${VERSION}`) } diff --git a/src/main-common.ts b/src/main-common.ts new file mode 100644 index 0000000000000000000000000000000000000000..ab8bf78a4710915655b355607300ccb35ee63026 --- /dev/null +++ b/src/main-common.ts @@ -0,0 +1,16 @@ +import 'zone.js' + +import 'third_party/testSafari.js' + +import { defineCustomElements } from 'hbp-connectivity-component/dist/loader' +import { platformBrowserDynamic } from '@angular/platform-browser-dynamic' +import { MainModule } from './main.module'; + +const requireAll = (r: any) => {r.keys().forEach(r)} +requireAll(require.context('./res/ext', false, /\.json$/)) +requireAll(require.context('./res/images', true, /\.jpg$|\.png$|\.svg$/)) +requireAll(require.context(`./plugin_examples`, true)) + +platformBrowserDynamic().bootstrapModule(MainModule) + +defineCustomElements(window) diff --git a/src/main.ts b/src/main.ts index 309135b48da57e04375df53e7347ac20e6d9ee34..db15fd1bf13433719e854add306df7a39f49ca48 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,17 +1,2 @@ import 'reflect-metadata' -import 'zone.js' - -import 'third_party/testSafari.js' - -import { platformBrowserDynamic } from '@angular/platform-browser-dynamic' -import {defineCustomElements} from 'hbp-connectivity-component/dist/loader' -import { MainModule } from './main.module'; - -const requireAll = (r: any) => {r.keys().forEach(r)} -requireAll(require.context('./res/ext', false, /\.json$/)) -requireAll(require.context('./res/images', true, /\.jpg$|\.png$|\.svg$/)) -requireAll(require.context(`./plugin_examples`, true)) - -platformBrowserDynamic().bootstrapModule(MainModule) - -defineCustomElements(window) +import './main-common'