Skip to content

Commit

Permalink
chore: merge main, fix conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
jkomyno committed Feb 19, 2024
2 parents b9f77dd + 5a9203d commit dca41aa
Show file tree
Hide file tree
Showing 155 changed files with 2,763 additions and 1,171 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build-prisma-schema-wasm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v24

- run: nix build .#prisma-schema-wasm
- run: nix flake check
- uses: ./.github/workflows/include/rust-wasm-setup

- run: make check-schema-wasm-package PROFILE=release
25 changes: 25 additions & 0 deletions .github/workflows/include/rust-wasm-setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Rust + WASM common deps

runs:
using: "composite"
steps:
- name: Set default toolchain
shell: bash
run: rustup default stable

- name: Add WASM target
shell: bash
run: rustup target add wasm32-unknown-unknown

- uses: cargo-bins/cargo-binstall@main

- name: Install wasm-bindgen, wasm-opt
shell: bash
run: |
cargo binstall -y \
[email protected] \
[email protected]
- name: Install bc
shell: bash
run: sudo apt update && sudo apt-get install -y bc
3 changes: 0 additions & 3 deletions .github/workflows/on-push-to-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,5 @@ jobs:
git config user.email "[email protected]"
git config user.name "prisma-bot"
- name: Generate cargo docs for the workspace to gh-pages branch
run: nix run .#publish-cargo-docs

- name: Publish engines size to gh-pages branch
run: nix run .#publish-engine-size
13 changes: 6 additions & 7 deletions .github/workflows/publish-prisma-schema-wasm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@ jobs:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.enginesHash }}
- uses: cachix/install-nix-action@v24

- uses: ./.github/workflows/include/rust-wasm-setup

- name: Build
run: nix build .#prisma-schema-wasm
run: make build-schema-wasm PROFILE=release SCHEMA_WASM_VERSION=${{ github.event.inputs.enginesWrapperVersion }}

- uses: actions/setup-node@v4
with:
Expand All @@ -45,11 +46,9 @@ jobs:
- name: Set up NPM token for publishing later
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc

- 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 }}
- name: Publish @prisma/prisma-schema-wasm
run: npm publish --access public --tag ${{ github.event.inputs.npmDistTag }}
working-directory: target/prisma-schema-wasm
#
# Failure handlers
#
Expand Down
22 changes: 12 additions & 10 deletions .github/workflows/publish-query-engine-wasm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ on:
inputs:
packageVersion:
required: true
description: 'New @prisma/query-engine-wasm package version'
description: "New @prisma/query-engine-wasm package version"
enginesHash:
required: true
description: 'prisma-engines commit to build'
description: "prisma-engines commit to build"
npmDistTag:
required: true
default: 'latest'
description: 'npm dist-tag (e.g. latest or integration)'
default: "latest"
description: "npm dist-tag (e.g. latest or integration)"

jobs:
build:
Expand All @@ -30,22 +30,24 @@ jobs:
with:
ref: ${{ github.event.inputs.enginesHash }}

- uses: cachix/install-nix-action@v24
- uses: ./.github/workflows/include/rust-wasm-setup

- name: Build @prisma/query-engine-wasm
run: nix run .#export-query-engine-wasm "${{ github.event.inputs.packageVersion }}" package
run: make build-qe-wasm
env:
QE_WASM_VERSION: ${{ github.event.inputs.packageVersion }}

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
node-version: "20.x"

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

- name: Publish @prisma/query-engine-wasm
run: npm publish --access public --tag ${{ github.event.inputs.npmDistTag }}
working-directory: package
working-directory: query-engine/query-engine-wasm/pkg

#
# Failure handlers
Expand All @@ -57,7 +59,7 @@ jobs:
if: ${{ failure() }}
uses: rtCamp/[email protected]
env:
SLACK_TITLE: 'Building and publishing @prisma/query-engine-wasm failed :x:'
SLACK_COLOR: '#FF0000'
SLACK_TITLE: "Building and publishing @prisma/query-engine-wasm failed :x:"
SLACK_COLOR: "#FF0000"
SLACK_CHANNEL: feed-prisma-query-engine-wasm-publish-failures
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_WASM_FAILING }}
2 changes: 1 addition & 1 deletion .github/workflows/test-query-engine-driver-adapters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ jobs:
echo "DRIVER_ADAPTERS_BRANCH=$branch" >> "$GITHUB_ENV"
fi
- uses: cachix/install-nix-action@v24
- uses: ./.github/workflows/include/rust-wasm-setup
- uses: taiki-e/install-action@nextest

- run: make ${{ matrix.adapter.setup_task }}
Expand Down
20 changes: 15 additions & 5 deletions .github/workflows/wasm-benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ jobs:
steps:
- name: Checkout PR branch
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}

- uses: ./.github/workflows/include/rust-wasm-setup

- name: "Setup Node.js"
uses: actions/setup-node@v4
Expand All @@ -30,9 +34,6 @@ jobs:
with:
version: 8

- name: Install bc
run: sudo apt update && sudo apt-get install -y bc

- name: "Login to Docker Hub"
uses: docker/login-action@v3
continue-on-error: true
Expand All @@ -43,8 +44,14 @@ jobs:
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- uses: cachix/install-nix-action@v24

- name: Extract Branch Name
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
- name: Setup benchmark
run: make setup-pg-bench
Expand Down Expand Up @@ -122,6 +129,9 @@ jobs:

- name: Create or update report
uses: peter-evans/create-or-update-comment@v3
# Only run on branches from our repository
# It avoids an expected failure on forks
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
with:
comment-id: ${{ steps.findReportComment.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
Expand Down
31 changes: 9 additions & 22 deletions .github/workflows/wasm-size.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,13 @@ jobs:
- name: Checkout PR branch
uses: actions/checkout@v4

- uses: cachix/install-nix-action@v24
with:
# we need internet access for the moment
extra_nix_config: |
sandbox = false
- uses: ./.github/workflows/include/rust-wasm-setup

- name: Build and measure PR branch
id: measure
run: |
nix build -L .#query-engine-wasm-gz
for provider in "postgresql" "mysql" "sqlite"; do
echo "${provider}_size=$(wc --bytes < ./result/query-engine-$provider.wasm)" >> $GITHUB_OUTPUT
echo "${provider}_size_gz=$(wc --bytes < ./result/query-engine-$provider.wasm.gz)" >> $GITHUB_OUTPUT
done
export ENGINE_SIZE_OUTPUT=$GITHUB_OUTPUT
make measure-qe-wasm
base-wasm-size:
name: calculate module sizes (base branch)
Expand All @@ -62,20 +53,13 @@ jobs:
with:
ref: ${{ github.event.pull_request.base.sha }}

- uses: cachix/install-nix-action@v24
with:
extra_nix_config: |
sandbox = false
- uses: ./.github/workflows/include/rust-wasm-setup

- name: Build and measure base branch
id: measure
run: |
nix build -L .#query-engine-wasm-gz
for provider in "postgresql" "mysql" "sqlite"; do
echo "${provider}_size=$(wc --bytes < ./result/query-engine-$provider.wasm)" >> $GITHUB_OUTPUT
echo "${provider}_size_gz=$(wc --bytes < ./result/query-engine-$provider.wasm.gz)" >> $GITHUB_OUTPUT
done
export ENGINE_SIZE_OUTPUT=$GITHUB_OUTPUT
make measure-qe-wasm
report-diff:
name: report module size
Expand Down Expand Up @@ -122,6 +106,9 @@ jobs:

- name: Create or update report
uses: peter-evans/create-or-update-comment@v3
# Only run on branches from our repository
# It avoids an expected failure on forks
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
with:
comment-id: ${{ steps.findReportComment.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
Expand Down
Loading

0 comments on commit dca41aa

Please sign in to comment.