Skip to content

Commit 637166a

Browse files
authored
Merge pull request #136 from not-byte/109-fix-form-refresh
test(app): configure testing environment and add unit tests across entire app #108 and CI
2 parents 0a6c6ed + 68c3388 commit 637166a

14 files changed

Lines changed: 7568 additions & 3179 deletions

File tree

.github/workflows/ci.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: CI Pipeline
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v3
18+
19+
- name: Set up Node.js
20+
uses: actions/setup-node@v3
21+
with:
22+
node-version: "20"
23+
24+
- name: Install dependencies
25+
run: npm install
26+
27+
# - name: Run tests
28+
# run: npm run test
29+
30+
- name: Build Next.js app
31+
run: npm run build
32+
33+
build-docker:
34+
if: ${{ github.ref == 'refs/heads/main' }}
35+
runs-on: ubuntu-latest
36+
container:
37+
image: gcr.io/kaniko-project/executor:latest
38+
steps:
39+
- name: Checkout code
40+
uses: actions/checkout@v3
41+
42+
- name: Set up Kaniko Configuration
43+
run: |
44+
mkdir -p /kaniko/.docker
45+
echo '{
46+
"auths": {
47+
"${{ secrets.REGISTRY_URL }}": {
48+
"username": "${{ secrets.REGISTRY_USERNAME }}",
49+
"password": "${{ secrets.REGISTRY_PASSWORD }}"
50+
}
51+
}
52+
}' > /kaniko/.docker/config.json
53+
54+
- name: Build and Push Docker Image
55+
run: |
56+
/kaniko/executor \
57+
--context . \
58+
--dockerfile ./Dockerfile \
59+
--destination ${{ secrets.REGISTRY_URL }}/my-app:${{ github.sha }}

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,4 @@ yarn-error.log*
3737
next-env.d.ts
3838

3939
# jetBrains
40-
.idea
40+
.idea

.vscode/settings.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"files.associations": {
3+
"*.yaml": "home-assistant"
4+
}
5+
}

jest.config.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
const nextJest = require('next/jest');
2+
3+
const createJestConfig = nextJest({
4+
dir: './',
5+
});
6+
7+
const customJestConfig = {
8+
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
9+
testEnvironment: 'jest-environment-jsdom',
10+
moduleNameMapper: {
11+
'^@/(.*)$': '<rootDir>/src/$1',
12+
},
13+
};
14+
15+
module.exports = createJestConfig(customJestConfig);

jest.setup.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import '@testing-library/jest-dom';

0 commit comments

Comments
 (0)