TECHDEBT-36: Add CI check and build (#9)

This commit is contained in:
Rinat Arsaev 2022-01-17 11:20:10 +03:00 committed by GitHub
parent 918c43bd3d
commit b49f6f8a27
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 94 additions and 16 deletions

18
.github/actions/init/action.yaml vendored Normal file
View File

@ -0,0 +1,18 @@
name: Init
description: Init
runs:
using: composite
steps:
- name: Init NodeJS
uses: actions/setup-node@v2
with:
node-version: '16.13.2'
cache: 'npm'
- name: Install Packages
run: npm ci
shell: bash
- name: Generate Swagger & OpenAPI code
run: npm run codegen
shell: bash

33
.github/workflows/build-push.yaml vendored Normal file
View File

@ -0,0 +1,33 @@
name: Build & Push
on:
push:
branches:
- 'master'
- 'main'
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive
- name: Init
uses: ./.github/actions/init
- name: Check & Build
run: npm run ci:build
- name: Deploy image
uses: valitydev/action-deploy-docker@v1.0.16
with:
registry-username: ${{ github.actor }}
registry-access-token: ${{ secrets.GITHUB_TOKEN }}
dockerfile-path: .
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}

22
.github/workflows/pr-build-check.yaml vendored Normal file
View File

@ -0,0 +1,22 @@
name: 'PR: Build & Check'
on:
pull_request:
branches: ['*']
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive
- name: Init
uses: ./.github/actions/init
- name: Check & Build
run: npm run ci:build

View File

@ -1,13 +1,13 @@
name: 'PR Title Checker'
on:
pull_request:
types: [edited, opened, synchronize, reopened]
branches: [disabled]
pull_request:
types: [edited, opened, synchronize, reopened]
branches: [disabled]
jobs:
title-check:
runs-on: ubuntu-latest
steps:
- uses: naveenk1223/action-pr-title@master
with:
regex: '([A-Z]+-[0-9]+,?)+: [A-Z0-9].*'
title-check:
runs-on: ubuntu-latest
steps:
- uses: naveenk1223/action-pr-title@master
with:
regex: '([A-Z]+-[0-9]+,?)+: [A-Z0-9].*'

View File

@ -3,6 +3,6 @@
<component name="PrettierConfiguration">
<option name="myRunOnSave" value="true" />
<option name="myRunOnReformat" value="true" />
<option name="myFilesPattern" value="{**/*,*}.{js,ts,jsx,tsx,md,json,html,svg,scss,css}" />
<option name="myFilesPattern" value="{**/*,*}.{js,ts,jsx,tsx,md,json,html,svg,scss,css,yml,yaml}" />
</component>
</project>

View File

@ -8,4 +8,6 @@ src/app/**/swagger-codegen
src/app/**/openapi-codegen
src/app/**/gen-model
.vscode
.swagger-codegen
.idea
.swagger-codegen
.angular

3
Dockerfile Normal file
View File

@ -0,0 +1,3 @@
FROM nginx:1.21
COPY dist /usr/share/nginx/html
COPY nginx.conf /etc/nginx/vhosts.d/dashboard.conf

View File

@ -1,6 +1,7 @@
{
"name": "dashboard",
"version": "0.0.0",
"private": true,
"scripts": {
"postinstall": "ngcc",
"start": "ng serve --port 8000",
@ -14,20 +15,19 @@
"lint": "npm run lint-cache-cmd",
"lint-fix": "npm run lint-cache-cmd -- --fix",
"lint-errors": "npm run lint-cache-cmd -- --quiet",
"prettier-cmd": "prettier \"**/*.{html,js,ts,css,scss,md,json,prettierrc,svg}\"",
"prettier-cmd": "prettier \"**/*.{html,js,ts,css,scss,md,json,prettierrc,svg,yaml,yml}\"",
"prettier": "npm run prettier-cmd -- --check",
"prettier-fix": "npm run prettier-cmd -- --write",
"tools-cmd": "ts-node --project tools/tsconfig.json",
"parallel-cmd": "concurrently --prefix-colors magenta,green",
"parallel-cmd": "concurrently --kill-others-on-fail --prefix-colors magenta,green,red,yellow,blue",
"swagger-codegen": "npm run tools-cmd -- tools/swagger-codegen.ts",
"openapi-codegen": "openapi-generator-cli version && npm run tools-cmd -- tools/openapi-codegen.ts",
"codegen": "npm run parallel-cmd -- --names SWAG,OAPI \"npm run swagger-codegen\" \"npm run openapi-codegen\"",
"icons-list-gen": "npm run tools-cmd -- tools/gen-icons-list.ts",
"icons-ids-gen": "npm run tools-cmd -- tools/gen-icons-ids.ts",
"ci:check": "npm run parallel-cmd -- --names PRET,LINT \"npm run prettier\" \"npm run lint-cmd -- --quiet\"",
"ci:test": "npm run test -- --configuration=ci"
"ci:test": "npm run test -- --configuration=ci",
"ci:build": "npm run parallel-cmd -- --names PRETTIER,LINT,BUILD \"npm run prettier\" \"npm run lint-cmd -- --quiet\" \"npm run build\""
},
"private": true,
"dependencies": {
"@angular/animations": "~13.1.1",
"@angular/cdk": "~13.1.1",