Skip to content

Commit

Permalink
Merge pull request #8 from insight-platform/github-actions
Browse files Browse the repository at this point in the history
Create main.yml
  • Loading branch information
ksendart committed Nov 22, 2023
2 parents b9769f1 + 2afc50f commit d43afb9
Show file tree
Hide file tree
Showing 28 changed files with 705 additions and 75 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Docker Image CI

on:
push:
branches: [ "main" ]

jobs:
build:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '16'
registry-url: 'https://npm.pkg.github.com'
scope: '@insight-platform'
- name: Build the Docker image
run: docker build . --file projects/savant-lib/Dockerfile --tag savant-image
- name: Publish from image
run: docker run savant-image bash -c "npm config set @insight-platform:registry=https://npm.pkg.github.com; npm config set -- '//npm.pkg.github.com/:_authToken' '${{ secrets.GITHUB_TOKEN }}'; npm version patch; npm publish"
37 changes: 37 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: savant-github-actions
on: [push]
jobs:
check-packages:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: '16'
- run: npm install
lint:
runs-on: ubuntu-latest
steps:
- name: Base checkout
uses: actions/checkout@v4
- name: Base node
uses: actions/setup-node@v3
with:
node-version: '16'
- name: Install dependencies
run: npm install
- name: Linting
run: npm run lint
test:
runs-on: ubuntu-latest
steps:
- name: Base checkout
uses: actions/checkout@v4
- name: Base node
uses: actions/setup-node@v3
with:
node-version: '16'
- name: Install dependencies
run: npm install
- name: Testing
run: npm run test
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@savant:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=${TOKEN}
7 changes: 3 additions & 4 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
"zone.js/testing"
],
"tsConfig": "tsconfig.spec.json",
"karmaConfig": "karma.conf.js",
"inlineStyleLanguage": "scss",
"assets": [
"src/favicon.ico",
Expand Down Expand Up @@ -142,11 +143,9 @@
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "projects/savant-lib/src/test.ts",
"tsConfig": "projects/savant-lib/tsconfig.spec.json",
"polyfills": [
"zone.js",
"zone.js/testing"
]
"karmaConfig": "projects/savant-lib/karma.conf.js"
}
},
"lint": {
Expand Down
58 changes: 58 additions & 0 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html

module.exports = function (config) {
config.set({
basePath: 'src',
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
require('karma-jasmine'),
require('karma-spec-reporter'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage'),
require('@angular-devkit/build-angular/plugins/karma')
],
browsers: ['ChromeHeadlessNoSandbox'],
client: {
jasmine: {
// you can add configuration options for Jasmine here
// the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
// for example, you can disable the random execution with `random: false`
// or set a specific seed with `seed: 4321`
},
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
jasmineHtmlReporter: {
suppressAll: true // removes the duplicated traces
},
coverageReporter: {
dir: require('path').join(__dirname, '../../coverage/savant'),
subdir: '.',
reporters: [
{ type: 'html' },
{ type: 'text-summary' }
]
},
customLaunchers: {
ChromeHeadlessNoSandbox: {
base: 'ChromeHeadless',
flags: [
'--headless',
'--disable-gpu',
'--no-sandbox'
]
},
},
reporters: ['progress', 'spec', 'kjhtml'],
specReporter: {
suppressSkipped: true,
},
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
singleRun: true,
restartOnFileChange: true
});
};
38 changes: 38 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
{
"name": "savant-metadata-explorer",
"version": "0.0.0",
"repository": {
"type": "git",
"url": "https://github.com/insight-platform/SavantMetadataExplorer.git"
},
"publishConfig": {
"registry": "https://npm.pkg.github.com"
},
"scripts": {
"ng": "ng",
"start": "ng serve",
Expand Down Expand Up @@ -52,6 +59,8 @@
"karma-coverage": "~2.2.0",
"karma-jasmine": "~5.1.0",
"karma-jasmine-html-reporter": "~2.1.0",
"karma-spec-reporter": "^0.0.36",
"ng-mocks": "^14.11.0",
"ng-packagr": "^16.2.0",
"typescript": "~5.1.3"
}
Expand Down
8 changes: 8 additions & 0 deletions projects/savant-lib/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM node:18.17.1
WORKDIR /tmp/savant-lib
COPY package.json package-lock.json /tmp/savant-lib/
RUN npm install
COPY . /tmp/savant-lib
RUN npm run build:savant-lib

WORKDIR /tmp/savant-lib/dist/savant-lib
58 changes: 58 additions & 0 deletions projects/savant-lib/karma.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html

module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
require('karma-jasmine'),
require('karma-spec-reporter'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage'),
require('@angular-devkit/build-angular/plugins/karma')
],
browsers: ['ChromeHeadlessNoSandbox'],
client: {
jasmine: {
// you can add configuration options for Jasmine here
// the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
// for example, you can disable the random execution with `random: false`
// or set a specific seed with `seed: 4321`
},
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
jasmineHtmlReporter: {
suppressAll: true // removes the duplicated traces
},
coverageReporter: {
dir: require('path').join(__dirname, '../../coverage/savant-lib'),
subdir: '.',
reporters: [
{ type: 'html' },
{ type: 'text-summary' }
]
},
customLaunchers: {
ChromeHeadlessNoSandbox: {
base: 'ChromeHeadless',
flags: [
'--headless',
'--disable-gpu',
'--no-sandbox'
]
},
},
reporters: ['progress', 'spec', 'kjhtml'],
specReporter: {
suppressSkipped: true,
},
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
singleRun: true,
restartOnFileChange: true
});
};
6 changes: 5 additions & 1 deletion projects/savant-lib/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{
"name": "@savant/savant-lib",
"name": "@insight-platform/savant-lib",
"version": "0.0.1",
"repository": {
"type": "git",
"url": "https://github.com/insight-platform/SavantMetadataExplorer.git"
},
"exports": {
"./theming": {
"sass": [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { FrameContainerComponent } from './frame-container.component';
import { MockComponent, MockModule } from 'ng-mocks';
import { FrameTreeComponent } from '../frame-tree/frame-tree.component';
import { SharedModule } from '../../../utils';

describe('FrameContainerComponent', () => {
let component: FrameContainerComponent;
let fixture: ComponentFixture<FrameContainerComponent>;

beforeEach(() => {
TestBed.configureTestingModule({
declarations: [FrameContainerComponent]
declarations: [FrameContainerComponent, MockComponent(FrameTreeComponent)],
imports: [
MockModule(SharedModule),
],
});
fixture = TestBed.createComponent(FrameContainerComponent);
component = fixture.componentInstance;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,31 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { FrameDetailsComponent } from './frame-details.component';
import { MatSnackBarModule } from '@angular/material/snack-bar';
import { MockComponent } from 'ng-mocks';
import { FrameTreeComponent } from '../frame-tree/frame-tree.component';
import { frame } from '../../../../../../src/app/api/models/data';
import { SharedModule } from '../../../utils';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { MatExpansionModule } from '@angular/material/expansion';

describe('FrameDetailsComponent', () => {
let component: FrameDetailsComponent;
let fixture: ComponentFixture<FrameDetailsComponent>;

beforeEach(() => {
TestBed.configureTestingModule({
declarations: [FrameDetailsComponent]
declarations: [FrameDetailsComponent, MockComponent(FrameTreeComponent)],
imports: [
MatSnackBarModule,
SharedModule,
BrowserAnimationsModule,
MatExpansionModule,
]
});
fixture = TestBed.createComponent(FrameDetailsComponent);
component = fixture.componentInstance;
fixture.componentInstance.frame = frame
fixture.detectChanges();
});

Expand Down
Loading

0 comments on commit d43afb9

Please sign in to comment.