From d7e11d4f29e8a380fe22ce84f77dae04e21c1a88 Mon Sep 17 00:00:00 2001 From: "bhill6@wisc.edu" <bhill6@wisc.edu> Date: Wed, 24 Oct 2018 17:13:26 +0000 Subject: [PATCH] ROENROLL-1204: Fixed some test errors, then got ci build/deploy working --- .gitlab-ci.yml | 36 +++++++++++++++++++ package.json | 2 +- src/app/app.component.spec.ts | 22 ++++-------- .../core/navigation/navigation.component.html | 2 +- 4 files changed, 44 insertions(+), 18 deletions(-) create mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..fc9970d --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,36 @@ +image: docker.doit.wisc.edu/registrar/angular-cli-builder:1.2.0 + + +variables: + S3_BUCKET_NAME: dev-enroll-app-frontend + DEV_CFDIST_ID: E2LLRLV3LNB0E3 + +stages: + - build +# - test + - deploy + +build: + stage: build + script: + - npm install + - ng build --prod --base-href /degree-planner + - ng lint + +#test: +# stage: test +# script: +# - npm install +# - ng build --prod + + +deploy: + stage: deploy + script: + - npm install + - ng build --prod --base-href /degree-planner + - aws s3 sync --acl public-read --sse --delete dist/course-search-enroll-fe s3://$S3_BUCKET_NAME + - aws configure set preview.cloudfront true + - aws cloudfront create-invalidation --distribution-id $DEV_CFDIST_ID --paths '/*' + only: + - master@adi-ia/course-search-enroll-fe diff --git a/package.json b/package.json index 8440b26..f44e9d9 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "test": "ng test", "lint": "ng lint", "e2e": "ng e2e", - "build-prod": "npm version patch && node ./update-version.js && ng build --prod" + "build-prod": "npm version patch && node ./update-version.js" }, "private": true, "dependencies": { diff --git a/src/app/app.component.spec.ts b/src/app/app.component.spec.ts index 67ad491..f7ade39 100644 --- a/src/app/app.component.spec.ts +++ b/src/app/app.component.spec.ts @@ -4,12 +4,13 @@ import { Router, RouterModule, Routes } from '@angular/router'; import { RouterTestingModule } from '@angular/router/testing'; import { AppComponent } from './app.component'; -import { HomeComponent } from './home/home.component'; import { AppRoutingModule } from './app.routing.module'; const routes: Routes = [ - { path: '', pathMatch: 'full', redirectTo: 'home', }, - { path: 'home', component: HomeComponent } + { + path: '', + loadChildren: './degree-planner/degree-planner.module#DegreePlannerModule' + } ]; @Component({ @@ -29,8 +30,7 @@ describe('AppComponent', () => { imports: [RouterModule, RouterTestingModule.withRoutes(routes)], schemas: [ NO_ERRORS_SCHEMA ], declarations: [ - AppComponent, - HomeComponent + AppComponent ], }).compileComponents(); })); @@ -39,17 +39,7 @@ describe('AppComponent', () => { const app = fixture.debugElement.componentInstance; expect(app).toBeTruthy(); })); - it(`should have as title 'Angular Starter'`, async(() => { - const fixture = TestBed.createComponent(AppComponent); - const app = fixture.debugElement.componentInstance; - expect(app.title).toEqual('app'); - })); - it('should render title in a h1 tag', async(() => { - const fixture = TestBed.createComponent(AppComponent); - fixture.detectChanges(); - const compiled = fixture.debugElement.nativeElement; - expect(compiled.querySelector('h1').textContent).toContain('Angular Starter'); - })); + it('should render title in a router-outlet tag', async(() => { const fixture = TestBed.createComponent(AppComponent); fixture.detectChanges(); diff --git a/src/app/core/navigation/navigation.component.html b/src/app/core/navigation/navigation.component.html index f346cac..d95dd82 100644 --- a/src/app/core/navigation/navigation.component.html +++ b/src/app/core/navigation/navigation.component.html @@ -5,4 +5,4 @@ <a mat-tab-link routerLink="/degree-planner" routerLinkActive="active" >Degree Planner</a> </nav> -<router-outlet></router-outlet> + -- GitLab