Skip to content

Commit

Permalink
Merge pull request #2 from ducktors/add-ci
Browse files Browse the repository at this point in the history
Add CI
  • Loading branch information
matteovivona committed Feb 3, 2023
2 parents 301ea31 + b5038bd commit 41845af
Show file tree
Hide file tree
Showing 50 changed files with 2,898 additions and 1,180 deletions.
35 changes: 35 additions & 0 deletions .github/ISSUE_TEMPLATE/bug.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
name: 🐛 Bug report
about: Create a report to help us improve
---

**Please read this entire template before posting any issue. If you ignore these instructions
and post an issue here that does not follow the instructions, your issue might be closed,
locked, and assigned the `missing discussion` label.**

## 🐛 Bug Report

A clear and concise description of what the bug is.

## To Reproduce

Steps to reproduce the behavior:

Paste your code here:

```js
```

## Expected behavior

A clear and concise description of what you expected to happen.

Paste the results here:

```js
```

## Your Environment

- _os_: Mac, Windows, Linux
- _any other relevant information_
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: 🚀 Feature Proposal
about: Submit a proposal for a new feature
---

**Please read this entire template before posting any issue. If you ignore these instructions
and post an issue here that does not follow the instructions, your issue might be closed,
locked, and assigned the `missing discussion` label.**

## 🚀 Feature Proposal

A clear and concise description of what the feature is.

## Motivation

Please outline the motivation for the proposal.

## Example

Please provide an example for how this feature would be used.
41 changes: 41 additions & 0 deletions .github/ISSUE_TEMPLATE/regression.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
name: 💥 Regression Report
about: Report unexpected behavior that worked in previous versions
---

**Please read this entire template before posting any issue. If you ignore these instructions
and post an issue here that does not follow the instructions, your issue might be closed,
locked, and assigned the `missing discussion` label.**

## 💥 Regression Report

A clear and concise description of what the regression is.

## Last working version

Worked up to version:

Stopped working in version:

## To Reproduce

Steps to reproduce the behavior:

Paste your code here:

```js
```

## Expected behavior

A clear and concise description of what you expected to happen.

Paste the results here:

```js
```

## Your Environment

- _os_: Mac, Windows, Linux
- _any other relevant information_
7 changes: 7 additions & 0 deletions .github/autoapproval.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from_owner:
- dependabot-preview[bot]
- dependabot[bot]
required_labels:
- dependencies
apply_labels:
- autoapproved
19 changes: 19 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
version: 2
updates:
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "daily"
assignees:
- "matteovivona"
reviewers:
- "matteovivona"

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
assignees:
- "matteovivona"
reviewers:
- "matteovivona"
20 changes: 20 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
## In this PR

- Bug fix (non-breaking change which fixes an issue)
- New feature (non-breaking change which adds functionality)

## Issues reference

- <https://github.com/ducktors/carretto/issues/>
- <https://github.com/ducktors/carretto/issues/>

### Checklist

- [ ] Have you checked to ensure there aren't other open [Pull Requests](https://github.com/ducktors/carretto/pulls) for the same update/change?
<!-- You can erase any parts of this template not applicable to your Pull Request. -->
- [ ] Have you lint your code with `pnpm lint` locally prior to submission?
- [ ] Have you added an explanation of what your changes do and why you'd like us to include them?
- [ ] Have you written new tests for your core changes, as applicable?
- [ ] Have you successfully ran build with `pnpm build` of your changes locally?
- [ ] Have you successfully ran tests with `pnpm test` of your changes locally?
- [ ] Have you commit using [Conventional Commits](https://github.com/ducktors/carretto#how-to-commit)?
117 changes: 117 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
name: CI

on:
pull_request:
branches:
- main
push:
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
runs-on: ${{ matrix.os }}
name: Build
strategy:
matrix:
node-version: [16.x, 18.x]
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v3
name: Checkout
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- uses: pnpm/action-setup@v2
name: Install pnpm
with:
version: 7

- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Lint code
run: pnpm lint

- name: Build
run: pnpm build

test:
runs-on: macos-latest
name: Test
steps:
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 16

- uses: pnpm/action-setup@v2
with:
version: 7

- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Run tests
run: pnpm turbo test:ci

- name: Copy json coverage report
run: |
mkdir -p coverage
cp ./packages/http/coverage/coverage-final.json ./coverage/coverage-http.json
cp ./packages/main-loader/coverage/coverage-final.json ./coverage/coverage-main-loader.json
cp ./packages/mongodb/coverage/coverage-final.json ./coverage/coverage-mongodb.json
- name: Merge json coverage reports
run: pnpm dlx nyc merge coverage coverage/merged-coverage.json

- name: Convert json coverage report to lcov
run: |
pnpm dlx nyc report --reporter=lcov --temp-directory=coverage
ls -al ./coverage/
- name: Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ./coverage/lcov.info

- name: CodeClimate
uses: paambaati/codeclimate-action@v3.2.0
env:
CC_TEST_REPORTER_ID: ${{ secrets.CODECLIMATE_TEST_REPORTER_ID }}
59 changes: 59 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Release

on:
push:
branches:
- main

concurrency: ${{ github.workflow }}-${{ github.ref }}

jobs:
release:
runs-on: ubuntu-latest
name: Release
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v3
with:
persist-credentials: false

- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 16

- uses: pnpm/action-setup@v2
with:
version: 7

- name: Setup npmrc
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.DUCKTORS_NPM_TOKEN }}" > .npmrc

- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Create Release Pull Request or Publish packages
id: changesets
uses: changesets/action@v1.4.1
with:
publish: pnpm publish
commit: "chore(release): update monorepo packages versions"
title: "Upcoming Release Changes"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

pnpm dlx lint-staged
3 changes: 3 additions & 0 deletions .lintstagedrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"*": "rome check . && rome format ."
}
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
enable-pre-post-scripts=true
side-effects-cache=false
22 changes: 22 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"workbench.colorCustomizations": {
"activityBar.activeBackground": "#ed623c",
"activityBar.background": "#ed623c",
"activityBar.foreground": "#15202b",
"activityBar.inactiveForeground": "#15202b99",
"activityBarBadge.background": "#33ec5b",
"activityBarBadge.foreground": "#15202b",
"commandCenter.border": "#e7e7e799",
"sash.hoverBorder": "#ed623c",
"statusBar.background": "#e14115",
"statusBar.foreground": "#e7e7e7",
"statusBarItem.hoverBackground": "#ed623c",
"statusBarItem.remoteBackground": "#e14115",
"statusBarItem.remoteForeground": "#e7e7e7",
"titleBar.activeBackground": "#e14115",
"titleBar.activeForeground": "#e7e7e7",
"titleBar.inactiveBackground": "#e1411599",
"titleBar.inactiveForeground": "#e7e7e799"
},
"peacock.color": "#e14115"
}
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

`Carretto` is a set of utilities to improve and simplify the usage of [dataloader](https://github.com/graphql/dataloader).

[![CI](https://github.com/ducktors/carretto/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/ducktors/carretto/actions/workflows/ci.yml) [![Coverage Status](https://coveralls.io/repos/github/ducktors/carretto/badge.svg)](https://coveralls.io/github/ducktors/carretto) [![Maintainability](https://api.codeclimate.com/v1/badges/1099ccb45fa45a4d0507/maintainability)](https://codeclimate.com/github/ducktors/carretto/maintainability)

## Introduction

`Carretto` has the concept of `key` which is an object having the following shape:
Expand Down
Loading

0 comments on commit 41845af

Please sign in to comment.