Skip to content

Commit

Permalink
feat: add github action
Browse files Browse the repository at this point in the history
  • Loading branch information
pret-a-porter committed Nov 15, 2024
1 parent 4695239 commit dc20862
Show file tree
Hide file tree
Showing 16 changed files with 231 additions and 57 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: CI Workflow

on:
push:
branches:
- '*' # Runs on all branches
pull_request:
branches:
- '*' # Runs on pull requests to any branch

jobs:
build-and-test:
runs-on: ubuntu-latest

steps:
# Step 1: Checkout the code
- name: Checkout code
uses: actions/checkout@v3

# Step 2: Set up Node.js
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'yarn'

# Step 3: Install Yarn Berry
- name: Install Yarn Berry
run: yarn set version berry

# Step 4: Install dependencies
- name: Install dependencies
run: yarn install

# Step 5: Run the build script
- name: Build the project
run: yarn run build

# Step 6: Run tests
- name: Run tests
run: yarn run test
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"jest": "^29.7.0",
"node-notifier": "^10.0.1",
"ts-jest": "^29.2.5",
"ts-node": "^10.9.2",
"tsup": "^8.3.5",
"typescript": "^5.6.3"
},
Expand Down
19 changes: 0 additions & 19 deletions packages/core/config/jest.config.json

This file was deleted.

23 changes: 23 additions & 0 deletions packages/core/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import type { Config } from 'jest';

const config: Config = {
moduleFileExtensions: ['tsx', 'ts', 'js'],
collectCoverage: false,
coveragePathIgnorePatterns: ['/node_modules/'],
coverageThreshold: {
global: {
branches: 100,
functions: 100,
lines: 100,
statements: 100,
},
},
notify: true,
transform: {
'^.+\\.tsx?$': 'ts-jest',
},
rootDir: '..',
testMatch: ['<rootDir>/core/src/**/__tests__/**/*.test.(ts|tsx|js)'],
};

export default config;
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"scripts": {
"build": "yarn run --top-level tsup src/index.ts --format cjs,esm --dts --clean --sourcemap --out-dir lib --minify",
"prepare": "npm run test && npm run build",
"test": "jest --detectOpenHandles --config config/jest.config.json --no-cache"
"test": "jest --detectOpenHandles --no-cache"
},
"directories": {
"lib": "lib"
Expand Down
2 changes: 1 addition & 1 deletion packages/core/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../tsconfig.settings.json",
"extends": "../tsconfig.base.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "lib"
Expand Down
2 changes: 1 addition & 1 deletion packages/preact/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../tsconfig.settings.json",
"extends": "../tsconfig.base.json",
"compilerOptions": {
"jsxFactory": "h",
"rootDir": "src",
Expand Down
2 changes: 1 addition & 1 deletion packages/react-native/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../tsconfig.settings.json",
"extends": "../tsconfig.base.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "lib"
Expand Down
21 changes: 0 additions & 21 deletions packages/react/config/jest.config.json

This file was deleted.

33 changes: 33 additions & 0 deletions packages/react/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { JestConfigWithTsJest } from 'ts-jest';

const config: JestConfigWithTsJest = {
moduleFileExtensions: ['tsx', 'ts', 'js'],
collectCoverage: false,
coveragePathIgnorePatterns: [
'/node_modules/',
'<rootDir>/react//src/context.ts',
],
setupFilesAfterEnv: ['<rootDir>/react/jest.setup.ts'],
coverageThreshold: {
global: {
branches: 100,
functions: 100,
lines: 100,
statements: 100,
},
},
testEnvironment: 'jsdom',
notify: true,
transform: {
'^.+\\.tsx?$': [
'ts-jest',
{
tsconfig: '<rootDir>/react/tsconfig.json',
},
],
},
rootDir: '..',
testMatch: ['<rootDir>/react/src/**/__tests__/**/*.test.(ts|tsx|js)'],
};

export default config;
File renamed without changes.
2 changes: 1 addition & 1 deletion packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"scripts": {
"build": "yarn run --top-level tsup src/index.tsx --format cjs,esm --dts --clean --sourcemap --out-dir lib --minify",
"prepare": "npm run test && npm run build",
"test": "jest --detectOpenHandles --config config/jest.config.json --no-cache"
"test": "jest --detectOpenHandles --no-cache"
},
"sideEffects": false,
"publishConfig": {
Expand Down
2 changes: 1 addition & 1 deletion packages/react/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../tsconfig.settings.json",
"extends": "../tsconfig.base.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "lib"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@
"experimentalDecorators": false,
"forceConsistentCasingInFileNames": true,
"jsx": "react",
"lib": ["dom", "es6", "es2016", "es2017"],
"lib": ["DOM", "ESNext"],
"moduleResolution": "bundler",
"outDir": "dist",
"removeComments": true,
"sourceMap": true,
"strict": true,
"target": "es6"
},
"exclude": ["**/**/__tests__/**/**"]
"exclude": ["lib/**/*", "**/**/__tests__/**/**"]
}
4 changes: 0 additions & 4 deletions packages/tsconfig.json

This file was deleted.

Loading

0 comments on commit dc20862

Please sign in to comment.