Skip to content

Commit

Permalink
feat: introduce CI template
Browse files Browse the repository at this point in the history
  • Loading branch information
claytonmarinho committed Jul 28, 2023
1 parent f47ca8c commit 354608f
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 10 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ jobs:
- ubuntu-latest
- windows-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Use Node.js ${{matrix.node-version}}
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- uses: actions/cache@v2
- uses: actions/cache@v3
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }}
Expand All @@ -37,13 +37,13 @@ jobs:
- Test
if: ${{ github.ref == 'refs/heads/main' }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: 18.x
registry-url: https://registry.npmjs.org
- uses: actions/cache@v2
- uses: actions/cache@v3
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }}
Expand Down
56 changes: 56 additions & 0 deletions .github/workflows/CI_template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Template CI
on:
push:
branches:
- main
pull_request:
branches:
- '*'
jobs:
Test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
node-version:
- 18.x
os:
- ubuntu-latest
- windows-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{matrix.node-version}}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- uses: actions/cache@v3
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }}
- name: Install dependencies
run: npm ci
- name: Run Tests 🧪
working-directory: ./packages/generator
run: npm run test
Publish:
runs-on: ubuntu-latest
needs:
- Test
if: ${{ github.ref == 'refs/heads/main' }}
steps:
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 18.x
registry-url: https://registry.npmjs.org
- uses: actions/cache@v3
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }}
- name: Install dependencies
run: npm ci
- name: Semantic release 🚀
working-directory: ./
run: npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
18 changes: 15 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,28 @@
# Prisma Generator Template

[![Template CI](https://github.com/cloudservice-io/prisma-generator-template/actions/workflows/CI_template.yml/badge.svg)](https://github.com/cloudservice-io/prisma-generator-template/actions/workflows/CI_template.yml)

This repository is a template for creating custom Prisma generators. The initial code was generated by [create-prisma-generator](https://github.com/YassinEldeeb/create-prisma-generator).

## Getting Started

**Name Your Generator**: Replace the example name with the name of your custom generator
1. **Clone this template**

2. **Name your generator**: Replace the example name with the name of your custom generator

![Screenshot 2023-07-27 at 19 44 25](https://github.com/cloudservice-io/prisma-generator-template/assets/904124/4ce1d57a-373b-44a2-adb4-0e5e5fc032ed)

**Implement Your Generator**: Replace the example code in `packages/generator` with your custom generator logic.
2. **Implement logic**: Replace the example code in `packages/generator` with your custom generator logic.

3. **Test**: Test your generator code

```
$ cd packages/generator;
$ npm t
```

**Test**: TBD.
4. **CI**: Make sure to disable CI_template workflow and that CI is activated (if you want CI for publishing your generator package).

## Contribution

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`enum generation 1`] = `
exports[`check output 1`] = `
{
"enums": {
"Language": [
Expand Down

0 comments on commit 354608f

Please sign in to comment.