Skip to content

Commit

Permalink
Merge branch 'main' into integration/sql-nested-transactions
Browse files Browse the repository at this point in the history
  • Loading branch information
janpio authored Nov 1, 2023
2 parents a8af640 + 82dc77d commit 5a0f60f
Show file tree
Hide file tree
Showing 133 changed files with 1,126 additions and 5,216 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.60/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
131 changes: 0 additions & 131 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.

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,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
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
Loading

0 comments on commit 5a0f60f

Please sign in to comment.