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

build(app): CI #26

Merged
merged 7 commits into from
Aug 18, 2023
Merged
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
10 changes: 6 additions & 4 deletions .github/workflows/cd.yml → .github/workflows/app-cd.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: cd-app
run-name: ${{ github.actor }} is executing cd-app
name: app-cd
run-name: ${{ github.actor }} is executing ${{ github.workflow }} on ${{ github.event_name }} at ${{ github.sha }}

permissions:
id-token: write # This is required for requesting the JWT
Expand All @@ -10,13 +10,15 @@ on:
push:
branches:
- main
paths:
- front/**

defaults:
run:
working-directory: front

jobs:
cd-app:
app-cd:
runs-on: ubuntu-latest
steps:
# Followed https://github.com/aws-actions/configure-aws-credentials
Expand All @@ -26,7 +28,7 @@ jobs:
with:
aws-region: eu-west-2
role-to-assume: arn:aws:iam::111982095069:role/github-omnilog
role-session-name: GitHubActions-CD-App
role-session-name: GitHubActions-App-CD
- name: Checkout main
uses: actions/checkout@v3
- name: Setup Node 18
Expand Down
38 changes: 38 additions & 0 deletions .github/workflows/app-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: app-ci
run-name: ${{ github.actor }} is executing ${{ github.workflow }} on ${{ github.event_name }} at ${{ github.sha }}

on:
pull_request:
branches:
- main
paths:
- front/**

defaults:
run:
working-directory: front

jobs:
app-ci:
runs-on: ubuntu-latest
steps:
- name: Checkout main
uses: actions/checkout@v3
- name: Setup Node 18
uses: actions/setup-node@v3
with:
node-version: 18
- name: Install dependencies
uses: borales/actions-yarn@v4
with:
cmd: --cwd front install # front/yarn install
- name: Check linting
uses: borales/actions-yarn@v4
with:
cmd: --cwd front lint # front/yarn lint
- name: Check tests
uses: borales/actions-yarn@v4
with:
cmd: --cwd front test # front/yarn test


14 changes: 14 additions & 0 deletions front/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/* eslint-disable @typescript-eslint/no-var-requires */
const nextJest = require("next/jest");

// Providing the path to your Next.js app which will enable loading next.config.js and .env files
const createJestConfig = nextJest({ dir: "./" });

// Any custom config you want to pass to Jest
const customJestConfig = {
testEnvironment: "jest-environment-jsdom",
roots: ["<rootDir>/src"],
};

// createJestConfig is exported in this way to ensure that next/jest can load the Next.js configuration, which is async
module.exports = createJestConfig(customJestConfig);
6 changes: 6 additions & 0 deletions front/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"build": "next build",
"start": "next start",
"lint": "next lint",
"test": "jest",
"db-push": "npx prisma db push"
},
"engines": {
Expand All @@ -30,11 +31,16 @@
"typescript": "5.1.6"
},
"devDependencies": {
"@testing-library/jest-dom": "^6.0.1",
"@testing-library/react": "^14.0.0",
"@types/jest": "^29.5.3",
"@typescript-eslint/eslint-plugin": "^6.3.0",
"aws-cdk-lib": "2.84.0",
"constructs": "10.1.156",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-prettier": "^5.0.0",
"jest": "^29.6.2",
"jest-environment-jsdom": "^29.6.2",
"prettier": "^3.0.1",
"prisma": "^5.1.1",
"sst": "^2.23.6"
Expand Down
11 changes: 11 additions & 0 deletions front/src/app/__tests__/page.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import "@testing-library/jest-dom";

jest.mock("../../data/LogsData.ts", () => ({
getLogs: jest.fn(() => Promise.resolve([])),
}));

describe("Home", () => {
it("temporary test to check CI testing", async () => {
expect(1).toEqual(1);
});
});
7 changes: 0 additions & 7 deletions front/src/app/test/page.tsx

This file was deleted.

1 change: 1 addition & 0 deletions front/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"noUncheckedIndexedAccess": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
Expand Down
Loading