Skip to content

Commit

Permalink
Merge pull request #35 from maingockien01/setup-ci-test-stages
Browse files Browse the repository at this point in the history
Setup ci test stages
  • Loading branch information
maingockien01 authored Feb 27, 2024
2 parents f43b928 + 31b6951 commit 33bc654
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 16 deletions.
37 changes: 35 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: CI
run-name: ${{ github.actor }} is running ${{ github.workflow }} on commit ${{ github.sha }}
run-name: ${{ github.actor }} is running ${{ github.workflow }} on commit ${{ github.sha }} for branch ${{ github.ref }}

on:
push:
Expand All @@ -18,6 +18,7 @@ env:
jobs:

build:
name: Build and push Docker image
runs-on: ubuntu-latest
concurrency:
group: build-${{ github.sha }}
Expand All @@ -43,6 +44,7 @@ jobs:
cache-to: type=inline

lint:
name: Lint code - Code style check
runs-on: ubuntu-latest
needs: build
concurrency:
Expand All @@ -66,6 +68,7 @@ jobs:
run: docker run ${{ env.DOCKER_TAG }} yarn workspace @team8/utils lint

tests-unit-backend:
name: Run unit tests on workspace backend
runs-on: ubuntu-latest
needs: build
concurrency:
Expand All @@ -74,4 +77,34 @@ jobs:
steps:
- name: Run unit tests on workspace backend
id: backend
run: docker run ${{ env.DOCKER_TAG }} yarn workspace @team8/backend test:unit
run: docker run ${{ env.DOCKER_TAG }} yarn workspace @team8/backend test:unit

tests-unit-frontend:
name: Run unit tests on workspace frontend
runs-on: ubuntu-latest
needs: build
concurrency:
group: tests-unit-frontend-${{ github.sha }}
cancel-in-progress: true
steps:
- name: Run unit tests on workspace frontend
id: frontend
run: docker run ${{ env.DOCKER_TAG }} yarn workspace @team8/frontend test:unit

tests-backend-e2e:
name: Run integration tests on workspace backend
runs-on: ubuntu-latest
needs: build
continue-on-error: true
concurrency:
group: tests-backend-e2e-${{ github.sha }}
cancel-in-progress: true
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker
uses: docker/setup-buildx-action@v3
- name: Run e2e tests on workspace backend
id: backend
run: docker-compose run apps-dev yarn workspace @team8/backend test:e2e
continue-on-error: true
14 changes: 0 additions & 14 deletions apps/frontend/test/unit/Cards.spec.tsx

This file was deleted.

13 changes: 13 additions & 0 deletions apps/frontend/test/unit/dummy.spec.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { render } from '@testing-library/react';
import React from 'react';

describe('Cards', () => {
test('should render component', () => {
render(<p>Hello world</p>)
});

test('should contain Hello World', () => {
const { getByText } = render(<p>Hello world</p>);
expect(getByText('Hello world')).toBeTruthy();
});
});

0 comments on commit 33bc654

Please sign in to comment.