Skip to content

Commit

Permalink
Add CI test containers
Browse files Browse the repository at this point in the history
  • Loading branch information
JoelLefkowitz committed Jun 27, 2024
1 parent 72be419 commit 146f1ac
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 36 deletions.
5 changes: 0 additions & 5 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
---
name: "Pull Request"
about: Open a pull request
---

# Pull Request

## Description
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
uses: actions/configure-pages@v4

- name: Build the docs
run: npm run docs
run: yarn docs

- name: Upload the artifacts
uses: actions/upload-pages-artifact@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
uses: ./.github/actions/install

- name: Build the package
run: npm run build
run: yarn build

- name: Publish the package
uses: JS-DevTools/npm-publish@v1
Expand Down
11 changes: 9 additions & 2 deletions .github/workflows/review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,17 @@ jobs:
uses: ./.github/actions/install

- name: Run linters
run: npm run lint
run: yarn lint

- name: Run tests
run: npm run test
run: |
docker run --rm -d -p 5432:5432 -e POSTGRES_DB=db -e POSTGRES_USER=user -e POSTGRES_PASSWORD=password postgres:13
docker run --rm -d -p 11211:11211 memcached:1.6.9
yarn prisma generate
yarn prisma migrate dev --schema ./test/prisma/schema.prisma
yarn test
env:
DATABASE_URL: postgresql://user:password@localhost:5432/db

- name: Publish test coverage
uses: codacy/codacy-coverage-reporter-action@v1
Expand Down
4 changes: 2 additions & 2 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
npm run lint
npm run test
yarn lint
yarn test
1 change: 1 addition & 0 deletions .trufflehog3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ exclude:

- message: Tooling outputs
paths:
- coverage
- docs/dist
- package-lock.json
- yarn-error.log
Expand Down
44 changes: 20 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ model User {
```

Create a database. In this example we create a postgres container. You can
switch db, user and password for your environment.
switch the db, user and password for your environment.

```bash
docker run --rm -d \
Expand Down Expand Up @@ -177,13 +177,19 @@ After any of the following state mutating methods we flush the cache:
- updateMany
- upsert

## Running locally
## Tooling

### Dependencies

To install dependencies:

```bash
git clone https://github.com/joellefkowitz/cached-prisma.git
yarn install
```

To start up a postgres and memcached container:
### Tests

To run tests:

```bash
docker run --rm -d \
Expand All @@ -193,53 +199,43 @@ docker run --rm -d \
-e POSTGRES_PASSWORD=password \
postgres:13

docker run -d --rm -p 11211:11211 memcached:1.6.9
```

```bash
npx prisma migrate dev --schema ./test/prisma/schema.prisma
docker run --rm -d \
-p 11211:11211 \
memcached:1.6.9
```

## Tooling

### Dependencies

To install dependencies:

```bash
yarn install
export DATABASE_URL=postgresql://user:password@localhost:5432/db
yarn prisma generate
yarn prisma migrate dev --schema ./test/prisma/schema.prisma
```

### Tests

To run tests:

```bash
npm run test
yarn test
```

### Documentation

To generate the documentation locally:

```bash
npm run docs
yarn docs
```

### Linters

To run linters:

```bash
npm run lint
yarn lint
```

### Formatters

To run formatters:

```bash
npm run format
yarn format
```

## Contributing
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@
"outDir": "dist",
"module": "CommonJS",
"moduleResolution": "node",
"target": "ES5",
"resolveJsonModule": true,
"declaration": true,
"importHelpers": false,
"removeComments": true,
"sourceMap": true,
"sourceMap": false,
"allowJs": false,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
Expand Down

0 comments on commit 146f1ac

Please sign in to comment.