From 327fe6ae4091d0af01b68fab37516968b91ef283 Mon Sep 17 00:00:00 2001 From: Muhammad Zourdy Date: Thu, 4 Aug 2022 04:53:04 +0200 Subject: [PATCH] Write CI/CD cron jobs --- .github/workflows/ci.yml | 49 ++++++++++++++++++++++++++++++++++++++++ .nvmrc | 1 + package.json | 4 +++- src/@types/react.d.ts | 2 +- 4 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 .nvmrc diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..60bd2bde --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,49 @@ +name: Continous Integration +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + test_and_build: + # The type of runner that the job will run on + name: Test and build the project + runs-on: ubuntu-latest + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - name: Check out Git repository + uses: actions/checkout@v3 + + - name: Use Node.js + uses: actions/setup-node@v3 + with: + node-version-file: '.nvmrc' + + # Install deps + - name: Install npm deps + run: npm i + + - name: Install Node.js dependencies + run: npm ci + + # Run project test + - name: Tests + run: npm run test + + # Run project linter + - name: Run ESLint + uses: wearerequired/lint-action@v2.0.1 + with: + eslint: true + eslint_extensions: "ts,tsx" + + - name: Fix Linting + run: npm run lint:fix + + # Run build + - name: Build + run: npm run build \ No newline at end of file diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 00000000..5edcff03 --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +v16 \ No newline at end of file diff --git a/package.json b/package.json index 36401d41..41e0aee7 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,9 @@ "postinstall": "npm run update-hooks", "docs:generate": "typedoc", "storybook": "start-storybook -p 6006", - "build-storybook": "build-storybook" + "build-storybook": "build-storybook", + "lint": "eslint .", + "lint:fix": "eslint --fix --ext .ts,.tsx ." }, "directories": { "example": "examples" diff --git a/src/@types/react.d.ts b/src/@types/react.d.ts index 48c43214..ee9f2d9c 100644 --- a/src/@types/react.d.ts +++ b/src/@types/react.d.ts @@ -1,4 +1,4 @@ import { FunctionComponent, PropsWithChildren } from "react"; export type PropsWithChildrenOnly = PropsWithChildren; -export type ReactFCWithChildren = FunctionComponent; +export type ReactFCWithChildren = FunctionComponent>;