diff --git a/.github/composite-actions/install/action.yml b/.github/composite-actions/install/action.yml new file mode 100644 index 0000000..39153ab --- /dev/null +++ b/.github/composite-actions/install/action.yml @@ -0,0 +1,26 @@ +name: 'Install' +description: 'Sets up Node.js and runs install' + +runs: + using: composite + steps: + - uses: pnpm/action-setup@v2.2.4 + with: + version: 7 + + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: 16.x + registry-url: 'https://registry.npmjs.org' + cache: 'pnpm' + + - name: Setup Git User + shell: bash + run: | + git config --global user.email "joseshegs@gmail.com" + git config --global user.name "Segun Adebayo" + + - name: Install dependencies + shell: bash + run: pnpm install diff --git a/.github/workflows/quality.yml b/.github/workflows/quality.yml new file mode 100644 index 0000000..bdafeef --- /dev/null +++ b/.github/workflows/quality.yml @@ -0,0 +1,68 @@ +name: Quality + +on: + push: + branches: + - main + pull_request: + branches: + - main + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} + +jobs: + prettier: + name: Prettier + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Install + uses: ./.github/composite-actions/install + + - name: Run Prettier + run: pnpm prettier + + tests: + name: Unit Tests + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Install + uses: ./.github/composite-actions/install + + - name: Run tests + run: pnpm test + + eslint: + name: ESLint + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Install + uses: ./.github/composite-actions/install + + - name: Run ESLint + run: pnpm lint + env: + NODE_OPTIONS: "--max-old-space-size=4096" + + types: + name: TypeScript + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Install + uses: ./.github/composite-actions/install + + - name: Run TypeScript type check + run: pnpm typecheck diff --git a/package.json b/package.json index d8c4694..f067a85 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,7 @@ "scripts": { "dev": "pnpm -r --parallel dev", "build": "pnpm -r --parallel build", + "test": "pnpm -r --parallel test", "lint": "pnpm -r --parallel lint", "prettier": "prettier --check .", "prettier-fix": "prettier --write .",