Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .config-dev

This file was deleted.

5 changes: 2 additions & 3 deletions .config-local
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
API_ROOT:http://localhost:5030/api
API_ROOT_AUTH:http://localhost:5002/api/auth
LINK_TO_DOCUMENTS_SERVICE:/
API_ROOT_URL:http://localhost:5030/api/documents
AUTH_API_ROOT_URL:http://localhost:5002/api/auth
5 changes: 2 additions & 3 deletions .env-vars
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
API_ROOT
API_ROOT_AUTH
LINK_TO_DOCUMENTS_SERVICE
API_ROOT_URL
AUTH_API_ROOT_URL
11 changes: 11 additions & 0 deletions .github/workflows/.reusable-docker-build-and-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Publish Docker image

on:
# to allow to wait for a docker image to be published to proceed in another workflow
workflow_call:

jobs:
push-to-registry:
uses: TourmalineCore/inner-circle-github-workflows/.github/workflows/.reusable-docker-build-and-push.yml@master
# without this it cannot login to the registry
secrets: inherit
28 changes: 28 additions & 0 deletions .github/workflows/.reusable-install-cypress.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Install cypress

on:
# to allow to wait for a cypress install to proceed in another workflow
workflow_call:

jobs:
install-cypress:
runs-on: ubuntu-24.04
container:
image: cypress/browsers:node-22.18.0-chrome-138.0.7204.183-1-ff-141.0-edge-138.0.3351.121-1
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Cypress install
uses: cypress-io/github-action@v5
with:
runTests: false
build: npm run build

- name: Save dist folder
uses: actions/upload-artifact@v4
with:
name: dist
if-no-files-found: error
path: dist

80 changes: 0 additions & 80 deletions .github/workflows/commit-check.yml

This file was deleted.

32 changes: 32 additions & 0 deletions .github/workflows/component-tests-on-pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Component Tests

on:
pull_request:
types: [opened, synchronize, reopened]

jobs:
install-cypress:
uses: ./.github/workflows/.reusable-install-cypress.yml

component_test:
runs-on: ubuntu-24.04
container: cypress/browsers:node-22.18.0-chrome-138.0.7204.183-1-ff-141.0-edge-138.0.3351.121-1
strategy:
fail-fast: false
needs: install-cypress
steps:
- name: Checkout ui
uses: actions/checkout@v4

- name: Download the dist folders
uses: actions/download-artifact@v4
with:
name: dist
path: dist

- name: Cypress run component tests
uses: cypress-io/github-action@v6
with:
component: true
start: npm start
browser: electron
31 changes: 31 additions & 0 deletions .github/workflows/deploy-to-prod-from-default.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Deploy to Prod

on:
push:
branches:
- master

jobs:
# this is needed to wait for the new docker image to be build and published to the registry
# so that we can use the image to run ui of the needed commit related version as part of local-env
# the idea is taken from here https://stackoverflow.com/a/71489231
push-to-registry:
uses: ./.github/workflows/.reusable-docker-build-and-push.yml
# without this it cannot login to the registry
secrets: inherit

deploy-to-prod:
name: Deploy service to k8s for prod environment
needs: [push-to-registry]
runs-on: self-hosted
steps:
- name: Check out the repo
uses: actions/checkout@v4

- name: Deploy
run: |
helmfile cache cleanup && helmfile apply --suppress-diff --namespace "${{ secrets.INNER_CIRCLE_PROD_NAMESPACE }}" -f ci/helmfile.yaml \
--state-values-set image.tag="sha-${{ github.sha }}" \
--state-values-set ingress.hostname="${{ secrets.INNER_CIRCLE_PROD_HOSTNAME }}" \
--state-values-set extraConfigMapEnvVars.API_ROOT_URL="${{ secrets.INNER_CIRCLE_PROD_DOCUMENTS_API_ROOT_URL }}" \
--state-values-set extraConfigMapEnvVars.AUTH_API_ROOT_URL="${{ secrets.INNER_CIRCLE_PROD_AUTH_API_ROOT_URL }}" > /dev/null 2>&1
32 changes: 32 additions & 0 deletions .github/workflows/lint-on-pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Lint

on:
pull_request:
types: [opened, synchronize, reopened]

jobs:
lint:
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Node.js 22.18.0
uses: actions/setup-node@v3
with:
node-version: 22.18.0

- name: Cache dependencies
uses: actions/cache@v3
id: node_modules
with:
path: |
**/node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/package-lock.json') }}

- name: Install dependencies
run: npm i

- name: Check linting
run: npm run lint
continue-on-error: false
48 changes: 0 additions & 48 deletions .github/workflows/prod-docker-publish.yml

This file was deleted.

2 changes: 1 addition & 1 deletion ci/env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ do
value=$(printf '%s\n' "${!line}")

# Append configuration property to JS file
echo " $varname: $value," >> ./env-config.js
echo " $varname: \"$value\"," >> ./env-config.js
done < .env-vars

echo "}" >> ./env-config.js
21 changes: 21 additions & 0 deletions ci/helmfile.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
repositories:
- name: bitnami
url: https://mirror.yandex.ru/helm/charts.bitnami.com

releases:
- name: inner-circle-documents-ui
labels:
app: inner-circle-documents-ui
wait: true
chart: bitnami/nginx
# after 15.3.5 our docker file or setup can no longer start, need to investigate what is wrong for the newer versions
version: 15.3.5
values:
- values.yaml
- image:
tag: "{{ .StateValues.image.tag }}"
- ingress:
hostname: "{{ .StateValues.ingress.hostname }}"
- extraConfigMapEnvVars:
API_ROOT_URL: "{{ .StateValues.extraConfigMapEnvVars.API_ROOT_URL }}"
AUTH_API_ROOT_URL: "{{ .StateValues.extraConfigMapEnvVars.AUTH_API_ROOT_URL }}"
2 changes: 1 addition & 1 deletion ci/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

image:
registry: ghcr.io
repository: tourmalinecore/inner-circle/documents
repository: tourmalinecore/inner-circle-documents-ui
tag: "latest"
pullPolicy: Always
debug: true
Expand Down
5 changes: 1 addition & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
"private": true,
"homepage": "/documents",
"scripts": {
"start": "npm run create-config:dev && vite --host",
"start:local": "npm run create-config:local && vite --host",
"start": "npm run create-config:local && vite --host",
"start-local-env": "vite --host --mode local-env",
"build": "tsc && vite build",
"docker:build": "docker build -t inner-circle-documents-ui .",
Expand All @@ -15,9 +14,7 @@
"lint-eslint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"lint-ts": "tsc --noEmit",
"preview": "vite preview",
"create-config:dev": "node local-config-builder dev",
"create-config:local": "node local-config-builder local",
"test": "run-s cypress:run:component",
"cypress:open": "cypress open",
"cypress:open:component": "cypress open --component --browser electron",
"cypress:run:component": "cypress run --component --browser electron"
Expand Down
4 changes: 2 additions & 2 deletions src/common/api.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import axios from 'axios'
import { API_ROOT } from './config/config'
import { API_ROOT_URL } from './config/config'

import { initApiInterceptors } from './api/initApiInterceptors'

export const api = axios.create({
baseURL: API_ROOT,
baseURL: API_ROOT_URL,
})

initApiInterceptors(api)
4 changes: 2 additions & 2 deletions src/common/authService.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { createAuthService } from '@tourmalinecore/react-tc-auth'
import { API_ROOT_AUTH } from './config/config'
import { AUTH_API_ROOT_URL } from './config/config'

export const authService = createAuthService({
authApiRoot: API_ROOT_AUTH,
authApiRoot: AUTH_API_ROOT_URL,
authType: `ls`,
tokenAccessor: `accessToken`,
refreshTokenAccessor: `refreshToken`,
Expand Down
5 changes: 2 additions & 3 deletions src/common/config/config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
export const {
API_ROOT,
API_ROOT_AUTH,
LINK_TO_DOCUMENTS_SERVICE,
API_ROOT_URL,
AUTH_API_ROOT_URL,
} = window.__ENV__
Loading
Loading