From 70c56e4d0b452f399179345fa7107818b0208f3d Mon Sep 17 00:00:00 2001 From: Bastian Wagner Date: Thu, 28 Nov 2024 12:15:04 +0100 Subject: [PATCH] Workflows --- .github/workflows/{main.yml => deploy.yml} | 14 ++++-------- .github/workflows/test.yml | 26 ++++++++++++++++++++++ api/src/modules/system/system.service.ts | 6 ++++- 3 files changed, 35 insertions(+), 11 deletions(-) rename .github/workflows/{main.yml => deploy.yml} (89%) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/main.yml b/.github/workflows/deploy.yml similarity index 89% rename from .github/workflows/main.yml rename to .github/workflows/deploy.yml index 8823ab2..ac3a1eb 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/deploy.yml @@ -1,19 +1,13 @@ name: Docker Image CI for GHCR on: - push: + workflow_run: + workflows: ["Run Unit-Tests"] + types: + - completed branches: - master jobs: - test_frontend: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Run Unit-Tests - run: | - cd client - npm install - npm run test build_and_publish_backend: runs-on: ubuntu-latest steps: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..3677789 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,26 @@ +name: Run Unit-Tests + +on: + push: + branches: ["*"] # Alle Branches + tags: ["*"] # Alle Tags + +jobs: + test_frontend: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Run Unit-Tests Frontend + run: | + cd client + npm install + npm run test + test_backend: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Run Unit-Tests Backend + run: | + cd api + npm install + npm run test \ No newline at end of file diff --git a/api/src/modules/system/system.service.ts b/api/src/modules/system/system.service.ts index df894b8..5f5a499 100644 --- a/api/src/modules/system/system.service.ts +++ b/api/src/modules/system/system.service.ts @@ -27,11 +27,15 @@ export class SystemService { } findOne(id: string) { - return `This action returns a #${id} system`; + return this.systemRepo.findOne({ where: { id: id } }); } // eslint-disable-next-line @typescript-eslint/no-unused-vars update(id: string, updateSystemDto: UpdateSystemDto) { + throw new HttpException( + `This action updates a #${id} system but is not implemented`, + HttpStatus.NOT_IMPLEMENTED, + ); return `This action updates a #${id} system`; }