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

Ci #33

Merged
merged 12 commits into from
May 13, 2024
Merged

Ci #33

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
35 changes: 35 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: CD

on:
push:
branches:
- main

permissions:
actions: read
contents: read

jobs:
main:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: pnpm/action-setup@v3
with:
version: 8

# Cache node_modules
- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
- run: pnpm install --frozen-lockfile
- uses: nrwl/nx-set-shas@v4
- name: Build and push images
env:
INPUT_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
INPUT_PUSH: true
run: pnpm exec nx affected -t container
20 changes: 7 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
name: CI

on:
push:
pull_request:
branches:
- main
pull_request:

permissions:
actions: read
Expand All @@ -18,23 +17,18 @@ jobs:
with:
fetch-depth: 0

- uses: pnpm/action-setup@v2
- uses: pnpm/action-setup@v3
with:
version: 8


# Connect your workspace on nx.app and uncomment this to enable task distribution.
# The "--stop-agents-after" is optional, but allows idle agents to shut down once the "build" targets have been requested
# - run: pnpm exec nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build"

# Cache node_modules
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
- run: pnpm install --frozen-lockfile
- uses: nrwl/nx-set-shas@v4

# Prepend any command with "nx-cloud record --" to record its logs to Nx Cloud
# - run: pnpm exec nx-cloud record -- echo Hello World
- run: pnpm exec nx affected -t lint test build container
- name: Lint, test, build, and container
env:
INPUT_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: pnpm exec nx affected -t lint test build container
1 change: 1 addition & 0 deletions apps/holder-app/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
"metadata": {
"images": ["ghcr.io/cre8/wallet/holder-app"],
"load": true,
"push": false,
"tags": ["latest"]
}
}
Expand Down
12 changes: 12 additions & 0 deletions apps/holder-app/src/app/app.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,18 @@ describe('AppComponent', () => {
let fixture: ComponentFixture<AppComponent>;
let checkForUpdatesService: CheckForUpdatesService;

beforeAll(() => {
Object.defineProperty(window, 'matchMedia', {
value: jest.fn(() => {
return {
matches: true,
addListener: jest.fn(),
removeListener: jest.fn(),
};
}),
});
});

beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [RouterTestingModule, AppComponent],
Expand Down
20 changes: 10 additions & 10 deletions apps/holder-app/src/app/scanner/scanner.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@
</button>
<mat-divider></mat-divider>
@for (device of devices; track device) {
<button
mat-menu-item
(click)="changeCamera(device.id)"
[disabled]="device.id === selectedDevice"
>
<mat-icon>camera</mat-icon>
<span>{{ device.label }}</span>
</button>
<button
mat-menu-item
(click)="changeCamera(device.id)"
[disabled]="device.id === selectedDevice"
>
<mat-icon>camera</mat-icon>
<span>{{ device.label }}</span>
</button>
}
</mat-menu>
<div
Expand All @@ -47,9 +47,9 @@
<div id="reader"></div>
</div>
<div *ngSwitchCase="'showRequest'">
<app-issuance-request [url]="url" *ngIf="url"></app-issuance-request>
<lib-issuance-request [url]="url" *ngIf="url"></lib-issuance-request>
</div>
<div *ngSwitchCase="'showVerificationRequest'">
<app-verify-request [url]="url" *ngIf="url"></app-verify-request>
<lib-verify-request [url]="url" *ngIf="url"></lib-verify-request>
</div>
</div>
4 changes: 3 additions & 1 deletion apps/holder-app/src/app/scanner/scanner.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,9 @@ export class ScannerComponent implements OnInit, OnDestroy {
},
this.onScanSuccess.bind(this),
// we do nothing when a scan failed
() => {}
() => {
// do nothing
}
);
}

Expand Down
1 change: 1 addition & 0 deletions apps/holder-app/src/assets/config/config.example.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// eslint-disable-next-line no-undef
globalThis.environment = {
backendUrl: 'http://localhost:3000',
keycloakHost: 'http://localhost:8080',
Expand Down
1 change: 1 addition & 0 deletions apps/holder-backend/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"metadata": {
"images": ["holder-backend"],
"load": true,
"push": false,
"tags": [
"type=schedule",
"type=ref,event=branch",
Expand Down
2 changes: 1 addition & 1 deletion apps/holder-backend/src/app/app.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Test, TestingModule } from '@nestjs/testing';
import { INestApplication } from '@nestjs/common';
import * as request from 'supertest';
import request from 'supertest';
import { AppController } from './app.controller';

describe('AppController', () => {
Expand Down
9 changes: 1 addition & 8 deletions apps/holder-browser-extension/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
{
"type": "initial",
"maximumWarning": "500kb",
"maximumError": "1mb"
"maximumError": "2mb"
},
{
"type": "anyComponentStyle",
Expand Down Expand Up @@ -65,13 +65,6 @@
},
"lint": {
"executor": "@nx/eslint:lint"
},
"test": {
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "apps/holder-browser-extension/jest.config.ts"
}
}
}
}
17 changes: 0 additions & 17 deletions apps/holder-browser-extension/src/app/auth/auth.guard.spec.ts

This file was deleted.

16 changes: 0 additions & 16 deletions apps/holder-browser-extension/src/app/auth/auth.service.spec.ts

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,32 +15,26 @@
</mat-form-field>
<mat-list>
@for (result of scanner.results; track result) {
<mat-list-item
(click)="process(result)"
*ngIf="result.action === 'issue'"
>
<mat-icon matListItemIcon>{{ 'call_received' }}</mat-icon>
<span matListItemTitle>{{
result.credentials![0].display![0].name
}}</span>
<span matListItemLine>{{ result.relyingParty }}</span>
</mat-list-item>
<mat-list-item
(click)="process(result)"
*ngIf="result.action === 'verify'"
>
<mat-icon matListItemIcon>{{ 'call_made' }}</mat-icon>
<span matListItemTitle>{{ result.purpose }}</span>
<span matListItemLine>{{ result.relyingParty }}</span>
</mat-list-item>
<mat-list-item (click)="process(result)" *ngIf="result.action === 'issue'">
<mat-icon matListItemIcon>{{ 'call_received' }}</mat-icon>
<span matListItemTitle>{{
result.credentials![0].display![0].name
}}</span>
<span matListItemLine>{{ result.relyingParty }}</span>
</mat-list-item>
<mat-list-item (click)="process(result)" *ngIf="result.action === 'verify'">
<mat-icon matListItemIcon>{{ 'call_made' }}</mat-icon>
<span matListItemTitle>{{ result.purpose }}</span>
<span matListItemLine>{{ result.relyingParty }}</span>
</mat-list-item>
}
</mat-list>
</div>
<app-issuance-request
<lib-issuance-request
*ngIf="action === 'issue'"
[url]="url!"
></app-issuance-request>
<app-verify-request
></lib-issuance-request>
<lib-verify-request
*ngIf="action === 'verify'"
[url]="url!"
></app-verify-request>
></lib-verify-request>

This file was deleted.

This file was deleted.

4 changes: 4 additions & 0 deletions apps/holder-browser-extension/src/test-setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,8 @@ globalThis.ngJest = {
errorOnUnknownProperties: true,
},
};
import { TextDecoder, TextEncoder } from 'util';
global.TextEncoder = TextEncoder;
(global as any).TextDecoder = TextDecoder;

import 'jest-preset-angular/setup-jest';
2 changes: 1 addition & 1 deletion apps/holder-browser-extension/tsconfig.spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"outDir": "../../dist/out-tsc",
"module": "commonjs",
"target": "es2016",
"types": ["jest", "node"]
"types": ["jest", "node", "chrome"]
},
"files": ["src/test-setup.ts"],
"include": [
Expand Down
1 change: 1 addition & 0 deletions apps/issuer-backend/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"metadata": {
"images": ["ghcr.io/cre8/wallet/issuer-backend"],
"load": true,
"push": false,
"tags": ["latest"]
}
}
Expand Down
2 changes: 1 addition & 1 deletion apps/issuer-backend/src/app/app.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Test, TestingModule } from '@nestjs/testing';
import { INestApplication } from '@nestjs/common';
import * as request from 'supertest';
import request from 'supertest';
import { AppController } from './app.controller';

describe('AppController', () => {
Expand Down
1 change: 1 addition & 0 deletions apps/issuer-frontend/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
"metadata": {
"images": ["ghcr.io/cre8/wallet/issuer-frontend"],
"load": true,
"push": false,
"tags": ["latest"]
}
}
Expand Down
Loading