Skip to content

Commit

Permalink
Merge branch 'chore/join-prepation-work' into perf/join-exp
Browse files Browse the repository at this point in the history
  • Loading branch information
Weakky committed Nov 16, 2023
2 parents 3f9d851 + 31d753f commit 2376457
Show file tree
Hide file tree
Showing 350 changed files with 3,339 additions and 5,639 deletions.
46 changes: 43 additions & 3 deletions .buildkite/engineer
Original file line number Diff line number Diff line change
@@ -1,5 +1,47 @@
#!/usr/bin/env bash

set -e

if [[ -z "$2" ]]; then
printf "Error: the name of the pipeline must be provided.\nExample: './engineer pipeline test'" 1>&2
exit 1
else
echo "We are in the $2 pipeline."
fi

# Checks what's the diff with the previous commit
# This is used to detect if the previous commit was empty
GIT_DIFF=$(git diff --name-only HEAD HEAD~1 -- .)

# Checks what's the diff with the previous commit,
# excluding some paths that do not need a run,
# because they do not affect tests running in Buildkite.
GIT_DIFF_WITH_IGNORED_PATHS=$(git diff --name-only HEAD HEAD~1 -- . ':!.github' ':!query-engine/driver-adapters/js' ':!query-engine/query-engine-wasm' ':!renovate.json' ':!*.md' ':!LICENSE' ':!CODEOWNERS';)

# $2 is either "test" or "build", depending on the pipeline
# Example: ./.buildkite/engineer pipeline test
# We only want to check for changes and skip in the test pipeline.
if [[ "$2" == "test" ]]; then
# If GIT_DIFF is empty then the previous commit was empty
# We assume it's intended and we continue with the run
# Example use: to get a new engine hash built with identical code
if [ -z "${GIT_DIFF}" ]; then
echo "The previous commit is empty, this run will continue..."
else
# Checking if GIT_DIFF_WITH_IGNORED_PATHS is empty
# If it's empty then it's most likely that there are changes but they are in ignored paths.
# So we do not start Buildkite
if [ -z "${GIT_DIFF_WITH_IGNORED_PATHS}" ]; then
echo "No changes found for the previous commit in paths that are not ignored, this run will now be skipped."
exit 0
else
# Note that printf works better for displaying line returns in CI
printf "Changes found for the previous commit in paths that are not ignored: \n\n%s\n\nThis run will continue...\n" "${GIT_DIFF_WITH_IGNORED_PATHS}"
fi
fi
fi

# Check OS
if [[ "$OSTYPE" == "linux-gnu" ]]; then
OS=linux-amzn
elif [[ "$OSTYPE" == "darwin"* ]]; then
Expand All @@ -12,8 +54,7 @@ fi
# Check if the system has engineer installed, if not, use a local copy.
if ! type "engineer" &> /dev/null; then
# Setup Prisma engine build & test tool (engineer).
set -e
curl --fail -sSL "https://prisma-engineer.s3-eu-west-1.amazonaws.com/1.59/latest/$OS/engineer.gz" --output engineer.gz
curl --fail -sSL "https://prisma-engineer.s3-eu-west-1.amazonaws.com/1.63/latest/$OS/engineer.gz" --output engineer.gz
gzip -d engineer.gz
chmod +x engineer

Expand All @@ -22,6 +63,5 @@ if ! type "engineer" &> /dev/null; then
rm -rf ./engineer
else
# Already installed on the system
set -e
engineer "$@"
fi
84 changes: 0 additions & 84 deletions .github/workflows/driver-adapter-smoke-tests.yml

This file was deleted.

83 changes: 0 additions & 83 deletions .github/workflows/publish-driver-adapters.yml

This file was deleted.

37 changes: 15 additions & 22 deletions .github/workflows/publish-prisma-schema-wasm.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Build and publish @prisma/prisma-schema-wasm
run-name: npm - release @prisma/prisma-schema-wasm@${{ github.event.inputs.enginesWrapperVersion }} from ${{ github.event.inputs.enginesHash }} on ${{ github.event.inputs.npmDistTag }}

concurrency: build-prisma-schema-wasm
concurrency: publish-prisma-schema-wasm

on:
# usually triggered via GH Actions Workflow in prisma/engines-wrapper repo
Expand All @@ -12,7 +13,7 @@ on:
required: true
npmDistTag:
required: true
default: "latest"
default: 'latest'

jobs:
build:
Expand All @@ -21,7 +22,7 @@ jobs:
steps:
- name: Print input
env:
THE_INPUT: "${{ toJson(github.event.inputs) }}"
THE_INPUT: '${{ toJson(github.event.inputs) }}'
run: |
echo $THE_INPUT
Expand All @@ -30,41 +31,33 @@ jobs:
ref: ${{ github.event.inputs.enginesHash }}
- uses: cachix/install-nix-action@v23

#
# Build
#

- run: nix build .#prisma-schema-wasm

#
# Publish
#
- name: Build
run: nix build .#prisma-schema-wasm

- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: "14.x"
node-version: '20.x'

- name: Set up NPM token
# This is needed to be done manually because of `PACKAGE_DIR` used later
- name: Set up NPM token for publishing later
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc

- run: |
- name: Update version in package.json & Publish @prisma/prisma-schema-wasm
run: |
# Update version in package.json and return directory for later usage
PACKAGE_DIR=$( nix run .#renderPrismaSchemaWasmPackage ${{ github.event.inputs.enginesWrapperVersion }})
npm publish "$PACKAGE_DIR" --access public --tag ${{ github.event.inputs.npmDistTag }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
#
# Failure handlers
#

- name: Set current job url in SLACK_FOOTER env var
if: ${{ failure() }}
run: echo "SLACK_FOOTER=<$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID|Click here to go to the job logs>" >> $GITHUB_ENV

- name: Slack Notification on Failure
if: ${{ failure() }}
uses: rtCamp/[email protected]
env:
SLACK_TITLE: "prisma-schema-wasm publishing failed :x:"
SLACK_COLOR: "#FF0000"
SLACK_TITLE: 'prisma-schema-wasm publishing failed :x:'
SLACK_COLOR: '#FF0000'
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_WASM_FAILING }}
4 changes: 4 additions & 0 deletions .github/workflows/query-engine-black-box.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ jobs:
- name: Login to Docker Hub
uses: docker/login-action@v3
continue-on-error: true
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
if: "${{ env.DOCKERHUB_USERNAME != '' && env.DOCKERHUB_TOKEN != '' }}"
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
Expand Down
19 changes: 17 additions & 2 deletions .github/workflows/query-engine-driver-adapters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,14 @@ jobs:
QUERY_BATCH_SIZE: '10'
WORKSPACE_ROOT: ${{ github.workspace }}

runs-on: buildjet-16vcpu-ubuntu-2004
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: 'Setup Node.js'
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node_version }}

Expand All @@ -66,10 +68,23 @@ jobs:
- name: 'Login to Docker Hub'
uses: docker/login-action@v3
continue-on-error: true
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
if: "${{ env.DOCKERHUB_USERNAME != '' && env.DOCKERHUB_TOKEN != '' }}"
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Extract Branch Name
id: extract-branch
run: |
branch="$(git show -s --format=%s | grep -o "DRIVER_ADAPTERS_BRANCH=[^ ]*" | cut -f2 -d=)"
if [ -n "$branch" ]; then
echo "Using $branch branch of driver adapters"
echo "DRIVER_ADAPTERS_BRANCH=$branch" >> "$GITHUB_ENV"
fi
- run: make ${{ matrix.adapter.setup_task }}

- uses: dtolnay/rust-toolchain@stable
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/query-engine.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ jobs:
- name: Login to Docker Hub
uses: docker/login-action@v3
continue-on-error: true
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
if: "${{ env.DOCKERHUB_USERNAME != '' && env.DOCKERHUB_TOKEN != '' }}"
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/schema-engine.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ jobs:
- name: Login to Docker Hub
uses: docker/login-action@v3
continue-on-error: true
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
if: "${{ env.DOCKERHUB_USERNAME != '' && env.DOCKERHUB_TOKEN != '' }}"
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,7 @@ dmmf.json
graph.dot

prisma-schema-wasm/nodejs

# Ignore pnpm-lock.yaml
query-engine/driver-adapters/pnpm-lock.yaml
package-lock.json
2 changes: 1 addition & 1 deletion CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @prisma/team-orm-rust
* @prisma/ORM-Rust
Loading

0 comments on commit 2376457

Please sign in to comment.