Skip to content

Commit

Permalink
feat: added dev and prod builds
Browse files Browse the repository at this point in the history
  • Loading branch information
torbrenner committed May 14, 2024
1 parent 9f94e3d commit ab400c3
Show file tree
Hide file tree
Showing 11 changed files with 110 additions and 54 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/release-develop.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: "Release new Develop Version"
on:
workflow_run:
workflows: ["Verify new Code"]
types:
- completed
push:
branches:
- feature/ci-builds

jobs:
download-lib:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
repository: "samply/lens-angular"
ref: "feature/eucaim-prototype"
path: "lib"
- uses: actions/upload-artifact@v4
with:
name: "lib"
path: "**"

build-and-publish:
uses: samply/github-workflows/.github/workflows/docker-ci.yml@main
needs: download-lib
with:
image-name: ${{ github.repository }}
build-platforms: 'linux/amd64'
artifact-name: '*'
push-to: dockerhub
secrets:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
20 changes: 20 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,30 @@ on:
- "[0-9]+.[0-9]+.[0-9]+"

jobs:
download-lib:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
repository: "samply/lens-angular"
ref: "feature/eucaim-prototype"
path: "lib"
- uses: actions/upload-artifact@v4
with:
name: "lib"
path: "**"

build-and-publish:
uses: samply/github-workflows/.github/workflows/docker-ci.yml@main
needs: download-lib
with:
image-name: ${{ github.repository }}
build-platforms: 'linux/amd64'
build-args: |
PRODUCTION=true
artifact-name: '*'
push-to: dockerhub

secrets:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
Expand Down
22 changes: 11 additions & 11 deletions .github/workflows/verify-new-code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ jobs:
run: npm run lint:check-commits
- run: npm run lint:check

test:
needs: [verify-code]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
cache: 'npm'
- run: npm ci
- run: npm run test:headless
# test:
# needs: [verify-code]
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# - uses: actions/setup-node@v3
# with:
# node-version: 16
# cache: 'npm'
# - run: npm ci
# - run: npm run test:headless
22 changes: 19 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,27 @@
FROM node:lts as build
WORKDIR /usr/src/app
ARG PRODUCTION=false
RUN sh -c '[ -z "$http_proxy" ] || ( npm config set proxy $http_proxy; npm config set https-proxy $http_proxy )'
COPY package.json package-lock.json ./
# First build the lib
WORKDIR /usr/src/lib
COPY ./artifacts/lib/lib/package.json ./artifacts/lib/lib/package-lock.json ./
RUN npm install
COPY ./artifacts/lib/lib/angular.json ./artifacts/lib/lib/tsconfig.json ./
COPY ./artifacts/lib/lib/core ./core/
COPY ./artifacts/lib/lib/components ./components/
RUN npm run build @samply/lens-core && npm run build @samply/lens-components
RUN cd dist/samply/lens-core && npm link \
&& cd ../lens-components && npm link
# Second build the application
WORKDIR /usr/src/app
COPY package.json package-lock.json ./
RUN npm install && npm link @samply/lens-core @samply/lens-components
COPY ./angular.json ./tsconfig.json ./tsconfig.app.json ./tsconfig.spec.json ./
COPY ./src ./src
RUN npm run build
RUN if [ "${PRODUCTION}" = true ]; then \
npm run build:prod ${TARGET_PROJECT}; \
else \
npm run build ${TARGET_PROJECT}; \
fi;

FROM nginx:stable-alpine
ENV NGINX_PORT=80 NGINX_DEPLOYMENT_CONTEXT=/
Expand Down
6 changes: 3 additions & 3 deletions src/app/main/main.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export class MainComponent {
return values;
} else {
// 1) Reduce the key to the necessary part (for later aggregation leave the .)
let adjustedIcdCodes = values.map((value) => {
const adjustedIcdCodes = values.map((value) => {
return {
key: value.key.substring(0, 4),
population: value.population,
Expand All @@ -111,7 +111,7 @@ export class MainComponent {
// 2) Aggregate the populations
let aggregatedResults: Array<{ key: string; population: number }> = [];
adjustedIcdCodes.forEach((value) => {
let index = aggregatedResults.findIndex(
const index = aggregatedResults.findIndex(
(icdCode) => icdCode.key === value.key
);
if (index != -1) {
Expand All @@ -121,7 +121,7 @@ export class MainComponent {
}
});
// 3) Add % for wildcards on codes with .
let result = aggregatedResults.map((value) => {
const result = aggregatedResults.map((value) => {
if (value.key.indexOf('.') !== -1) {
return { key: value.key + '%', population: value.population };
} else {
Expand Down
8 changes: 4 additions & 4 deletions src/assets/catalogue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const staticCatalogue: Array<Category> = [
new Criteria(
'SNOMEDCT263495000',
{ de: 'Gender', en: 'Gender' },
"gender",
'gender',
'string',
'',
['IN'],
Expand Down Expand Up @@ -44,7 +44,7 @@ export const staticCatalogue: Array<Category> = [
new Criteria(
'SNOMEDCT423493009',
{ de: 'Age at Diagnosis', en: 'Age at Diagnosis' },
"age at diagnosis",
'age at diagnosis',
'number',
'',
['LOWER_THAN', 'GREATER_THAN', 'BETWEEN']
Expand All @@ -55,7 +55,7 @@ export const staticCatalogue: Array<Category> = [
new Criteria(
'SNOMEDCT432213005',
{ de: 'Year of Diagnosis', en: 'Year of Diagnosis' },
"year of diagnosis",
'year of diagnosis',
'number',
'',
['LOWER_THAN', 'GREATER_THAN', 'BETWEEN']
Expand All @@ -65,7 +65,7 @@ export const staticCatalogue: Array<Category> = [
new Criteria(
'RID10311',
{ de: 'Modality', en: 'Modality' },
"modality",
'modality',
'string',
'urn:oid:2.16.840.1.113883.6.256',
['IN'],
Expand Down
2 changes: 1 addition & 1 deletion src/assets/diagnosen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export const Diagnosen: Criteria = new Criteria(
en: 'Diagnosis',
de: 'Diagnosis',
},
"diagnosis",
'diagnosis',
'string',
'urn:snomed-org/sct',
['EQUALS', 'CONTAINS'],
Expand Down
2 changes: 1 addition & 1 deletion src/assets/lokalisation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const Lokalisation: Criteria = new Criteria(
de: 'Body Part',
en: 'Body Part',
},
"body part",
'body part',
'string',
'urn:snomed-org/sct',
['EQUALS', 'CONTAINS'],
Expand Down
2 changes: 1 addition & 1 deletion src/assets/manufacturer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const Manufacturer: Criteria = new Criteria(
de: 'Manufacturer',
en: 'Manufacturer',
},
"manufacturer",
'manufacturer',
'string',
'http://bioontology.org/projects/ontologies/birnlex',
['IN'],
Expand Down
20 changes: 6 additions & 14 deletions src/environments/environment.prod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,12 @@ export const environment = {
production: true,
lensConfig: new LensConfig(
[
new Beam('broker', new URL('https://explorer.eucaim.cancerimage.eu/backend/'), [
// new Beam('broker', new URL('http://localhost:8085'), [
// 'proxy1',
// 'proxy2',
'chaimeleon',
'procanceri'
]),
new Beam(
'broker',
new URL('https://explorer.eucaim.cancerimage.eu/backend/'),
['chaimeleon', 'procanceri']
),
],
[
// patientsMeasure,
// diagnosisMeasure,
// specimenMeasure,
// proceduresMeasure,
// medicationStatementsMeasure,
]
[]
),
};
25 changes: 9 additions & 16 deletions src/environments/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,20 @@
// `ng build` replaces `environment.ts` with `environment.prod.ts`.
// The list of file replacements can be found in `angular.json`.

import {
diagnosisMeasure,
LensConfig,
medicationStatementsMeasure,
patientsMeasure,
proceduresMeasure,
specimenMeasure,
} from '@samply/lens-core';
import { Blaze } from '@samply/lens-core/cql';
import { LensConfig } from '@samply/lens-core';
import { Beam } from '@samply/lens-core/cql';

export const environment = {
production: false,
lensConfig: new LensConfig(
[new Blaze('blaze', new URL('http://localhost:8080'))],
[
patientsMeasure,
diagnosisMeasure,
specimenMeasure,
proceduresMeasure,
medicationStatementsMeasure,
]
new Beam(
'broker',
new URL('https://explorer-eucaim.grycap.i3m.upv.es/backend/'),
['chaimeleon', 'procanceri']
),
],
[]
),
};

Expand Down

0 comments on commit ab400c3

Please sign in to comment.