Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DOP-16647] Add Github actions #15

Merged
merged 22 commits into from
Jun 21, 2024
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
8d25949
[DOP-16647] Add Github actions
dmitry-pedchenko Jun 21, 2024
34ad6bc
[DOP-16647] Add Github actions
dmitry-pedchenko Jun 21, 2024
ae722ea
[DOP-16647] Add Github actions
dmitry-pedchenko Jun 21, 2024
7ba9872
[DOP-16647] Add Github actions
dmitry-pedchenko Jun 21, 2024
94c284a
[DOP-16647] Add Github actions
dmitry-pedchenko Jun 21, 2024
99d6df6
[DOP-16647] Add Github actions
dmitry-pedchenko Jun 21, 2024
a41ef49
[DOP-16647] Add Github actions
dmitry-pedchenko Jun 21, 2024
c1711fc
[DOP-16647] Add Github actions
dmitry-pedchenko Jun 21, 2024
2fcf6cb
[DOP-16647] Add Github actions
dmitry-pedchenko Jun 21, 2024
7129f8f
[DOP-16647] Add Github actions
dmitry-pedchenko Jun 21, 2024
8354623
[DOP-16647] Add Github actions
dmitry-pedchenko Jun 21, 2024
c5bafa7
[DOP-16647] Add Github actions
dmitry-pedchenko Jun 21, 2024
cc1f8ca
[DOP-16647] Add Github actions
dmitry-pedchenko Jun 21, 2024
6348269
[DOP-16647] Add Github actions
dmitry-pedchenko Jun 21, 2024
7e67a23
[DOP-16647] Add Github actions
dmitry-pedchenko Jun 21, 2024
4d93983
[DOP-16647] Add Github actions
dmitry-pedchenko Jun 21, 2024
fde9904
[DOP-16647] Add Github actions
dmitry-pedchenko Jun 21, 2024
71dbe14
[DOP-16647] Add Github actions
dmitry-pedchenko Jun 21, 2024
a5d2e95
[DOP-16647] Add Github actions
dmitry-pedchenko Jun 21, 2024
4074299
[DOP-16647] Add Github actions
dmitry-pedchenko Jun 21, 2024
c34efa2
[DOP-16647] Add Github actions
dmitry-pedchenko Jun 21, 2024
9e71ed4
[DOP-16647] Add Github actions
dmitry-pedchenko Jun 21, 2024
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
81 changes: 81 additions & 0 deletions .github/workflows/docker_image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Docker image

on:
push:
branches:
- develop
tags:
- "[0-9]+.[0-9]+.[0-9]+"
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true

jobs:
release:
name: Build & push backend image to Dockerhub
runs-on: ubuntu-latest
if: github.repository == 'MobileTeleSystems/syncmaster-ui' # prevent running on forks

steps:
- 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: Checkout code
uses: actions/checkout@v4

- name: Set tag
id: set_tag
run: |
if [[ "${{ github.ref_type }}" == "branch" && "${{ github.ref_name }}" == "develop" ]]; then
echo "TAG=mtsrus/syncmaster-ui:develop" >> $GITHUB_ENV
elif [[ "${{ github.ref_type }}" == "tag" ]]; then
echo "TAG=mtsrus/syncmaster-ui:latest,mtsrus/syncmaster-ui:${{ github.ref_name }}" >> $GITHUB_ENV
fi

- name: Build UI image
uses: docker/build-push-action@v6
with:
tags: ${{ env.TAG }}
context: .
target: prod
file: Dockerfile
pull: true
push: true
cache-to: type=inline
cache-from: mtsrus/syncmaster-ui:develop
platforms: |
linux/amd64
linux/arm64/v8
provenance: mode=max

- name: Convert README to Markdown
uses: docker://pandoc/core:2.9
with:
args: >-
--output=README.md
--from=rst
--to=gfm
--wrap=none
README.rst

- name: Update DockerHub Description
uses: peter-evans/dockerhub-description@v4
if: github.ref_type == 'tag'
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
# this requires token with read+write+delete permissions. read+write is not enough!
password: ${{ secrets.DOCKERHUB_TOKEN }}
repository: mtsrus/syncmaster-ui
short-description: ${{ github.event.repository.description }}
enable-url-completion: true
37 changes: 37 additions & 0 deletions .github/workflows/linters.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Code analysis

on:
push:
branches:
- develop
pull_request:
branches-ignore:
- master
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true

jobs:
linters:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install modules
run: npm ci
dolfinus marked this conversation as resolved.
Show resolved Hide resolved

- name: Cache modules
uses: actions/cache@v4
with:
path: ./node_modules
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
${{ runner.os }}-npm-

- name: Run ESLint
run: npx eslint .

- name: Run Prettier
run: npx prettier . --check
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx lint-staged
6 changes: 3 additions & 3 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"tabWidth": 4,
"useTabs": false,
"printWidth": 80
"tabWidth": 4,
"useTabs": false,
"printWidth": 80
}
38 changes: 0 additions & 38 deletions README.md

This file was deleted.

50 changes: 50 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
.. title
dmitry-pedchenko marked this conversation as resolved.
Show resolved Hide resolved

=============
SyncMaster UI
=============

This interface is designed to work with the SyncMaster service.
This interface contains 4 menu sections: Transfers, Connections, Queues, Groups.

To explore the source code, start with `src/App.tsx<https://github.com/MobileTeleSystems/syncmaster-ui/blob/develop/src/App.tsx>`_.

How to run
----------

After having cloned the SyncMaster repository, run the following commands at the root directory:

.. code-block:: shell
npm install --global yarn

yarn install

yarn build

yarn dev


These commands will install dependencies and launch the dev server, by going to localhost:3000 you can go to the SyncMaster_UI interface.

How to format code
------------------

Run the following command at the root directory:

.. code-block:: shell
npm run prettier-format


How to run linters
------------------

Run the following command at the root directory:

.. code-block:: shell
npx eslint --fix


Install pre-commit hooks
------------------------

Follow the instructions `here<https://prettier.io/docs/en/install>`_.
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
version: "3.8"
services:
syncmaster-ui:
image: syncmaster_ui
image: mtsrus/syncmaster-ui
build:
dockerfile: Dockerfile
context: .
network: host
target: prod
ports:
- 3000:3000
- 3000:3000
24 changes: 18 additions & 6 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
Expand Down Expand Up @@ -55,7 +55,7 @@
.loader:before,
.loader:after {
position: absolute;
content: '';
content: "";
}

.loader:before {
Expand Down Expand Up @@ -111,10 +111,22 @@
href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap"
rel="stylesheet"
/>
<link href="https://fonts.googleapis.com/css2?family=Onest:wght@300;400;500;700&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Gabarito:wght@500;600;700;900&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Pixelify+Sans:wght@400;500;600;700&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@300;500;600;700&display=swap" rel="stylesheet">
<link
href="https://fonts.googleapis.com/css2?family=Onest:wght@300;400;500;700&display=swap"
rel="stylesheet"
/>
<link
href="https://fonts.googleapis.com/css2?family=Gabarito:wght@500;600;700;900&display=swap"
rel="stylesheet"
/>
<link
href="https://fonts.googleapis.com/css2?family=Pixelify+Sans:wght@400;500;600;700&display=swap"
rel="stylesheet"
/>
<link
href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@300;500;600;700&display=swap"
rel="stylesheet"
/>
</head>

<body>
Expand Down
10 changes: 5 additions & 5 deletions index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import 'proxy-polyfill';
import "proxy-polyfill";

import * as React from 'react';
import ReactDOM from 'react-dom';
import * as React from "react";
import ReactDOM from "react-dom";

import App from './src/App';
import App from "./src/App";

ReactDOM.render(<App />, document.getElementById('root'));
ReactDOM.render(<App />, document.getElementById("root"));
Loading
Loading