Merge branch 'main' into feat/46-task-management-api
This commit is contained in:
@@ -1,69 +0,0 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- '*'
|
||||
- '*/*'
|
||||
|
||||
jobs:
|
||||
client-code-checks:
|
||||
name: Client Code Checks
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
ref: ${{ github.event.pull_request.head.ref }}
|
||||
|
||||
- name: Set up Node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
path: ~/.npm
|
||||
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
||||
node-version: '20'
|
||||
restore-keys: |
|
||||
${{ runner.os }}-node-
|
||||
|
||||
- name: Clean and Install
|
||||
run: cd client && npm ci
|
||||
- name: Build
|
||||
run: cd client && npm run build
|
||||
- name: Lint
|
||||
run: cd client && npm run lint
|
||||
#- name: Unit tests
|
||||
# run: npm run test
|
||||
|
||||
java-code-checks:
|
||||
name: Java Code Checks
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
ref: ${{ github.event.pull_request.head.ref }}
|
||||
|
||||
- name: Set up JDK 17
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
java-version: '17'
|
||||
distribution: 'temurin'
|
||||
cache: 'maven'
|
||||
|
||||
- name: Cache Maven packages
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.m2
|
||||
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
|
||||
restore-keys: ${{ runner.os }}-m2
|
||||
|
||||
- name: Build with Maven
|
||||
run: cd java-api && ./mvnw --no-transfer-progress clean compile -DskipTests
|
||||
|
||||
- name: Google Checkstyle
|
||||
run: cd java-api && ./mvnw --no-transfer-progress checkstyle:checkstyle -Dskip.checkstyle=false
|
||||
|
||||
- name: All Tests
|
||||
run: cd java-api && ./mvnw --no-transfer-progress clean verify -P all-tests --file pom.xml
|
||||
@@ -7,8 +7,8 @@ on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
code-checks:
|
||||
name: Code Checks
|
||||
client-code-checks:
|
||||
name: Client Code Checks
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
@@ -27,5 +27,54 @@ jobs:
|
||||
run: cd client && npm run build
|
||||
- name: Lint
|
||||
run: cd client && npm run lint
|
||||
#- name: Unit tests
|
||||
# run: npm run test
|
||||
- name: Unit tests
|
||||
run: cd client && npm run test:coverage
|
||||
- name: SonarCloud Scan
|
||||
uses: SonarSource/sonarcloud-github-action@v3.0.0
|
||||
with:
|
||||
projectBaseDir: client
|
||||
args: >
|
||||
-Dsonar.organization=ricardo-campos-org
|
||||
-Dsonar.projectKey=ricardo-campos-org_react-typescript-todolist
|
||||
-Dsonar.javascript.lcov.reportPaths=coverage/lcov.info
|
||||
-Dsonar.typescript.tsconfigPaths=tsconfig.json
|
||||
-Dsonar.sources=src/
|
||||
-Dsonar.exclusions=src/__test__/**
|
||||
-Dsonar.tests=src/__test__/
|
||||
-Dsonar.verbose=false
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
|
||||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
||||
|
||||
java-code-checks:
|
||||
name: Server Code Checks
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
ref: ${{ github.event.pull_request.head.ref }}
|
||||
|
||||
- name: Set up JDK 17
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
java-version: '17'
|
||||
distribution: 'temurin'
|
||||
cache: 'maven'
|
||||
|
||||
- name: Cache Maven packages
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.m2
|
||||
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
|
||||
restore-keys: ${{ runner.os }}-m2
|
||||
|
||||
- name: Build with Maven
|
||||
run: cd java-api && ./mvnw --no-transfer-progress clean compile -DskipTests
|
||||
|
||||
- name: Google Checkstyle
|
||||
run: cd java-api && ./mvnw --no-transfer-progress checkstyle:checkstyle -Dskip.checkstyle=false
|
||||
|
||||
- name: All Tests
|
||||
run: cd java-api && ./mvnw --no-transfer-progress clean verify -P all-tests --file pom.xml
|
||||
|
||||
@@ -8,8 +8,8 @@ concurrency:
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
code-checks:
|
||||
name: Code Checks
|
||||
client-code-checks:
|
||||
name: Client Code Checks
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
@@ -23,14 +23,30 @@ jobs:
|
||||
run: cd client && npm run build
|
||||
- name: Lint
|
||||
run: cd client && npm run lint
|
||||
#- name: Unit tests
|
||||
# run: npm run test
|
||||
- name: Unit tests
|
||||
run: cd client && npm run test:coverage
|
||||
- name: SonarCloud Scan
|
||||
uses: SonarSource/sonarcloud-github-action@v3.0.0
|
||||
with:
|
||||
projectBaseDir: client
|
||||
args: >
|
||||
-Dsonar.organization=ricardo-campos-org
|
||||
-Dsonar.projectKey=ricardo-campos-org_react-typescript-todolist
|
||||
-Dsonar.javascript.lcov.reportPaths=coverage/lcov.info
|
||||
-Dsonar.typescript.tsconfigPaths=tsconfig.json
|
||||
-Dsonar.sources=src/
|
||||
-Dsonar.exclusions=src/__test__/**
|
||||
-Dsonar.tests=src/__test__/
|
||||
-Dsonar.verbose=false
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
|
||||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
||||
|
||||
docker-build:
|
||||
name: Build Docker image
|
||||
client-docker-build:
|
||||
name: Build Client Docker image
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- code-checks
|
||||
- client-code-checks
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: docker/setup-buildx-action@v3
|
||||
@@ -52,3 +68,36 @@ jobs:
|
||||
build-args: BUILD=${{ github.event.number }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
java-code-checks:
|
||||
name: Server Code Checks
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
ref: ${{ github.event.pull_request.head.ref }}
|
||||
|
||||
- name: Set up JDK 17
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
java-version: '17'
|
||||
distribution: 'temurin'
|
||||
cache: 'maven'
|
||||
|
||||
- name: Cache Maven packages
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.m2
|
||||
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
|
||||
restore-keys: ${{ runner.os }}-m2
|
||||
|
||||
- name: Build with Maven
|
||||
run: cd java-api && ./mvnw --no-transfer-progress clean compile -DskipTests
|
||||
|
||||
- name: Google Checkstyle
|
||||
run: cd java-api && ./mvnw --no-transfer-progress checkstyle:checkstyle -Dskip.checkstyle=false
|
||||
|
||||
- name: All Tests
|
||||
run: cd java-api && ./mvnw --no-transfer-progress clean verify -P all-tests --file pom.xml
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
import React from 'react';
|
||||
import { test } from "vitest";
|
||||
import App from "../App";
|
||||
import { render } from "@testing-library/react";
|
||||
import AuthContext from "../context/AuthContext";
|
||||
import authContextMock from "./__mocks__/authContextMock";
|
||||
|
||||
test('Renders the app', () => {
|
||||
render(
|
||||
<AuthContext.Provider value={authContextMock}>
|
||||
<App />
|
||||
</AuthContext.Provider>
|
||||
);
|
||||
});
|
||||
@@ -0,0 +1,12 @@
|
||||
import { vi } from "vitest";
|
||||
|
||||
const authContextMock = {
|
||||
signed: true,
|
||||
user: undefined,
|
||||
checkCurrentAuthUser: vi.fn(),
|
||||
signIn: vi.fn(),
|
||||
signOut: vi.fn(),
|
||||
isAdmin: false
|
||||
};
|
||||
|
||||
export default authContextMock;
|
||||
@@ -0,0 +1,15 @@
|
||||
import { afterEach } from 'vitest';
|
||||
import { cleanup } from '@testing-library/react';
|
||||
|
||||
// runs a cleanup after each test case (e.g. clearing jsdom)
|
||||
afterEach(() => {
|
||||
cleanup();
|
||||
});
|
||||
|
||||
window.matchMedia = window.matchMedia || function() {
|
||||
return {
|
||||
matches: false,
|
||||
addListener: function() {},
|
||||
removeListener: function() {}
|
||||
};
|
||||
};
|
||||
@@ -25,5 +25,8 @@
|
||||
},
|
||||
"include": [
|
||||
"src"
|
||||
],
|
||||
"exclude": [
|
||||
"src/__test__/"
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user