Skip to content

Commit

Permalink
Merge branch 'main' into integration/undici-4
Browse files Browse the repository at this point in the history
  • Loading branch information
janpio committed Jan 6, 2022
2 parents a811b01 + c7892b2 commit ac83530
Show file tree
Hide file tree
Showing 29 changed files with 1,515 additions and 1,703 deletions.
1 change: 0 additions & 1 deletion .buildkite/publish/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ services:
- MIGRATE_COMMIT
- PRISMA_CLIENT_JS_COMMIT
- PRISMA2_COMMIT
- DEVELOPMENT_ENVIRONMENT_COMMIT
- PATCH_BRANCH
- DRY_RUN
- CI
Expand Down
47 changes: 1 addition & 46 deletions .buildkite/publish/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,57 +2,12 @@

set -ex

# Thanks to https://gist.github.com/sj26/88e1c6584397bb7c13bd11108a579746
# Retry a command up to a specific numer of times until it exits successfully
#
# $ retry 5 echo Hello
# Hello
#
# $ retry 5 false
# Retry 1/5 exited 1, retrying in 20 seconds...
# Retry 2/5 exited 1, retrying in 40 seconds...
# Retry 3/5 exited 1, retrying in 80 seconds...
# Retry 4/5 exited 1, retrying in 160 seconds...
# Retry 5/5 exited 1, no more retries left.
#
function retry {
local retries=$1
shift

local count=0
until "$@"; do
exit=$?

if [ $count == 0 ]; then
wait=20
else
wait=$((2 * $wait))
fi

count=$(($count + 1))
if [ $count -lt $retries ]; then
echo "Retry $count/$retries exited $exit, retrying in $wait seconds..."
sleep $wait
else
echo "Retry $count/$retries exited $exit, no more retries left."
return $exit
fi
done
return 0
}

npm i --silent -g pnpm@6 --unsafe-perm # TODO: is this unsafe-perm needed?

retry 6 pnpm i --no-prefer-frozen-lockfile # TODO: can we maybe remove the retry?
pnpm i

pnpm run lint

# TODO: this is probably not used anymore
if [ "$DEVELOPMENT_ENVIRONMENT_COMMIT" ]; then
git stash
git checkout $DEVELOPMENT_ENVIRONMENT_COMMIT
fi

node -v
npm -v

Expand Down
44 changes: 1 addition & 43 deletions .buildkite/test/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,45 +2,6 @@

set -ex

# Thanks to https://gist.github.com/sj26/88e1c6584397bb7c13bd11108a579746
# Retry a command up to a specific numer of times until it exits successfully
#
# $ retry 5 echo Hello
# Hello
#
# $ retry 5 false
# Retry 1/5 exited 1, retrying in 20 seconds...
# Retry 2/5 exited 1, retrying in 40 seconds...
# Retry 3/5 exited 1, retrying in 80 seconds...
# Retry 4/5 exited 1, retrying in 160 seconds...
# Retry 5/5 exited 1, no more retries left.
#
function retry {
local retries=$1
shift

local count=0
until "$@"; do
exit=$?

if [ $count == 0 ]; then
wait=20
else
wait=$((2 * $wait))
fi

count=$(($count + 1))
if [ $count -lt $retries ]; then
echo "Retry $count/$retries exited $exit, retrying in $wait seconds..."
sleep $wait
else
echo "Retry $count/$retries exited $exit, no more retries left."
return $exit
fi
done
return 0
}

# The below is required as during install required engines are downloaded, so this makes sure the engines being tested are already present

# JOB 0 - Node-API Library
Expand All @@ -56,17 +17,14 @@ fi

npm i --silent -g pnpm@6 --unsafe-perm

retry 6 pnpm i --no-prefer-frozen-lockfile

pnpm i

# JOB 0
if [ "$BUILDKITE_PARALLEL_JOB" = "0" ]; then
# Only run lint for job 0
pnpm run lint
fi



node -v
npm -v

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ set -ex

npm i --silent -g pnpm@6 --unsafe-perm

pnpm i --no-prefer-frozen-lockfile
pnpm i

pnpm run setup
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ jobs:
# CLIENT (without types test)
#
client:
timeout-minutes: 20
timeout-minutes: 25
runs-on: ${{ matrix.os }}

needs: detect_jobs_to_run
Expand Down Expand Up @@ -575,7 +575,7 @@ jobs:
# minimize the time spent waiting for a free runner.
#
no-docker:
timeout-minutes: 60
timeout-minutes: 40
runs-on: ${{ matrix.os }}
needs: detect_jobs_to_run

Expand Down
16 changes: 9 additions & 7 deletions TESTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,17 @@ direnv allow

1. We use the [Jest test framework](https://jestjs.io/). Its CLI is powerful and removes the need for npm scripts mostly. For most cases this is what you need to know:

```sh
pnpm run jest <fileNamePattern> -t <testNamePattern>
```
Note: the following command `pnpm run test` can be used inside the packages folders like `packages/client`. In the base folder you can only run `pnpm run test` without extra arguments.

and to update snapshots use the -u option like this (the `--` are required, anything after the dashes will be passed to Jest):
```sh
pnpm run test <fileNamePattern> -t <testNamePattern>
```

```sh
pnpm run jest <fileNamePattern> -- -u
```
and to update snapshots use the -u option like this (the `--` are required, anything after the dashes will be passed to Jest):

```sh
pnpm run test <fileNamePattern> -- -u
```

1. In `integration-tests` [Jest's `each` feature](https://jestjs.io/docs/en/api#testeachtablename-fn-timeout) is used. If you only want to run a subset of the test cases, simply leverage the `-t` flag on the command line (see above point). For example in `packages/cli` here is how you would run Just the `findOne where PK` cases for sqlite integration:

Expand Down
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,22 @@
"@types/benchmark": "2.1.1",
"@types/glob": "7.2.0",
"@types/graphviz": "0.0.34",
"@types/node": "14.18.2",
"@types/node": "14.18.3",
"@types/redis": "2.8.32",
"@types/resolve": "1.20.1",
"@typescript-eslint/eslint-plugin": "5.4.0",
"@typescript-eslint/parser": "5.4.0",
"@typescript-eslint/eslint-plugin": "5.9.0",
"@typescript-eslint/parser": "5.9.0",
"arg": "5.0.1",
"batching-toposort": "1.2.0",
"buffer": "6.0.3",
"chalk": "4.1.2",
"chokidar": "3.5.2",
"esbuild": "0.13.14",
"esbuild-register": "3.1.2",
"eslint": "8.3.0",
"esbuild-register": "3.3.1",
"eslint": "8.6.0",
"eslint-config-prettier": "8.3.0",
"eslint-plugin-eslint-comments": "3.2.0",
"eslint-plugin-jest": "25.3.0",
"eslint-plugin-jest": "25.3.4",
"eslint-plugin-prettier": "4.0.0",
"eventemitter3": "4.0.7",
"execa": "5.1.1",
Expand All @@ -65,10 +65,10 @@
"p-reduce": "2.1.0",
"p-retry": "4.6.1",
"path-browserify": "1.0.1",
"prettier": "2.4.1",
"prettier": "2.5.1",
"redis": "3.1.2",
"redis-lock": "0.1.4",
"resolve": "1.20.0",
"resolve": "1.21.0",
"safe-buffer": "5.2.1",
"semver": "7.3.5",
"spdx-exceptions": "2.3.0",
Expand All @@ -77,7 +77,7 @@
"ts-node": "10.4.0",
"ts-toolbelt": "9.6.0",
"tty-browserify": "0.0.1",
"typescript": "4.4.4",
"typescript": "4.5.4",
"util": "0.12.4"
}
}
32 changes: 16 additions & 16 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,53 +68,53 @@
"devDependencies": {
"@prisma/client": "workspace:*",
"@prisma/debug": "workspace:*",
"@prisma/fetch-engine": "3.8.0-5.4f46a9eae52ebe9bc7c675c3e6ba65a4b614eeab",
"@prisma/fetch-engine": "3.8.0-31.9ca223420d3b050064a6f4fd76240a96b14d3908",
"@prisma/generator-helper": "workspace:*",
"@prisma/get-platform": "3.8.0-5.4f46a9eae52ebe9bc7c675c3e6ba65a4b614eeab",
"@prisma/get-platform": "3.8.0-31.9ca223420d3b050064a6f4fd76240a96b14d3908",
"@prisma/migrate": "workspace:*",
"@prisma/sdk": "workspace:*",
"@prisma/studio": "0.445.0",
"@prisma/studio-server": "0.445.0",
"@prisma/studio": "0.452.0",
"@prisma/studio-server": "0.452.0",
"@types/debug": "4.1.7",
"@types/fs-extra": "9.0.13",
"@types/jest": "27.0.3",
"@types/jest": "27.4.0",
"@types/rimraf": "3.0.2",
"@types/ws": "8.2.2",
"@typescript-eslint/eslint-plugin": "5.4.0",
"@typescript-eslint/parser": "5.4.0",
"@typescript-eslint/eslint-plugin": "5.9.0",
"@typescript-eslint/parser": "5.9.0",
"chalk": "4.1.2",
"checkpoint-client": "1.1.20",
"debug": "4.3.2",
"debug": "4.3.3",
"dotenv": "10.0.0",
"esbuild": "0.13.14",
"eslint": "8.3.0",
"eslint": "8.6.0",
"eslint-config-prettier": "8.3.0",
"eslint-plugin-eslint-comments": "3.2.0",
"eslint-plugin-jest": "25.3.0",
"eslint-plugin-jest": "25.3.4",
"eslint-plugin-prettier": "4.0.0",
"execa": "5.1.1",
"fast-deep-equal": "3.1.3",
"fs-extra": "10.0.0",
"fs-jetpack": "4.2.0",
"fs-jetpack": "4.3.0",
"get-port": "5.1.1",
"global-dirs": "3.0.0",
"is-installed-globally": "0.4.0",
"jest": "27.4.5",
"jest": "27.4.6",
"line-replace": "2.0.1",
"lint-staged": "12.0.2",
"lint-staged": "12.1.5",
"log-update": "4.0.0",
"make-dir": "3.1.0",
"node-fetch": "2.6.6",
"open": "7.4.2",
"pkg-up": "3.1.0",
"prettier": "2.4.1",
"prettier": "2.5.1",
"replace-string": "3.1.0",
"resolve-pkg": "2.0.0",
"rimraf": "3.0.2",
"strip-ansi": "6.0.1",
"tempy": "1.0.1",
"ts-jest": "27.1.2",
"typescript": "4.4.4"
"typescript": "4.5.4"
},
"scripts": {
"dev": "DEV=true node -r esbuild-register helpers/build.ts",
Expand All @@ -131,7 +131,7 @@
"precommit": "lint-staged"
},
"dependencies": {
"@prisma/engines": "3.8.0-5.4f46a9eae52ebe9bc7c675c3e6ba65a4b614eeab"
"@prisma/engines": "3.8.0-31.9ca223420d3b050064a6f4fd76240a96b14d3908"
},
"lint-staged": {
"*.ts": [
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/Studio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ ${chalk.bold('Examples')}
prismaClient: {
resolve: {
'@prisma/client': path.resolve(__dirname, '../prisma-client/index.js'),
'@prisma/engines': require.resolve('@prisma/engines'),
},
},
versions: {
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/__tests__/commands/Generate.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe('using cli', () => {
const { main } = await import(ctx.fs.path('main.ts'))
expect(cleanSnapshot(data.stdout)).toMatchSnapshot()
await expect(main()).resolves.toMatchSnapshot()
}, 30000) // timeout
}, 60000) // timeout

it('should error with exit code 1 with incorrect schema', async () => {
ctx.fixture('broken-example-project')
Expand Down

0 comments on commit ac83530

Please sign in to comment.