Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
demtario committed Mar 27, 2024
2 parents cd65a8a + e5dba00 commit 64160ef
Show file tree
Hide file tree
Showing 27 changed files with 308 additions and 171 deletions.
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/dist
/node_modules

.gitignore
README.md
10 changes: 7 additions & 3 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
VITE_API_URL=***REMOVED***
VITE_API_URL=https://api.example.com
VITE_BASE_URL=https://localhost:8080

VITE_SENTRY_URL=***REMOVED***
VITE_SENTRY_DISABLED=0
VITE_SENTRY_URL=
VITE_SENTRY_DISABLED=1
VITE_SENTRY_ENVIORNMENT=localhost

VITE_I18N_LOCALE=
VITE_I18N_FALLBACK_LOCALE=
35 changes: 35 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Run Docker image build and tag
on:
push:
tags:
- '*'
branches:
- master
- develop
- hotfix/*
- release/*
jobs:
run:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Create image tag
env:
IMAGE_TAG: '${{ github.ref_name }}'
run: echo "IMAGE_TAG=${IMAGE_TAG/\//-}" >> $GITHUB_ENV
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: heseya/admin:${{ env.IMAGE_TAG }}
20 changes: 20 additions & 0 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Run E2E tests

on: workflow_dispatch

jobs:
run:
runs-on: cypress/browsers:node16.5.0-chrome97-ff96
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Node 18
uses: actions/setup-node@v3
with:
node-version: 18
- name: Install dependencies
run: yarn install
- name: Install Cypress
run: yarn cypress install --force
- name: Run tests and collect coverage
run: yarn test:e2e --record --key ${{ secrets.CYPRESS_RECORD_KEY }}
30 changes: 30 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Run Linters
on: [push, pull_request]
jobs:
eslint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Node 18
uses: actions/setup-node@v3
with:
node-version: 18
- name: Install dependencies
run: yarn install
- name: Run tests and collect coverage
run: yarn lint:eslint
vue-tsc:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Node 18
uses: actions/setup-node@v3
with:
node-version: 18
- name: Install dependencies
run: yarn install
- name: Run tests and collect coverage
run: yarn lint:vue
continue-on-error: true
21 changes: 21 additions & 0 deletions .github/workflows/trigger.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Trigger external actions
on:
push:
branches:
- '*'
tags:
- '*'
jobs:
run:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Create image tag
env:
IMAGE_NAME: '${{ github.ref_name }}'
run: echo "IMAGE_NAME=${IMAGE_NAME/\//-}" >> $GITHUB_ENV
- name: curl
uses: enflo/curl-action@master
with:
curl: -X POST -F token=${{ secrets.TRIGGER_TOKEN }} -F ref=main -F variables[IMAGE_NAME]=${{ env.IMAGE_NAME }} -F variables[CI_BRANCH]=${{ github.ref_name }} ${{ vars.TRIGGER_URL }}
18 changes: 18 additions & 0 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Run tests and collect code coverage
on: [push, pull_request]
jobs:
run:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Node 18
uses: actions/setup-node@v3
with:
node-version: 18
- name: Install dependencies
run: yarn install
- name: Run tests
run: yarn test:unit
# - name: Upload coverage to Codecov
# uses: codecov/codecov-action@v3
79 changes: 0 additions & 79 deletions .gitlab-ci.yml

This file was deleted.

15 changes: 14 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,24 @@ FROM node:16-alpine as builder
WORKDIR /app
COPY / /app

ENV VITE_API_URL=https://api.example.com
ENV VITE_BASE_URL=https://localhost

ENV VITE_SENTRY_URL=
ENV VITE_SENTRY_DISABLED=1
ENV VITE_SENTRY_ENVIORNMENT=production

ENV VITE_I18N_LOCALE=pl
ENV VITE_I18N_FALLBACK_LOCALE=pl

RUN yarn install
RUN yarn build

FROM httpd
COPY --from=builder /app/dist/ /usr/local/apache2/htdocs/
COPY --from=builder /app/.htaccess /usr/local/apache2/htdocs/.htaccess
RUN sed -i '/LoadModule rewrite_module/s/^#//g' /usr/local/apache2/conf/httpd.conf
RUN sed -i 's/AllowOverride None/AllowOverride ALL/g' /usr/local/apache2/conf/httpd.conf
RUN sed -i 's/AllowOverride None/AllowOverride ALL/g' /usr/local/apache2/conf/httpd.conf

CMD sed -i "s#REPLACE_ME_API_URL#${VITE_API_URL}#g" ./htdocs/index.html; sed -i "s#REPLACE_ME_BASE_URL#${VITE_BASE_URL}#g" ./htdocs/index.html; sed -i "s#REPLACE_ME_SENTRY_URL#${VITE_SENTRY_URL}#g" ./htdocs/index.html; sed -i "s#REPLACE_ME_SENTRY_DISABLED#${VITE_SENTRY_DISABLED}#g" ./htdocs/index.html; sed -i "s#REPLACE_ME_SENTRY_ENVIORNMENT#${VITE_SENTRY_ENVIORNMENT}#g" ./htdocs/index.html; sed -i "s#REPLACE_ME_I18N_LOCALE#${VITE_I18N_LOCALE}#g" ./htdocs/index.html; sed -i "s#REPLACE_ME_I18N_FALLBACK_LOCALE#${VITE_I18N_FALLBACK_LOCALE}#g" ./htdocs/index.html; exec httpd-foreground

9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
build-image-prod:
docker build -t heseya/admin:latest .

compose-prod:
docker compose -f docker-compose.yml up --remove-orphans

start-prod:
make build-image-prod
make compose-prod
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,7 @@ We try to stick to the practices described in [Cypress documentation](https://do
| --------------------------------------------- | ------------------------------------------------------------------------------------------------ |
| `cy.dataCy(value: string)` | The equivalent of `cy.get()`, which automatically finds an element using its attribute `data-cy` |
| `cy.login(email?: string, password?: string)` | Automatically carries out the user login procedure. |

## License

[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fheseya%2Fadmin.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Fheseya%2Fadmin?ref=badge_large)
9 changes: 9 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: '3'
services:
heseya-admin:
image: heseya/admin:latest
restart: unless-stopped
ports:
- '127.0.0.1:3000:80'
env_file:
- ./.env
14 changes: 13 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,19 @@
<meta name="msapplication-TileImage" content="/img/mstile-150x150.png" />
<meta name="msapplication-TileColor" content="#8f022c" />
<script>
window.apiUrl = 'REPLACE_ME_API_URL'
window.runtimeConfig = {
apiUrl: 'REPLACE_ME_API_URL',
baseUrl: 'REPLACE_ME_BASE_URL',
i18n: {
locale: 'REPLACE_ME_I18N_LOCALE',
fallbackLocale: 'REPLACE_ME_I18N_FALLBACK_LOCALE',
},
sentry: {
url: 'REPLACE_ME_SENTRY_URL',
disabled: 'REPLACE_ME_SENTRY_DISABLED',
enviornment: 'REPLACE_ME_SENTRY_ENVIORNMENT',
},
}
</script>
</head>
<body>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "store-admin",
"version": "6.0.1",
"version": "6.0.2",
"private": true,
"description": "Admin panel for Heseya Store API",
"author": "Heseya",
Expand Down
2 changes: 1 addition & 1 deletion src/components/modules/products/ProductsFilter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ export const EMPTY_PRODUCT_FILTERS: ProductFilers = {
available: ALL_FILTER_VALUE,
/**
* this forces to show only public products by default
* TODO: maybe we should do this conditionally? (***REMOVED*** needs it)
* TODO: maybe we should do this conditionally?
*/
public: '1',
has_cover: ALL_FILTER_VALUE,
Expand Down
4 changes: 2 additions & 2 deletions src/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import pl from '@/locales/pl.json'
Vue.use(VueI18n)

export default new VueI18n({
locale: import.meta.env.VITE_I18N_LOCALE || accessor.config.uiLanguage || getDefaultUiLanguage(),
fallbackLocale: (import.meta.env.VITE_I18N_FALLBACK_LOCALE as string) || 'pl', // TODO: change to 'en' when all translations are done
locale: window.runtimeConfig.i18n.locale || accessor.config.uiLanguage || getDefaultUiLanguage(),
fallbackLocale: window.runtimeConfig.i18n.fallbackLocale,
messages: {
pl,
en,
Expand Down
13 changes: 13 additions & 0 deletions src/interfaces/RuntimeConfig.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export interface RuntimeConfig {
apiUrl: string
baseUrl: string
i18n: {
locale: string
fallbackLocale: string
}
sentry: {
url: string
disabled: string
enviornment: string
}
}
2 changes: 2 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import './plugins/runtimeConfig'

import Vue from 'vue'
import VueMeta from 'vue-meta'
import AntDesign from 'ant-design-vue'
Expand Down
Loading

0 comments on commit 64160ef

Please sign in to comment.