Skip to content

Commit

Permalink
Merge branch 'main' into qe-add-json-seriaization-span-in-binary-engine
Browse files Browse the repository at this point in the history
  • Loading branch information
janpio authored Oct 27, 2023
2 parents 095cdd3 + 9c1efed commit c0c396c
Show file tree
Hide file tree
Showing 28 changed files with 771 additions and 431 deletions.
27 changes: 19 additions & 8 deletions .buildkite/engineer
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,35 @@ 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=$(git diff --name-only HEAD HEAD~1 -- . ':!.github' ':!query-engine/driver-adapters/js' ':!renovate.json' ':!*.md' ':!LICENSE' ':!CODEOWNERS';)
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
# Checking if GIT_DIFF 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 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 "No changes found for the previous commit in paths that are not ignored, this run will now be skipped."
exit 0
echo "The previous commit is empty, this run will continue..."
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}"
# 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

Expand Down
35 changes: 14 additions & 21 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,25 +31,18 @@ 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
with:
node-version: "14.x"
node-version: '20.x'
registry-url: 'https://registry.npmjs.org/'

- name: Set up NPM token
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc

- run: |
PACKAGE_DIR=$( nix run .#renderPrismaSchemaWasmPackage ${{ github.event.inputs.enginesWrapperVersion }})
- 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 }}
Expand All @@ -60,11 +54,10 @@ jobs:
- 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 }}
1 change: 1 addition & 0 deletions .github/workflows/query-engine-black-box.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ jobs:
- name: Login to Docker Hub
uses: docker/login-action@v3
continue-on-error: true
if: "${{ secrets.DOCKERHUB_USERNAME != '' && secrets.DOCKERHUB_TOKEN != '' }}"
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/query-engine-driver-adapters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
QUERY_BATCH_SIZE: '10'
WORKSPACE_ROOT: ${{ github.workspace }}

runs-on: buildjet-16vcpu-ubuntu-2004
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

Expand All @@ -68,6 +68,7 @@ jobs:
- name: 'Login to Docker Hub'
uses: docker/login-action@v3
continue-on-error: true
if: "${{ secrets.DOCKERHUB_USERNAME != '' && secrets.DOCKERHUB_TOKEN != '' }}"
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/query-engine.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ jobs:
- name: Login to Docker Hub
uses: docker/login-action@v3
continue-on-error: true
if: "${{ secrets.DOCKERHUB_USERNAME != '' && secrets.DOCKERHUB_TOKEN != '' }}"
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/schema-engine.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ jobs:
- name: Login to Docker Hub
uses: docker/login-action@v3
continue-on-error: true
if: "${{ secrets.DOCKERHUB_USERNAME != '' && secrets.DOCKERHUB_TOKEN != '' }}"
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
Expand Down
Loading

0 comments on commit c0c396c

Please sign in to comment.