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

Feat/dev ops 281 284 #37

Closed
wants to merge 28 commits into from
Closed
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
Empty file added .eslintrc.json
Empty file.
68 changes: 68 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Build

on:
#pull_request:
#branches:
#- dev
workflow_dispatch:
inputs:
branch:
description: 'The current branch'
default: dev
type: string
required: false
debug:
type: boolean
description: enable debug
default: false

env:
BRANCH_NAME: ${{ github.head_ref || inputs.branch || 'dev' }}
enabledebug: ${{ inputs.debug == true && '-vvv' || ''}}
NEXUS_URL: https://packages.nuxeo.com/repository/npm-public/
NEXUS_REPOSITORY: npm-public
NODE_AUTH_TOKEN: ${{ secrets.NPM_ADMIN_TOKEN }}
GIT_TOKEN: ${{ secrets.GIT_TOKEN}}

jobs:
build-and-publish:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
ref: ${{ env.BRANCH_NAME }}

- name: Remove .npmrc file if exists
run: |
if [ -f .npmrc ]; then
rm .npmrc
fi

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
registry-url: ${{ env.NEXUS_URL }}
scope: '@nuxeo'

- name: Configure Additional Registries
run: |
npm config set @hylandsoftware:registry https://npm.pkg.github.com --global
npm config set //npm.pkg.github.com/:_authToken=${{ secrets.GIT_TOKEN }} --global
npm config set //packages.nuxeo.com/repository/npm-public/:_authToken=${{ secrets.NPM_ADMIN_TOKEN }} --global
npm config set "@nuxeo:registry" "https://packages.nuxeo.com/repository/npm-public" --global

- name: Install Angular CLI
run: npm install -g @angular/cli

- name: Install Dependencies
run: npm install

- name: Build Angular Project
run: npm run build

- name: Publish to Nexus
run: npm publish --@nuxeo:registry=https://packages.nuxeo.com/repository/npm-public/
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_ADMIN_TOKEN }}
49 changes: 49 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Lint

on:
pull_request:
branches:
- dev
workflow_call:
inputs:
branch:
description: 'The current branch'
default: dev
type: string
required: false

env:
BRANCH_NAME: ${{ github.head_ref || inputs.branch || 'dev' }}

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ env.BRANCH_NAME }}

- name: Remove .npmrc file if exists
run: |
if [ -f .npmrc ]; then
rm .npmrc
fi
- uses: actions/setup-node@v4
with:
registry-url: 'https://packages.nuxeo.com/repository/npm-public/'
node-version: 20
scope: '@nuxeo'

- name: Configure Additional Registries
run: |
npm config set @hylandsoftware:registry https://npm.pkg.github.com --global
npm config set //npm.pkg.github.com/:_authToken=${{ secrets.GIT_TOKEN }} --global
npm config set registry https://registry.npmjs.org/ --global
- name: Install @angular/cli
run: npm install -g @angular/cli

- name: Install Dependencies
run: npm install

- name: Lint
run: npm run lint
60 changes: 60 additions & 0 deletions .github/workflows/utest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Unit-test

on:
pull_request:
branches:
- dev
workflow_call:
inputs:
branch:
description: 'The current branch'
default: dev
type: string
required: false

env:
BRANCH_NAME: ${{ github.head_ref || inputs.branch || 'dev' }}

jobs:
utest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ env.BRANCH_NAME }}

- name: Remove .npmrc file if exists
run: |
if [ -f .npmrc ]; then
rm .npmrc
fi
- uses: actions/setup-node@v4
with:
registry-url: 'https://packages.nuxeo.com/repository/npm-public/'
node-version: 20
scope: '@nuxeo'

- name: Configure Additional Registries
run: |
npm config set @hylandsoftware:registry https://npm.pkg.github.com --global
npm config set //npm.pkg.github.com/:_authToken=${{ secrets.GIT_TOKEN }} --global
npm config set registry https://registry.npmjs.org/ --global

- name: Install @angular/cli
run: npm install -g @angular/cli

- name: Install Dependencies
run: npm install

- name: Install Chrome and Chromedriver
uses: browser-actions/setup-chrome@v1
with:
chrome-version: 120
install-chromedriver: true

- name: Verify Chrome installation
run: google-chrome --version

- name: Unit tests
run: |
xvfb-run --auto-servernum --server-args="-screen 0 1024x768x24" npm test
6 changes: 6 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

echo "Running pre-commit hook..."
npm run lint
echo "Linting completed."
3 changes: 0 additions & 3 deletions .npmrc

This file was deleted.

2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/dist
/node_modules
5 changes: 5 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"singleQuote": true,
"trailingComma": "all",
"printWidth": 80
}
64 changes: 48 additions & 16 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
"version": 1,
"newProjectRoot": "projects",
"projects": {
"mediumclone_angular": {
"admin_console_ui": {
"projectType": "application",
"schematics": {},
"root": "",
"root": "src",
"sourceRoot": "src",
"prefix": "app",
"architect": {
"build": {
"builder": "@hylandsoftware/hy-ui-devkit:browser",
"options": {
"outputPath": "dist/mediumclone_angular",
"outputPath": "dist/admin_console_ui",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
Expand All @@ -26,12 +26,21 @@
"output": "./"
}
],
"styles": ["src/styles.scss"],
"styles": [
"src/styles.scss"
],
"scripts": [],
"i18nPaths": ["src/app"],
"i18nModules": ["@hyland/ui", "@hyland/ui-shell"],
"i18nPaths": [
"src/app"
],
"i18nModules": [
"@hyland/ui",
"@hyland/ui-shell"
],
"stylePreprocessorOptions": {
"includePaths": ["node_modules"]
"includePaths": [
"node_modules"
]
}
},
"configurations": {
Expand Down Expand Up @@ -80,37 +89,60 @@
},
"configurations": {
"production": {
"browserTarget": "mediumclone_angular:build:production"
"browserTarget": "admin_console_ui:build:production"
},
"development": {
"browserTarget": "mediumclone_angular:build:development"
"browserTarget": "admin_console_ui:build:development"
}
},
"defaultConfiguration": "development"
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "mediumclone_angular:build"
"browserTarget": "admin_console_ui:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"polyfills": ["src/polyfills.ts", "zone.js", "zone.js/testing"],
"polyfills": [
"src/polyfills.ts",
"zone.js",
"zone.js/testing"
],
"tsConfig": "tsconfig.spec.json",
"assets": ["src/favicon.ico", "src/assets"],
"styles": ["src/styles.scss"],
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.scss"
],
"scripts": [],
"stylePreprocessorOptions": {
"includePaths": ["node_modules"]
"includePaths": [
"node_modules"
]
}
}
},
"lint": {
"builder": "@angular-eslint/builder:lint",
"options": {
"lintFilePatterns": [
"src/**/*.ts",
"src/**/*.html"
]
}
}
}
},
"cli": {
"root": "src"
}
},
"cli": {
"analytics": "7fa2cc0e-3e82-45f7-bedc-bce83c5ba0d7"
"analytics": "bac8daa6-35ed-405f-89f7-031d9cd916f4"
}
}
}
21 changes: 16 additions & 5 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = function(config) {
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular-devkit/build-angular'],
Expand All @@ -20,9 +20,20 @@ module.exports = function(config) {
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false,
restartOnFileChange: true
autoWatch: false, // set to false to disable watching files
browsers: ['ChromeCustom'], // Use custom Chrome launcher
singleRun: true,
restartOnFileChange: false, // set to false to disable restart on file change
customLaunchers: {
ChromeCustom: {
base: 'ChromeHeadless',
flags: ['--headless', '--disable-gpu', '--no-sandbox']
}
},
browserNoActivityTimeout: 30000,
captureTimeout: 30000,
processKillTimeout: 3000,
browserDisconnectTimeout: 10000,
browserDisconnectTolerance: 3
});
};
Loading
Loading