Skip to content

Commit

Permalink
Merge pull request #211 from virtualidentityag/release-2024-03-20
Browse files Browse the repository at this point in the history
release 2024-03-20
  • Loading branch information
web-mi authored Mar 20, 2024
2 parents 51471d1 + 8577159 commit 7131eaf
Show file tree
Hide file tree
Showing 412 changed files with 42,250 additions and 23,498 deletions.
36 changes: 35 additions & 1 deletion .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,38 @@ CSRF_WHITELIST_HEADER_FOR_LOCAL_DEVELOPMENT=X-WHITELIST-HEADER
#AUDIO_FILE_INCOMING_NOTIFICATION=/assets/audio/incomingNotification.mp3

# Disable 2FA
REACT_APP_DISABLE_2FA_DUTY=0
REACT_APP_DISABLE_2FA_DUTY=0

### Registration
# Enable fallback loader for direct link registration where slug could not be matched (0/1)
FRONTEND_REGISTRATION_USE_CONSULTINGTYPE_SLUG=

### Weblate
# Weblate host
FRONTEND_WEBLATE_HOST=
# Path to api
FRONTEND_WEBLATE_PATH=/weblate/api
# Name of weblate project
FRONTEND_WEBLATE_PROJECT=
# Weblate api key - Attention! if provided it will be used for frontend requests and is visible to everyone
FRONTEND_WEBLATE_API_KEY=
# Min percentage - percentage which must be translated in one language until it gets visible in the frontend
FRONTEND_WEBLATE_MIN_PERCENT=
# Disable localStorage caching
FRONTEND_TRANSLATION_CACHE_DISABLE=
# Time until frontend cache gets invalidated in minutes
FRONTEND_TRANSLATION_CACHE_TIME=

### NodeJS
# Storage path - if set relative to project root translation files will be stored temporary until LOCALIZATION_CACHE_TIME expired
STORAGE_PATH=./.storage

# Localize cache time - in minutes - default 120 minutes
LOCALIZATION_CACHE_TIME=

# Weblate host for proxy
LOCALIZATION_WEBLATE_HOST=https://weblate.example.com/
# If weblate is provided under subdirectory
LOCALIZATION_WEBLATE_PATH=/weblate
# Weblate api key - must be provided to skip request limits
LOCALIZATION_WEBLATE_API_KEY=
20 changes: 10 additions & 10 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ jobs:
else
echo ENV_NAME="prod" >> $GITHUB_ENV
fi
- uses: actions/checkout@v2.3.4
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 14
node-version: 18
registry-url: 'https://npm.pkg.github.com'
cache: 'npm'
- name: Load .env file
Expand All @@ -38,7 +38,7 @@ jobs:
mode: ${{ env.ENV_NAME }}
- run: npm ci
- name: Run linters
uses: wearerequired/lint-action@v1
uses: wearerequired/lint-action@v2
with:
github_token: ${{ secrets.github_token }}
eslint: true
Expand All @@ -48,22 +48,22 @@ jobs:
stylelint_dir: ./src
stylelint_extensions: scss
prettier: true
- name: Run build
run: |
npm run build
- name: Run tests
run: |
echo "127.0.0.1 localhost" | sudo tee -a /etc/hosts
echo "fs.inotify.max_user_watches=524288" | sudo tee -a /etc/sysctl.conf
npm run test
- name: Run build
run: |
npm run build
npm run test:build
- name: Bump version
if: startsWith(env.BRANCH,'release') == true
if: env.BRANCH == 'release'
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
npm run release
- name: Push changes
if: startsWith(env.BRANCH,'release') == true
if: env.BRANCH == 'release'
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
29 changes: 12 additions & 17 deletions .github/workflows/dockerImage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
FAIL_WEBHOOK_SECRET: ${{ secrets.MS_TEAMS_FAIL_WEBHOOK_URI }}
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: set env
run: |
RAW=$(git branch -r --contains ${{ github.ref }})
Expand All @@ -32,32 +32,32 @@ jobs:
else
echo ENV_NAME="prod" >> $GITHUB_ENV
fi
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 14
node-version: 18
cache: 'npm'
- name: Load .env file
uses: xom9ikk/dotenv@v2
with:
mode: ${{ env.ENV_NAME }}
- run: npm ci
- name: Run linters
uses: wearerequired/lint-action@v1
uses: wearerequired/lint-action@v2
with:
github_token: ${{ secrets.github_token }}
eslint: true
eslint_dir: ./src
eslint_extensions: js,ts,tsx
prettier: true
prettier_dir: ./src
- name: Run build
run: |
npm run build
- name: Run tests
run: |
echo "127.0.0.1 localhost" | sudo tee -a /etc/hosts
echo "fs.inotify.max_user_watches=524288" | sudo tee -a /etc/sysctl.conf
npm run test
- name: Run build
run: |
npm run build
npm run test:build
- uses: actions/upload-artifact@v2
with:
name: buildfiles
Expand All @@ -77,17 +77,14 @@ jobs:
- text: View CI
url: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
push_to_registry:
strategy:
matrix:
registry: ['docker.pkg.github.com', 'ghcr.io']
needs: [build]
name: Push Docker image to GitHub Packages
runs-on: ubuntu-latest
env:
IMAGE_WEBHOOK_SECRET: ${{ secrets.MS_TEAMS_IMAGE_WEBHOOK_URI }}
FAIL_WEBHOOK_SECRET: ${{ secrets.MS_TEAMS_FAIL_WEBHOOK_URI }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Download buildfiles artifact
uses: actions/download-artifact@v2
with:
Expand All @@ -104,8 +101,7 @@ jobs:
raw=$(git branch -r --contains ${{ github.ref }})
branch=${raw##*/}
echo BRANCH_NAME=$(echo -n "${branch}") >> $GITHUB_ENV
echo "MATRIX_REGISTRY=$(echo "${{ matrix.registry }}" | awk '{print tolower($0)}')" >> $GITHUB_ENV
echo "DOCKER_REGISTRY=$(echo "${{ matrix.registry }}/${{ github.repository }}" | awk '{print tolower($0)}')" >> $GITHUB_ENV
echo "DOCKER_REGISTRY=$(echo "ghcr.io/${{ github.repository }}" | awk '{print tolower($0)}')" >> $GITHUB_ENV
echo "DOCKER_IMAGE=$(echo "${{ github.repository }}" | awk -F / '{print tolower($2)}')" >> $GITHUB_ENV
echo "REPO_NAME_WITHOUT_PREFIX"=$(echo "${{ github.repository }}" | sed "s/.*\///" | awk -F / '{print tolower($0)}') >> $GITHUB_ENV
echo CLEAN_REF=$(echo "${GITHUB_REF_NAME#refs/heads/}") >> $GITHUB_ENV
Expand Down Expand Up @@ -145,7 +141,6 @@ jobs:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build_args: DOCKER_MATRIX=${{ env.MATRIX_REGISTRY }}
- name: Hint about the Docker Image Tag if successfull
if: ${{ success() }}
run: |
Expand All @@ -160,7 +155,7 @@ jobs:
echo "" >> $GITHUB_STEP_SUMMARY
echo "- It seems that something has gone wrong" >> $GITHUB_STEP_SUMMARY
- name: Microsoft Teams Fail Card
if: ${{ (env.FAIL_WEBHOOK_SECRET != null) && (env.FAIL_WEBHOOK_SECRET != '') && (matrix.registry == 'ghcr.io') && (failure() || cancelled()) }}
if: ${{ (env.FAIL_WEBHOOK_SECRET != null) && (env.FAIL_WEBHOOK_SECRET != '') && (failure() || cancelled()) }}
uses: toko-bifrost/[email protected]
with:
github-token: ${{ github.token }}
Expand All @@ -174,7 +169,7 @@ jobs:
- text: View CI
url: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
- name: Microsoft Teams Image Card
if: ${{ (env.IMAGE_WEBHOOK_SECRET != null) && (env.IMAGE_WEBHOOK_SECRET != '') && (matrix.registry == 'ghcr.io') && success() }}
if: ${{ (env.IMAGE_WEBHOOK_SECRET != null) && (env.IMAGE_WEBHOOK_SECRET != '') && success() }}
uses: toko-bifrost/[email protected]
with:
github-token: ${{ github.token }}
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

# dependencies
/node_modules
/proxy/node_modules
/.pnp
.pnp.js

Expand All @@ -12,6 +13,7 @@

# production
/build
/dist

# misc
.DS_Store
Expand All @@ -22,6 +24,7 @@
.env.test.local
.env.production.local
.idea
.storage

# cypress
browserstack.json
Expand Down
32 changes: 9 additions & 23 deletions .stylelintrc.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
const defaultConfig = require('@biotope/quality-gate/config/.stylelintrc');

module.exports = {
...defaultConfig,
extends: [
// TODO: From the admin app. Probably a good idea to enable.
// 'stylelint-config-idiomatic-order',

// The config from quality-gate isn't compatible with stylelint@^14,
// therefore merge it with working alternatives.
'stylelint-config-standard-scss',
'stylelint-config-prettier'
],
plugins: ['stylelint-scss', 'stylelint-no-unsupported-browser-features'],
extends: ['stylelint-config-standard', 'stylelint-config-standard-scss'],
rules: {
...defaultConfig.rules,
'selector-max-id': 0,
'scss/dollar-variable-colon-space-after': 'always-single-line',
'scss/dollar-variable-colon-space-before': 'never',
'plugin/no-unsupported-browser-features': [
true,
{
Expand All @@ -35,18 +27,13 @@ module.exports = {
'outline',
'css3-cursors',
'css-resize',
'intrinsic-width'
'intrinsic-width',
'css-nesting',
'css-when-else',
'css-selection'
]
}
],

// From admin app
'max-empty-lines': [
2,
{
ignore: ['comments']
}
],
'rule-empty-line-before': [
'always-multi-line',
{
Expand All @@ -56,7 +43,6 @@ module.exports = {

// Defaults are not good
'alpha-value-notation': 'number',
'number-leading-zero': 'always',
'color-function-notation': 'legacy',
'value-keyword-case': null, // Requires e.g. "robotoslab" instead of "RobotoSlab"
'scss/operator-no-unspaced': null, // Has false positives
Expand Down
52 changes: 48 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,48 @@
ARG DOCKER_MATRIX=ghcr.io
FROM $DOCKER_MATRIX/onlineberatung/onlineberatung-nginx/onlineberatung-nginx:dockerimage.v.001-main
COPY build /usr/share/nginx/html
COPY nginx.conf /etc/nginx/conf.d/default.conf
ARG NODE_VERSION=18.16.1
ARG PORT=80

FROM node:$NODE_VERSION AS proxyBuild

USER node
WORKDIR /app
COPY proxy /app

ENV NODE_ENV=development
ENV PORT=$PORT

# Currently nothing to build inside
# RUN npm run install
# RUN npm run build
# RUN rm /app/node_modules

###
# Build is done on github so no need for docker build
#FROM node:$NODE_VERSION as frontendBuild
#
#USER node
#WORKDIR /app
#COPY . /app
#
#ENV NODE_ENV=development
#ENV PORT=$PORT
#
#RUN npm install --ignore-scripts
#RUN npm run build

# Prod build
FROM node:$NODE_VERSION

ARG PORT=80

USER node
WORKDIR /app
EXPOSE $PORT
COPY --from=proxyBuild /app ./
COPY build /app/build

ENV NODE_ENV=production
ENV PORT=$PORT

RUN npm ci --ignore-scripts

CMD ["npm", "run", "start"]
2 changes: 2 additions & 0 deletions cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ if (!command) {
command = command.trim();

if (command === 'start') {
require('./proxy/server.js');
} else if (command === 'dev') {
require('./scripts/start');
} else if (command === 'build') {
require('./scripts/build');
Expand Down
1 change: 1 addition & 0 deletions config/env.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ function getClientEnvironment(publicUrl) {
);
// Stringify all values so we can feed into webpack DefinePlugin
const stringified = {
'process': {}, // This is the only line added to the previous method
'process.env': Object.keys(raw).reduce((env, key) => {
env[key] = JSON.stringify(raw[key]);
return env;
Expand Down
29 changes: 0 additions & 29 deletions config/jest/babelTransform.js

This file was deleted.

14 changes: 0 additions & 14 deletions config/jest/cssTransform.js

This file was deleted.

Loading

0 comments on commit 7131eaf

Please sign in to comment.