Skip to content

Commit f0ec113

Browse files
Merge pull request #74 from NFDI4Chem/development
Development
2 parents 7aad137 + b804a18 commit f0ec113

30 files changed

Lines changed: 401184 additions & 6339 deletions

.eslintrc.json

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@
5656
"import/prefer-default-export":"off",
5757
"react/prop-types":"off",
5858
"react/no-unknown-property": ["error", { "ignore": ["css"] }]
59+
60+
5961

6062

6163
},
@@ -65,5 +67,14 @@
6567

6668
}
6769
}
68-
}
70+
},
71+
"overrides": [
72+
{
73+
"files":["src/*.json"],
74+
"rules":{
75+
"no-unused-expressions": "off"
76+
}
77+
78+
}
79+
]
6980
}

.github/workflows/dev-build.yml

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
# This worklflow will perform following actions when the code is pushed to development branch:
2+
# - Run end to end test.
3+
# - Check Linting.
4+
# - Build the latest docker image in development which needs both e2etest and lint to pass first.
5+
# - Push the latest docker image to Google Artifact Registry-Dev.
6+
# - Rollout the latest image in GKE.
7+
#
8+
# Maintainers:
9+
# - name: Nisha Sharma
10+
# - email: nisha.sharma@uni-jena.de
11+
12+
name : Build and Deploy to Dev
13+
14+
on:
15+
push:
16+
branches: [development]
17+
18+
env:
19+
PROJECT_ID: ${{ secrets.GKE_PROJECT }}
20+
GKE_CLUSTER_DEV: nmrxiv-dev
21+
GKE_ZONE: europe-west3-a
22+
DEPLOYMENT_NAME: nmrxiv-nmrium
23+
REPOSITORY_NAME_DEV: nmrxiv-dev
24+
IMAGE: nmrium
25+
26+
jobs:
27+
e2etest:
28+
runs-on: ubuntu-latest
29+
strategy:
30+
matrix:
31+
project: [chromium, firefox, webkit]
32+
fail-fast: false
33+
steps:
34+
- uses: actions/checkout@v3
35+
- uses: actions/setup-node@v3
36+
with:
37+
node-version: 16.x
38+
- name: Install dependencies
39+
run: npm ci
40+
- name: Install Playwright
41+
run: npx playwright install --with-deps
42+
- name: Build test application
43+
env:
44+
NODE_OPTIONS: '--max_old_space_size=4096'
45+
run: npm run build-no-minify
46+
- name: Run E2E tests on ${{ matrix.project }}
47+
run: npx playwright test --project ${{ matrix.project }}
48+
continue-on-error: ${{ matrix.project == 'webkit' }}
49+
50+
lint:
51+
runs-on: ubuntu-latest
52+
steps:
53+
- uses: actions/checkout@v2
54+
- uses: actions/setup-node@v2
55+
with:
56+
node-version: 16.x
57+
- name: Install dependencies
58+
run: npm ci
59+
- name: Run ESLint
60+
run: npm run eslint
61+
- name: Run Prettier
62+
run: npm run prettier
63+
- name: Check types
64+
run: npm run check-types
65+
66+
setup-build-publish-deploy-dev:
67+
name: Deploy to dev
68+
if: github.ref == 'refs/heads/development'
69+
runs-on: ubuntu-latest
70+
needs: [lint, e2etest]
71+
steps:
72+
- name: Checkout
73+
uses: actions/checkout@v2
74+
75+
# Setup gcloud CLI
76+
- name: Setup CLI
77+
uses: google-github-actions/setup-gcloud@94337306dda8180d967a56932ceb4ddcf01edae7
78+
with:
79+
service_account_key: ${{ secrets.GKE_SA_KEY }}
80+
project_id: ${{ secrets.GKE_PROJECT }}
81+
82+
# Configure docker to use the gcloud command-line tool as a credential helper
83+
- name: Configure docker
84+
run: |-
85+
gcloud auth configure-docker europe-west3-docker.pkg.dev
86+
87+
# Get the GKE credentials so we can deploy to the cluster
88+
- name: Get GKE credentials
89+
uses: google-github-actions/get-gke-credentials@v0.3.0
90+
with:
91+
cluster_name: ${{ env.GKE_CLUSTER_DEV }}
92+
location: ${{ env.GKE_ZONE }}
93+
credentials: ${{ secrets.GKE_SA_KEY }}
94+
95+
# Build the Docker image
96+
- name: Build docker image
97+
run: |-
98+
docker build -f Dockerfile.prod --tag europe-west3-docker.pkg.dev/$PROJECT_ID/$REPOSITORY_NAME_DEV/$IMAGE:latest .
99+
100+
# Push the Docker image to Google Artifact Registry
101+
- name: Publish image to Google Artifact Registry
102+
run: |-
103+
docker push "europe-west3-docker.pkg.dev/$PROJECT_ID/$REPOSITORY_NAME_DEV/$IMAGE:latest"
104+
105+
# Deploy the latest Docker image to the GKE cluster
106+
- name: Deploy
107+
run: |-
108+
kubectl rollout restart deployment/$DEPLOYMENT_NAME
109+
kubectl rollout status deployment/$DEPLOYMENT_NAME --timeout=300s
110+
kubectl get services -o wide

.github/workflows/e2e.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: E2E tests
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
e2e:
9+
runs-on: ubuntu-latest
10+
strategy:
11+
matrix:
12+
project: [chromium, firefox, webkit]
13+
fail-fast: false
14+
steps:
15+
- uses: actions/checkout@v3
16+
- uses: actions/setup-node@v3
17+
with:
18+
node-version: 18.x
19+
- name: Install dependencies
20+
run: npm ci
21+
- name: Install Playwright
22+
run: npx playwright install --with-deps
23+
- name: Build test application
24+
run: npm run build-no-minify
25+
- name: Run E2E tests on ${{ matrix.project }}
26+
run: npx playwright test --project ${{ matrix.project }}
27+
continue-on-error: ${{ matrix.project == 'webkit' }}
28+
- name: Upload test results
29+
if: always()
30+
uses: actions/upload-artifact@v3
31+
with:
32+
name: test-results-${{ matrix.project }}
33+
path: test-results
34+

Dockerfile.dev

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# build environment
2+
FROM node:18-alpine3.14 as build
3+
WORKDIR /app
4+
ENV PATH /app/node_modules/.bin:$PATH
5+
COPY package.json ./
6+
COPY package-lock.json ./
7+
RUN export NODE_OPTIONS=--max-old-space-size=8192
8+
RUN npm ci --silent
9+
RUN npm install react-scripts@latest -g --silent
10+
COPY . ./
11+
RUN npm run build
12+
13+
# production environment
14+
FROM nginx:stable-alpine
15+
COPY --from=build /app/build /usr/share/nginx/html
16+
COPY nginx/nginx.conf /etc/nginx/conf.d/default.conf
17+
EXPOSE 80
18+
CMD ["nginx", "-g", "daemon off;"]

Dockerfile.prod

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# build environment
22
FROM node:18-alpine3.14 as build
3+
4+
# ARG RELEASE_VERSION
5+
# ENV RELEASE_VERSION=${RELEASE_VERSION}
6+
37
WORKDIR /app
48
ENV PATH /app/node_modules/.bin:$PATH
59
COPY package.json ./
@@ -8,7 +12,8 @@ RUN export NODE_OPTIONS=--max-old-space-size=8192
812
RUN npm ci --silent
913
RUN npm install react-scripts@latest -g --silent
1014
COPY . ./
11-
RUN npm run build
15+
RUN npm run build -- --outDir=build
16+
RUN npm run build -- --outDir=build/releases/v0.0.1
1217

1318
# production environment
1419
FROM nginx:stable-alpine

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,18 @@ Upcoming: [https://nmrium.nmrxiv.org/releases/v1.0.0](https://nmrium.nmrxiv.org/
3131

3232
```
3333
<iframe href='https://nmriumdev.nmrxiv.org' height="500" width="100%"></iframe>
34+
35+
# Workspaces
36+
37+
# Simple NMR analysis
38+
<iframe href='https://nmriumdev.nmrxiv.org?workspace=default' height="500" width="100%"></iframe>
39+
40+
# NMR spectra assignment
41+
<iframe href='https://nmriumdev.nmrxiv.org?workspace=assignment' height="500" width="100%"></iframe>
42+
43+
# 1D multiple spectra analysis
44+
<iframe href='https://nmriumdev.nmrxiv.org?workspace=process1D' height="500" width="100%"></iframe>
45+
3446
```
3547

3648
## Public Instance

0 commit comments

Comments
 (0)