diff --git a/.github/workflows/build-engines-apple-intel.yml b/.github/workflows/build-engines-apple-intel-template.yml similarity index 58% rename from .github/workflows/build-engines-apple-intel.yml rename to .github/workflows/build-engines-apple-intel-template.yml index 05ebb4f97b33..30d8ef9697b5 100644 --- a/.github/workflows/build-engines-apple-intel.yml +++ b/.github/workflows/build-engines-apple-intel-template.yml @@ -1,15 +1,16 @@ name: Build Engines for Apple Intel + on: - workflow_dispatch: + workflow_call: inputs: commit: - description: "Commit on the given branch to build" + description: 'Commit on the given branch to build' + type: string required: false jobs: build: - # Do not change `name`, prisma-engines Buildkite build job depends on this name ending with the commit - name: "MacOS Intel engines build on branch ${{ github.event.ref }} for commit ${{ github.event.inputs.commit }}" + name: 'MacOS Intel engines build for commit ${{ inputs.commit }}' env: SQLITE_MAX_VARIABLE_NUMBER: 250000 SQLITE_MAX_EXPR_DEPTH: 10000 @@ -20,12 +21,12 @@ jobs: steps: - name: Output link to real commit - run: echo ${{ github.repository }}/commit/${{ github.event.inputs.commit }} + run: echo ${{ github.repository }}/commit/${{ inputs.commit }} - - name: Checkout ${{ github.event.inputs.commit }} + - name: Checkout ${{ inputs.commit }} uses: actions/checkout@v4 with: - ref: ${{ github.event.inputs.commit }} + ref: ${{ inputs.commit }} - uses: actions-rust-lang/setup-rust-toolchain@v1 @@ -35,16 +36,27 @@ jobs: ~/.cargo/registry ~/.cargo/git target - key: ${{ runner.os }}-intel-cargo-${{ hashFiles('**/Cargo.lock') }} + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - run: | cargo build --release -p query-engine -p query-engine-node-api -p schema-engine-cli -p prisma-fmt + - name: Rename files + working-directory: ${{ github.workspace }}/target/release/ + run: | + echo "Files in target/release before renaming" + ls -la . + + mv libquery_engine.dylib libquery_engine.dylib.node + + echo "Files in target/release after renaming" + ls -la . + - uses: actions/upload-artifact@v4 with: - name: binaries + name: darwin path: | ${{ github.workspace }}/target/release/schema-engine ${{ github.workspace }}/target/release/prisma-fmt ${{ github.workspace }}/target/release/query-engine - ${{ github.workspace }}/target/release/libquery_engine.dylib + ${{ github.workspace }}/target/release/libquery_engine.dylib.node diff --git a/.github/workflows/build-engines-apple-silicon.yml b/.github/workflows/build-engines-apple-silicon-template.yml similarity index 61% rename from .github/workflows/build-engines-apple-silicon.yml rename to .github/workflows/build-engines-apple-silicon-template.yml index 959c0e935653..de136018a2c2 100644 --- a/.github/workflows/build-engines-apple-silicon.yml +++ b/.github/workflows/build-engines-apple-silicon-template.yml @@ -1,15 +1,16 @@ name: Build Engines for Apple Silicon + on: - workflow_dispatch: + workflow_call: inputs: commit: - description: "Commit on the given branch to build" + description: 'Commit on the given branch to build' + type: string required: false jobs: build: - # Do not change `name`, prisma-engines Buildkite build job depends on this name ending with the commit - name: "MacOS ARM64 (Apple Silicon) engines build on branch ${{ github.event.ref }} for commit ${{ github.event.inputs.commit }}" + name: 'MacOS ARM64 (Apple Silicon) engines build for commit ${{ inputs.commit }}' env: SQLITE_MAX_VARIABLE_NUMBER: 250000 SQLITE_MAX_EXPR_DEPTH: 10000 @@ -17,17 +18,16 @@ jobs: steps: - name: Output link to real commit - run: echo ${{ github.repository }}/commit/${{ github.event.inputs.commit }} + run: echo ${{ github.repository }}/commit/${{ inputs.commit }} - - name: Checkout ${{ github.event.inputs.commit }} + - name: Checkout ${{ inputs.commit }} uses: actions/checkout@v4 with: - ref: ${{ github.event.inputs.commit }} + ref: ${{ inputs.commit }} - - uses: actions-rust-lang/setup-rust-toolchain@v1 + - run: xcodebuild -showsdks - - name: Install aarch64 toolchain - run: rustup target add aarch64-apple-darwin + - uses: actions-rust-lang/setup-rust-toolchain@v1 - uses: actions/cache@v4 with: @@ -37,16 +37,25 @@ jobs: target key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - - run: xcodebuild -showsdks - - run: | cargo build --target=aarch64-apple-darwin --release -p query-engine -p query-engine-node-api -p schema-engine-cli -p prisma-fmt + - name: Rename files + working-directory: ${{ github.workspace }}/target/aarch64-apple-darwin/release + run: | + echo "Files in target/release before renaming" + ls -la . + + mv libquery_engine.dylib libquery_engine.dylib.node + + echo "Files in target/release after renaming" + ls -la . + - uses: actions/upload-artifact@v4 with: - name: binaries + name: darwin-arm64 path: | ${{ github.workspace }}/target/aarch64-apple-darwin/release/schema-engine ${{ github.workspace }}/target/aarch64-apple-darwin/release/prisma-fmt ${{ github.workspace }}/target/aarch64-apple-darwin/release/query-engine - ${{ github.workspace }}/target/aarch64-apple-darwin/release/libquery_engine.dylib + ${{ github.workspace }}/target/aarch64-apple-darwin/release/libquery_engine.dylib.node diff --git a/.github/workflows/build-engines-linux-template.yml b/.github/workflows/build-engines-linux-template.yml new file mode 100644 index 000000000000..7fa0446b420e --- /dev/null +++ b/.github/workflows/build-engines-linux-template.yml @@ -0,0 +1,202 @@ +name: Build Engines for Linux + +on: + workflow_call: + inputs: + commit: + description: 'Commit on the given branch to build' + type: string + required: false + +jobs: + build: + name: '${{ matrix.target.name }} for commit ${{ inputs.commit }}' + runs-on: ubuntu-22.04 + + strategy: + fail-fast: false + matrix: + # ⚠️ The target names are used to dtermine the directory name when uploaded to the buckets. + # Do not change them. + target: + # Linux Glibc + - name: 'rhel-openssl-1.0.x' + image: 'prismagraphql/build:rhel-libssl1.0.x' + target_string: '' + target_path: '' + features_string: '--features vendored-openssl' + - name: 'rhel-openssl-1.1.x' + image: 'prismagraphql/build:rhel-libssl1.1.x' + target_string: '' + target_path: '' + features_string: '' + - name: 'rhel-openssl-3.0.x' + image: 'prismagraphql/build:rhel-libssl3.0.x' + target_string: '' + target_path: '' + features_string: '' + # Linux Musl + # A better name would be "linux-musl-openssl-1.1.x" + # But we keep the old name for compatibility reasons + - name: 'linux-musl' + image: 'prismagraphql/build:alpine-libssl1.1.x' + target_string: '' + target_path: '' + features_string: '' + - name: 'linux-musl-openssl-3.0.x' + image: 'prismagraphql/build:alpine-libssl3.0.x' + target_string: '' + target_path: '' + features_string: '' + # Linux Static x86_64 + # Note that the name should have "-static-" + # Because we look for "-static-" later in the construct_build_command step + - name: 'linux-static-x64' + image: 'prismagraphql/build:linux-static-x64' + target_string: '--target x86_64-unknown-linux-musl' + target_path: 'x86_64-unknown-linux-musl' + features_string: '--features vendored-openssl' + # Linux Glibc ARM64 + - name: 'linux-arm64-openssl-1.0.x' + image: 'prismagraphql/build:cross-linux-arm-ssl-1.0.x' + target_string: '--target aarch64-unknown-linux-gnu' + target_path: 'aarch64-unknown-linux-gnu' + features_string: '--features vendored-openssl' + - name: 'linux-arm64-openssl-1.1.x' + image: 'prismagraphql/build:cross-linux-arm-ssl-1.1.x' + target_string: '--target aarch64-unknown-linux-gnu' + target_path: 'aarch64-unknown-linux-gnu' + features_string: '' + - name: 'linux-arm64-openssl-3.0.x' + image: 'prismagraphql/build:cross-linux-arm-ssl-3.0.x' + target_string: '--target aarch64-unknown-linux-gnu' + target_path: 'aarch64-unknown-linux-gnu' + features_string: '' + # Linux Musl ARM64 + - name: 'linux-musl-arm64-openssl-1.1.x' + image: 'prismagraphql/build:cross-linux-musl-arm-ssl-1.1.x' + target_string: '--target aarch64-unknown-linux-musl' + target_path: 'aarch64-unknown-linux-musl' + features_string: '' + - name: 'linux-musl-arm64-openssl-3.0.x' + image: 'prismagraphql/build:cross-linux-musl-arm-ssl-3.0.x' + target_string: '--target aarch64-unknown-linux-musl' + target_path: 'aarch64-unknown-linux-musl' + features_string: '' + # Linux Static ARM64 + # Note that the name should have "-static-" + # Because we look for "-static-" later in the construct_build_command step + - name: 'linux-static-arm64' + image: 'prismagraphql/build:linux-static-arm64' + target_string: '--target aarch64-unknown-linux-musl' + target_path: 'aarch64-unknown-linux-musl' + features_string: '--features vendored-openssl' + + steps: + - name: Output link to commit + if: ${{ inputs.commit }} + run: echo https://github.com/prisma/prisma-engines/commit/${{ inputs.commit }} + + - name: Checkout ${{ inputs.commit }} + uses: actions/checkout@v4 + with: + ref: ${{ inputs.commit }} + + - uses: actions/cache@v4 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: ${{ runner.os }}-cargo- + + - name: Construct build command + id: construct_build_command + env: + TARGET_NAME: ${{ matrix.target.name }} + IMAGE: ${{ matrix.target.image }} + TARGET_STRING: ${{ matrix.target.target_string }} + FEATURES_STRING: ${{ matrix.target.features_string }} + run: | + set -eux; + + command=$(bash .github/workflows/utils/constructDockerBuildCommand.sh) + + # store command in GitHub output + echo "COMMAND=$command" >> "$GITHUB_OUTPUT" + + - name: Show Build Command + env: + COMMAND: ${{ steps.construct_build_command.outputs.COMMAND }}" + run: echo "Build command is $COMMAND" + + - name: Execute Build command + run: ${{ steps.construct_build_command.outputs.command }} + + - name: Prepare files for "release" target + if: ${{ matrix.target.target_path == '' }} + env: + TARGET_NAME: ${{ matrix.target.name }} + RELEASE_DIR: ${{ github.workspace }}/target/release + run: | + echo "Files in target/release before renaming" + ls -la $RELEASE_DIR + + echo "Copying files to engines-artifacts" + cp -r $RELEASE_DIR/ engines-artifacts + + echo "Rename libquery_engine.so to libquery_engine.so.node for non-static targets" + if [[ "$TARGET_NAME" == *-static-* ]]; then + echo "Current target is static. Skipping." + else + mv engines-artifacts/libquery_engine.so engines-artifacts/libquery_engine.so.node + fi + + echo "Files in engines-artifacts after renaming" + ls -la engines-artifacts + + - name: Upload artifacts for "release" target + uses: actions/upload-artifact@v4 + if: ${{ matrix.target.target_path == '' }} + with: + name: '${{ matrix.target.name }}' + path: | + ${{ github.workspace }}/engines-artifacts/libquery_engine.so.node + ${{ github.workspace }}/engines-artifacts/schema-engine + ${{ github.workspace }}/engines-artifacts/query-engine + ${{ github.workspace }}/engines-artifacts/prisma-fmt + + - name: Prepare files for "${{ matrix.target.name }}" target + if: ${{ matrix.target.target_path != '' }} + env: + TARGET_NAME: ${{ matrix.target.name }} + RELEASE_DIR: ${{ github.workspace }}/target/${{ matrix.target.target_path }}/release + run: | + echo "Files in target/release before renaming" + ls -la $RELEASE_DIR + + echo "Copying files to engines-artifacts" + cp -r $RELEASE_DIR/ engines-artifacts + + echo "Rename libquery_engine.so to libquery_engine.so.node for non-static targets" + if [[ "$TARGET_NAME" == *-static-* ]]; then + echo "Current target is static. Skipping." + else + mv engines-artifacts/libquery_engine.so engines-artifacts/libquery_engine.so.node + fi + + echo "Files in engines-artifacts after renaming" + ls -la engines-artifacts + + - name: Upload artifacts for "${{ matrix.target.name }}" target + uses: actions/upload-artifact@v4 + if: ${{ matrix.target.target_path != '' }} + with: + name: ${{ matrix.target.name }} + path: | + ${{ github.workspace }}/engines-artifacts/libquery_engine.so.node + ${{ github.workspace }}/engines-artifacts/schema-engine + ${{ github.workspace }}/engines-artifacts/query-engine + ${{ github.workspace }}/engines-artifacts/prisma-fmt diff --git a/.github/workflows/build-engines-react-native-template.yml b/.github/workflows/build-engines-react-native-template.yml new file mode 100644 index 000000000000..610901b2d031 --- /dev/null +++ b/.github/workflows/build-engines-react-native-template.yml @@ -0,0 +1,96 @@ +name: Build Engines for React native + +on: + workflow_call: + inputs: + commit: + description: 'Commit on the given branch to build' + type: string + required: false + +jobs: + build-ios: + name: 'iOS build for commit ${{ inputs.commit }}' + runs-on: macos-14 + + steps: + - name: Output link to real commit + run: echo ${{ github.repository }}/commit/${{ inputs.commit }} + + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ inputs.commit }} + + - uses: actions/cache@v4 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: ${{ runner.os }}-cargo- + + - uses: dtolnay/rust-toolchain@stable + with: + targets: x86_64-apple-ios,aarch64-apple-ios,aarch64-apple-ios-sim + + - run: | + cd query-engine/query-engine-c-abi + make ios + + - name: Print files + working-directory: ${{ github.workspace }}/query-engine/query-engine-c-abi/ios/ + run: | + ls -la . + + - uses: actions/upload-artifact@v4 + with: + name: ios + path: | + ${{ github.workspace }}/query-engine/query-engine-c-abi/ios/* + + build-android: + name: 'Android build for commit ${{ inputs.commit }}' + runs-on: ubuntu-latest + + steps: + - name: Output link to real commit + run: echo ${{ github.repository }}/commit/${{ inputs.commit }} + + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ inputs.commit }} + + - uses: actions/cache@v4 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: ${{ runner.os }}-cargo- + + - uses: actions-rust-lang/setup-rust-toolchain@v1 + + - uses: nttld/setup-ndk@v1 + with: + ndk-version: r26d + + - run: | + cd query-engine/query-engine-c-abi + make android + + - name: Print files + working-directory: ${{ github.workspace }}/query-engine/query-engine-c-abi/android/ + run: | + ls -la . + + - uses: actions/upload-artifact@v4 + with: + name: android + path: | + ${{ github.workspace }}/query-engine/query-engine-c-abi/android/* diff --git a/.github/workflows/build-engines-react-native.yml b/.github/workflows/build-engines-react-native.yml deleted file mode 100644 index 235fc633fd3c..000000000000 --- a/.github/workflows/build-engines-react-native.yml +++ /dev/null @@ -1,101 +0,0 @@ -name: Build Engines for React native -on: - workflow_dispatch: - inputs: - commit: - description: "Commit on the given branch to build" - required: false - -jobs: - build-ios: - # Do not change `name`, prisma-engines Buildkite build job depends on this name ending with the commit - name: "iOS build on branch ${{ github.event.ref }} for commit ${{ github.event.inputs.commit }}" - runs-on: macos-14 - - steps: - - name: Output link to real commit - run: echo ${{ github.repository }}/commit/${{ github.event.inputs.commit }} - - - name: Checkout - uses: actions/checkout@v4 - with: - ref: ${{ github.event.inputs.commit }} - - - uses: actions-rust-lang/setup-rust-toolchain@v1 - with: - targets: x86_64-apple-ios,aarch64-apple-ios,aarch64-apple-ios-sim - - - uses: actions/cache@v4 - with: - path: | - ~/.cargo/registry - ~/.cargo/git - target - key: ${{ runner.os }}-ios-cargo-${{ hashFiles('**/Cargo.lock') }} - - - run: | - cd query-engine/query-engine-c-abi - make ios - - uses: actions/upload-artifact@v4 - with: - name: ios - path: | - ${{ github.workspace }}/query-engine/query-engine-c-abi/ios/* - - build-android: - # Do not change `name`, prisma-engines Buildkite build job depends on this name ending with the commit - name: "Android build on branch ${{ github.event.ref }} for commit ${{ github.event.inputs.commit }}" - runs-on: ubuntu-latest - - steps: - - name: Output link to real commit - run: echo ${{ github.repository }}/commit/${{ github.event.inputs.commit }} - - - name: Checkout - uses: actions/checkout@v4 - with: - ref: ${{ github.event.inputs.commit }} - - uses: actions-rust-lang/setup-rust-toolchain@v1 - with: - targets: aarch64-linux-android,armv7-linux-androideabi,x86_64-linux-android,i686-linux-android - - - uses: nttld/setup-ndk@v1 - with: - ndk-version: r26d - - - uses: actions/cache@v4 - with: - path: | - ~/.cargo/registry - ~/.cargo/git - target - key: ${{ runner.os }}-android-cargo-${{ hashFiles('**/Cargo.lock') }} - - - run: | - cd query-engine/query-engine-c-abi - make android - - - uses: actions/upload-artifact@v4 - with: - name: android - path: | - ${{ github.workspace }}/query-engine/query-engine-c-abi/android/* - combine-artifacts: - # Do not change `name`, prisma-engines Buildkite build job depends on this name ending with the commit - name: "Combine iOS and Android artifacts on branch ${{ github.event.ref }} for commit ${{ github.event.inputs.commit }}" - runs-on: ubuntu-latest - needs: - - build-ios - - build-android - steps: - - name: Download artifacts - uses: actions/download-artifact@v4 - - - name: Upload combined artifact - uses: actions/upload-artifact@v4 - with: - name: binaries - path: | - ${{ github.workspace }}/ios - ${{ github.workspace }}/android - diff --git a/.github/workflows/build-engines-windows-template.yml b/.github/workflows/build-engines-windows-template.yml new file mode 100644 index 000000000000..a129393a87c9 --- /dev/null +++ b/.github/workflows/build-engines-windows-template.yml @@ -0,0 +1,62 @@ +name: Build Engines for Windows + +on: + workflow_call: + inputs: + commit: + description: 'Commit on the given branch to build' + type: string + required: false + +jobs: + build: + name: 'Windows engines build for commit ${{ inputs.commit }}' + env: + SQLITE_MAX_VARIABLE_NUMBER: 250000 + SQLITE_MAX_EXPR_DEPTH: 10000 + RUSTFLAGS: '-C target-feature=+crt-static' + runs-on: windows-latest + + steps: + - name: Output link to real commit + run: echo ${{ github.repository }}/commit/${{ inputs.commit }} + + - name: Checkout ${{ inputs.commit }} + uses: actions/checkout@v4 + with: + ref: ${{ inputs.commit }} + + - uses: actions/cache@v4 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: ${{ runner.os }}-cargo- + + - uses: actions-rust-lang/setup-rust-toolchain@v1 + + - run: cargo build --release -p query-engine -p query-engine-node-api -p schema-engine-cli -p prisma-fmt + + - name: Rename files + working-directory: ${{ github.workspace }}/target/release/ + run: | + echo "Files in target/release before renaming" + ls . + + mv query_engine.dll query_engine.dll.node + mv query-engine.exe query-engine.exe + + echo "Files in target/release after renaming" + ls . + + - uses: actions/upload-artifact@v4 + with: + name: windows + path: | + ${{ github.workspace }}/target/release/prisma-fmt.exe + ${{ github.workspace }}/target/release/schema-engine.exe + ${{ github.workspace }}/target/release/query-engine.exe + ${{ github.workspace }}/target/release/query_engine.dll.node diff --git a/.github/workflows/build-engines.yml b/.github/workflows/build-engines.yml new file mode 100644 index 000000000000..6147eda68d11 --- /dev/null +++ b/.github/workflows/build-engines.yml @@ -0,0 +1,326 @@ +name: Build Engines +run-name: Build Engines for ${{ github.sha }} + +# Run on `push` only for main, if not it will trigger `push` & `pull_request` on PRs at the same time +on: + push: + branches: + - main + - '*.*.x' + - 'integration/*' + paths-ignore: + - '!.github/workflows/build-engines*' + - '.github/**' + - '.buildkite/**' + - '*.md' + - 'LICENSE' + - 'CODEOWNERS' + - 'renovate.json' + workflow_dispatch: + pull_request: + paths-ignore: + - '!.github/workflows/build-engines*' + - '.github/**' + - '.buildkite/**' + - '*.md' + - 'LICENSE' + - 'CODEOWNERS' + - 'renovate.json' + +jobs: + is-release-necessary: + name: 'Decide if a release of the engines artifacts is necessary' + runs-on: ubuntu-22.04 + outputs: + release: ${{ steps.decision.outputs.release }} + steps: + - uses: actions/checkout@v4 + with: + # using head ref rather than merge branch to get original commit message + ref: ${{ github.event.pull_request.head.sha }} + - name: Get commit message + id: commit-msg + run: | + commit_msg=$(git log --format=%B -n 1) + echo 'commit-msg<> $GITHUB_OUTPUT + echo "$commit_msg" >> $GITHUB_OUTPUT + echo 'EOF' >> $GITHUB_OUTPUT + + - name: Debug Pull Request Event + if: ${{ github.event_name == 'pull_request' }} + run: | + echo "Pull Request: ${{ github.event.pull_request.number }}" + echo "Repository Owner: $${{ github.repository_owner }}" + echo "Pull Request Author: ${{ github.actor }}" + echo "Pull Request Author Association: ${{ github.event.pull_request.author_association }}" + echo "Commit message:${{ steps.commit-msg.outputs.commit-msg }}" + echo "Commit message contains [integration]: ${{ contains(steps.commit-msg.outputs.commit-msg, '[integration]') }}" + + - name: 'Check if commit message conatains `[integration]` and the PR author has permissions to trigger the workflow' + id: check-commit-message + # See https://docs.github.com/en/graphql/reference/enums + # https://michaelheap.com/github-actions-check-permission/ + # Check if + # - the commit message contains `[integration]` + # - the PR author has permissions to trigger the workflow (must be part of the org or a collaborator) + if: | + github.event_name == 'pull_request' && + contains(steps.commit-msg.outputs.commit-msg, '[integration]') && + ( + github.event.pull_request.author_association == 'OWNER' || + github.event.pull_request.author_association == 'MEMBER' || + github.event.pull_request.author_association == 'COLLABORATOR' + ) + run: | + echo "Commit message contains [integration] and PR author has permissions" + # set value to GitHub output + echo "release=true" >> $GITHUB_OUTPUT + + # + # A patch branch (e.g. "4.6.x") + # + - name: Check if branch is a patch or integration branch + id: check-branch + uses: actions/github-script@v7 + env: + BRANCH: ${{ github.ref }} + with: + script: | + const { BRANCH } = process.env + const parts = BRANCH.split('.') + if (parts.length === 3 && parts[2] === 'x') { + console.log(`Branch is a patch branch: ${BRANCH}`) + core.setOutput('release', true) + } else if (BRANCH.startsWith("integration/")) { + console.log(`Branch is an "integration/" branch: ${BRANCH}`) + core.setOutput('release', true) + } else { + core.setOutput('release', false) + } + + - name: Debug event & outputs + env: + EVENT_NAME: ${{ github.event_name }} + EVENT_PATH: ${{ github.event_path }} + CHECK_COMMIT_MESSAGE: ${{ steps.check-commit-message.outputs.release }} + CHECK_BRANCH: ${{ steps.check-branch.outputs.release }} + run: | + echo "Event Name: $EVENT_NAME" + echo "Event path: $EVENT_PATH" + echo "Check Commit Message outputs: $CHECK_COMMIT_MESSAGE" + echo "Check branch: $CHECK_BRANCH" + + - name: Release is necessary! + # https://github.com/peter-evans/find-comment/tree/v3/?tab=readme-ov-file#outputs + # Tip: Empty strings evaluate to zero in GitHub Actions expressions. e.g. If comment-id is an empty string steps.fc.outputs.comment-id == 0 evaluates to true. + if: | + github.event_name == 'workflow_dispatch' || + github.event_name == 'push' || + steps.check-commit-message.outputs.release == 'true' || + steps.check-branch.outputs.release == 'true' + + id: decision + env: + EVENT_NAME: ${{ github.event_name }} + EVENT_PATH: ${{ github.event_path }} + CHECK_COMMIT_MESSAGE: ${{ steps.check-commit-message.outputs.release }} + CHECK_BRANCH: ${{ steps.check-branch.outputs.release }} + run: | + echo "Event Name: $EVENT_NAME" + echo "Event path: $EVENT_PATH" + echo "Check Commit Message outputs: $CHECK_COMMIT_MESSAGE" + echo "Check branch: $CHECK_BRANCH" + + echo "Release is necessary" + echo "release=true" >> $GITHUB_OUTPUT + + build-linux: + name: Build Engines for Linux + needs: + - is-release-necessary + if: ${{ needs.is-release-necessary.outputs.release == 'true' }} + uses: ./.github/workflows/build-engines-linux-template.yml + with: + commit: ${{ github.sha }} + + build-macos-intel: + name: Build Engines for Apple Intel + needs: + - is-release-necessary + if: ${{ needs.is-release-necessary.outputs.release == 'true' }} + uses: ./.github/workflows/build-engines-apple-intel-template.yml + with: + commit: ${{ github.sha }} + + build-macos-silicon: + name: Build Engines for Apple Silicon + needs: + - is-release-necessary + if: ${{ needs.is-release-necessary.outputs.release == 'true' }} + uses: ./.github/workflows/build-engines-apple-silicon-template.yml + with: + commit: ${{ github.sha }} + + build-react-native: + name: Build Engines for React native + needs: + - is-release-necessary + if: ${{ needs.is-release-necessary.outputs.release == 'true' }} + uses: ./.github/workflows/build-engines-react-native-template.yml + with: + commit: ${{ github.sha }} + + build-windows: + name: Build Engines for Windows + needs: + - is-release-necessary + if: ${{ needs.is-release-necessary.outputs.release == 'true' }} + uses: ./.github/workflows/build-engines-windows-template.yml + with: + commit: ${{ github.sha }} + + release-artifacts: + name: 'Release artifacts from branch ${{ github.head_ref || github.ref_name }} for commit ${{ github.sha }}' + runs-on: ubuntu-22.04 + concurrency: + group: ${{ github.sha }} + needs: + - build-linux + - build-macos-intel + - build-macos-silicon + - build-react-native + - build-windows + env: + BUCKET_NAME: 'prisma-builds' + PRISMA_ENGINES_COMMIT_SHA: ${{ github.sha }} + DESTINATION_TARGET_PATH: 's3://prisma-builds/all_commits/${{ github.sha }}' + + steps: + # Because we need the scripts + - name: Checkout git repository + uses: actions/checkout@v4 + + - uses: actions/download-artifact@v4 + with: + path: engines-artifacts + # For debug purposes + # A previous run ID can be specified, to avoid the build step + # First disable the build step, then specify the run ID + # The github-token is mandatory for this to work + # https://github.com/prisma/prisma-engines-builds/actions/runs/9526334324 + # run-id: 9526334324 + # github-token: ${{ secrets.GITHUB_TOKEN }} + + - name: 'R2: Check if artifacts were already built and uploaded before via `.finished` file' + env: + FILE_PATH: 'all_commits/${{ github.sha }}/.finished' + FILE_PATH_LEGACY: 'all_commits/${{ github.sha }}/rhel-openssl-1.1.x/.finished' + AWS_DEFAULT_REGION: 'auto' + AWS_ACCESS_KEY_ID: ${{ vars.R2_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }} + AWS_ENDPOINT_URL_S3: ${{ vars.R2_ENDPOINT }} + working-directory: .github/workflows/utils + run: bash checkFinishedMarker.sh + + - name: 'S3: Check if artifacts were already built and uploaded before via `.finished` file' + env: + FILE_PATH: 'all_commits/${{ github.sha }}/.finished' + FILE_PATH_LEGACY: 'all_commits/${{ github.sha }}/rhel-openssl-1.1.x/.finished' + AWS_DEFAULT_REGION: 'eu-west-1' + AWS_ACCESS_KEY_ID: ${{ vars.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + working-directory: .github/workflows/utils + run: bash checkFinishedMarker.sh + + - name: Display structure of downloaded files + run: ls -Rl engines-artifacts + + # TODO in a next major version of Prisma: remove this, and replace both `Debian` and `Rhel` with a single `LinuxGlibc`/`LinuxGnu` option. + - name: Duplicate engines for debian + working-directory: engines-artifacts + run: | + cp -r rhel-openssl-1.0.x debian-openssl-1.0.x + cp -r rhel-openssl-1.1.x debian-openssl-1.1.x + cp -r rhel-openssl-3.0.x debian-openssl-3.0.x + + - name: Create .zip for react-native + working-directory: engines-artifacts + run: | + mkdir react-native + zip -r react-native/binaries.zip ios android + rm -rf ios android + + - name: 'Create compressed engine files (.gz)' + working-directory: engines-artifacts + run: | + set -eu + + find . -type f -not -name "*.zip" | while read filename; do + gzip -c "$filename" > "$filename.gz" + echo "$filename.gz file created." + done + + ls -Rl . + + - name: 'Create SHA256 checksum files (.sha256).' + working-directory: engines-artifacts + run: | + set -eu + + find . -type f | while read filename; do + sha256sum "$filename" > "$filename.sha256" + echo "$filename.sha256 file created." + done + + ls -Rl . + + # https://github.com/crazy-max/ghaction-import-gpg + - name: Import GPG key + # See https://github.com/crazy-max/ghaction-import-gpg/releases + # v6 -> 01dd5d3ca463c7f10f7f4f7b4f177225ac661ee4 + # For security reasons, we should pin the version of the action + uses: crazy-max/ghaction-import-gpg@01dd5d3ca463c7f10f7f4f7b4f177225ac661ee4 + with: + gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} + passphrase: ${{ secrets.GPG_KEY_PASSPHRASE }} + + - name: List keys + run: gpg -K + + # next to each file (excluding .sha256 files) + - name: 'Create a GPG detached signature (.sig)' + working-directory: engines-artifacts + run: | + set -eu + + for file in $(find . -type f ! -name "*.sha256"); do + gpg --detach-sign --armor --batch --output "${file#*/}.sig" "$file" + done + + ls -Rl . + + - name: 'Cloudflare R2: Upload to bucket and verify uploaded files then create `.finished` file' + # https://docs.aws.amazon.com/cli/v1/userguide/cli-configure-envvars.html + env: + AWS_DEFAULT_REGION: 'auto' + AWS_ACCESS_KEY_ID: ${{ vars.R2_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }} + AWS_ENDPOINT_URL_S3: ${{ vars.R2_ENDPOINT }} + run: bash .github/workflows/utils/uploadAndVerify.sh engines-artifacts-for-r2 + + - name: 'AWS S3: Upload to bucket and verify uploaded files then create `.finished` file' + env: + AWS_DEFAULT_REGION: 'eu-west-1' + AWS_ACCESS_KEY_ID: ${{ vars.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + run: bash .github/workflows/utils/uploadAndVerify.sh engines-artifacts-for-s3 + + - name: Repository dispatch to prisma/engines-wrapper + uses: peter-evans/repository-dispatch@v3 + with: + repository: prisma/engines-wrapper + event-type: publish-engines + client-payload: '{ "commit": "${{ github.sha }}", "branch": "${{ github.head_ref || github.ref_name }}" }' + token: ${{ secrets.PRISMA_BOT_TOKEN }} + - name: Cleanup local directories + run: rm -rf engines-artifacts engines-artifacts-for-r2 engines-artifacts-for-s3 diff --git a/.github/workflows/test-query-engine-driver-adapters.yml b/.github/workflows/test-driver-adapters-template.yml similarity index 58% rename from .github/workflows/test-query-engine-driver-adapters.yml rename to .github/workflows/test-driver-adapters-template.yml index 011342f65fcd..c922e4bb7f1b 100644 --- a/.github/workflows/test-query-engine-driver-adapters.yml +++ b/.github/workflows/test-driver-adapters-template.yml @@ -1,48 +1,18 @@ name: "QE: driver-adapter integration tests" on: - push: - branches: - - main - pull_request: - paths-ignore: - - "!.github/workflows/test-query-engine-driver-adapters.yml" - - ".github/**" - - ".buildkite/**" - - "*.md" - - "LICENSE" - - "CODEOWNERS" - - "renovate.json" - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true + workflow_call: + inputs: + setup_task: + type: string + required: true jobs: rust-query-engine-tests: - name: "${{ matrix.adapter.name }} ${{ matrix.partition }}" + name: "${{ matrix.partition }}" strategy: fail-fast: false matrix: - adapter: - - name: "planetscale (napi)" - setup_task: "dev-planetscale-js" - - name: "pg (napi)" - setup_task: "dev-pg-js" - - name: "neon (napi)" - setup_task: "dev-neon-js" - - name: "libsql (napi)" - setup_task: "dev-libsql-js" - - name: "planetscale (wasm)" - setup_task: "dev-planetscale-wasm" - - name: "pg (wasm)" - setup_task: "dev-pg-wasm" - - name: "neon (wasm)" - setup_task: "dev-neon-wasm" - - name: "libsql (wasm)" - setup_task: "dev-libsql-wasm" - - name: "d1 (wasm)" - setup_task: "dev-d1" node_version: ["18"] partition: ["1/4", "2/4", "3/4", "4/4"] env: @@ -61,9 +31,6 @@ jobs: 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@v4 with: @@ -74,11 +41,6 @@ jobs: with: version: 8 - - name: "Get pnpm store directory" - shell: bash - run: | - echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV - - name: "Login to Docker Hub" uses: docker/login-action@v3 continue-on-error: true @@ -102,7 +64,12 @@ jobs: - uses: ./.github/workflows/include/rust-wasm-setup - uses: taiki-e/install-action@nextest - - run: make ${{ matrix.adapter.setup_task }} + - name: Setup + env: + SETUP_TASK: ${{ inputs.setup_task }} + run: make "$SETUP_TASK" - name: "Run tests" - run: cargo nextest run --package query-engine-tests --test-threads=1 --partition hash:${{ matrix.partition }} + env: + PARTITION: ${{ matrix.partition }} + run: cargo nextest run --package query-engine-tests --test-threads=1 --partition hash:"$PARTITION" diff --git a/.github/workflows/test-query-engine-template.yml b/.github/workflows/test-query-engine-template.yml new file mode 100644 index 000000000000..5a9c3d692d7c --- /dev/null +++ b/.github/workflows/test-query-engine-template.yml @@ -0,0 +1,77 @@ +name: "QE: integration template" +run-name: ${{ inputs.connector }} +on: + workflow_call: + inputs: + name: + type: string + required: true + connector: + type: string + required: true + version: + type: string + required: true + single_threaded: + type: boolean + default: false + relation_load_strategy: + type: string + default: '["join", "query"]' + + +jobs: + rust-query-engine-tests: + name: "${{ matrix.engine_protocol }} ${{ matrix.relation_load_strategy }} ${{ matrix.partition }}" + + strategy: + fail-fast: false + matrix: + engine_protocol: [graphql, json] + relation_load_strategy: ${{ fromJson(inputs.relation_load_strategy) }} + partition: ["1/4", "2/4", "3/4", "4/4"] + + env: + LOG_LEVEL: "info" + LOG_QUERIES: "y" + RUST_LOG_FORMAT: "devel" + RUST_BACKTRACE: "1" + CLICOLOR_FORCE: "1" + CLOSED_TX_CLEANUP: "2" + SIMPLE_TEST_MODE: "1" + QUERY_BATCH_SIZE: "10" + TEST_RUNNER: "direct" + TEST_CONNECTOR: ${{ inputs.connector }} + TEST_CONNECTOR_VERSION: ${{ inputs.version }} + PRISMA_ENGINE_PROTOCOL: ${{ matrix.engine_protocol }} + PRISMA_RELATION_LOAD_STRATEGY: ${{ matrix.relation_load_strategy }} + + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions-rust-lang/setup-rust-toolchain@v1 + - uses: taiki-e/install-action@nextest + + - 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: "Start ${{ inputs.name }} (${{ matrix.engine_protocol }})" + run: make start-${{ inputs.name }} + + - run: export WORKSPACE_ROOT=$(pwd) && cargo nextest run -p query-engine-tests --partition hash:${{ matrix.partition }} --test-threads=1 + if: ${{ inputs.single_threaded }} + env: + CLICOLOR_FORCE: 1 + + - run: export WORKSPACE_ROOT=$(pwd) && cargo nextest run -p query-engine-tests --partition hash:${{ matrix.partition }} --test-threads=8 + if: ${{ !inputs.single_threaded }} + env: + CLICOLOR_FORCE: 1 diff --git a/.github/workflows/test-query-engine.yml b/.github/workflows/test-query-engine.yml index 6c56575dabad..60a4ab750b64 100644 --- a/.github/workflows/test-query-engine.yml +++ b/.github/workflows/test-query-engine.yml @@ -1,4 +1,4 @@ -name: "QE: integration tests" +name: "QE" on: push: branches: @@ -6,6 +6,7 @@ on: pull_request: paths-ignore: - "!.github/workflows/test-query-engine.yml" + - "!.github/workflows/test-query-engine-template.yml" - ".github/**" - ".buildkite/**" - "*.md" @@ -18,105 +19,154 @@ concurrency: cancel-in-progress: true jobs: - rust-query-engine-tests: - name: "${{ matrix.database.name }} - ${{ matrix.engine_protocol }} ${{ matrix.relation_load_strategy }} ${{ matrix.partition }}" - + postgres: strategy: fail-fast: false matrix: database: - - name: "vitess_8_0" - single_threaded: true - connector: "vitess" - version: "8.0" - # Arbitrary PostgreSQL version - # we opted for the most recent one, there is no need to have a matrix - name: "postgres16" - single_threaded: true - connector: "postgres" version: "16" - - name: "mssql_2022" - single_threaded: false - connector: "sqlserver" - version: "2022" - - name: "sqlite" - single_threaded: false - connector: "sqlite" - version: "3" - - name: "mongodb_4_2" - single_threaded: true - connector: "mongodb" - version: "4.2" + - name: "postgres15" + version: "15" + - name: "postgres14" + version: "14" + - name: "postgres13" + version: "13" + - name: "postgres12" + version: "12" + - name: "postgres11" + version: "11" + - name: "postgres10" + version: "10" + - name: "postgres9" + version: "9" + uses: ./.github/workflows/test-query-engine-template.yml + name: postgres ${{ matrix.database.version }} + with: + name: ${{ matrix.database.name }} + version: ${{ matrix.database.version }} + connector: "postgres" + single_threaded: true + + mysql: + strategy: + fail-fast: false + matrix: + database: + - name: "mysql_5_6" + version: "5.6" + relation_load_strategy: '["query"]' + - name: "mysql_5_7" + version: "5.7" + relation_load_strategy: '["query"]' + - name: "mysql_8" + version: "8" + relation_load_strategy: '["join", "query"]' + - name: "mysql_mariadb" + version: "mariadb" + relation_load_strategy: '["query"]' + + uses: ./.github/workflows/test-query-engine-template.yml + name: mysql ${{ matrix.database.version }} + with: + name: ${{ matrix.database.name }} + version: ${{ matrix.database.version }} + connector: "mysql" + relation_load_strategy: ${{ matrix.database.relation_load_strategy }} + single_threaded: true + + cockroachdb: + strategy: + fail-fast: false + matrix: + database: - name: "cockroach_23_1" - single_threaded: false connector: "cockroachdb" version: "23.1" - name: "cockroach_22_2" - single_threaded: false - connector: "cockroachdb" version: "22.2" - name: "cockroach_22_1_0" - single_threaded: false - connector: "cockroachdb" version: "22.1" - - name: "mysql_8" - single_threaded: false - connector: "mysql" - version: "8" - engine_protocol: [graphql, json] - relation_load_strategy: [join, query] - partition: ["1/4", "2/4", "3/4", "4/4"] - exclude: - - relation_load_strategy: join - database: - [ - { "connector": "mongodb" }, - { "connector": "sqlite" }, - { "connector": "mssql_2022" }, - ] - - env: - LOG_LEVEL: "info" - LOG_QUERIES: "y" - RUST_LOG_FORMAT: "devel" - RUST_BACKTRACE: "1" - CLICOLOR_FORCE: "1" - CLOSED_TX_CLEANUP: "2" - SIMPLE_TEST_MODE: "1" - QUERY_BATCH_SIZE: "10" - TEST_RUNNER: "direct" - TEST_CONNECTOR: ${{ matrix.database.connector }} - TEST_CONNECTOR_VERSION: ${{ matrix.database.version }} - PRISMA_ENGINE_PROTOCOL: ${{ matrix.engine_protocol }} - PRISMA_RELATION_LOAD_STRATEGY: ${{ matrix.relation_load_strategy }} - WORKSPACE_ROOT: ${{ github.workspace }} + uses: ./.github/workflows/test-query-engine-template.yml + name: cockroachdb ${{ matrix.database.version }} + with: + name: ${{ matrix.database.name }} + version: ${{ matrix.database.version }} + connector: "cockroachdb" - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions-rust-lang/setup-rust-toolchain@v1 - - uses: taiki-e/install-action@nextest - - - 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: "Start ${{ matrix.database.name }} (${{ matrix.engine_protocol }})" - run: make start-${{ matrix.database.name }} + mongodb: + strategy: + fail-fast: false + matrix: + database: + - name: "mongodb_4_2" + version: "4.2" + - name: "mongodb_4_4" + version: "4.4" + - name: "mongodb_5" + connector: "mongodb" + version: "5" + uses: ./.github/workflows/test-query-engine-template.yml + name: mongodb ${{ matrix.database.version }} + with: + name: ${{ matrix.database.name }} + version: ${{ matrix.database.version }} + single_threaded: true + connector: "mongodb" + relation_load_strategy: '["query"]' - - run: cargo nextest run -p query-engine-tests --partition hash:${{ matrix.partition }} --test-threads=1 - if: ${{ matrix.database.single_threaded }} - env: - CLICOLOR_FORCE: 1 + mssql: + strategy: + fail-fast: false + matrix: + database: + - name: "mssql_2022" + version: "2022" + - name: "mssql_2019" + version: "2019" + - name: "mssql_2017" + version: "2017" + uses: ./.github/workflows/test-query-engine-template.yml + name: mssql ${{ matrix.database.version }} + with: + name: ${{ matrix.database.name }} + version: ${{ matrix.database.version }} + connector: "sqlserver" + relation_load_strategy: '["query"]' - - run: cargo nextest run -p query-engine-tests --partition hash:${{ matrix.partition }} --test-threads=8 - if: ${{ !matrix.database.single_threaded }} - env: - CLICOLOR_FORCE: 1 + sqlite: + uses: ./.github/workflows/test-query-engine-template.yml + name: sqlite + with: + name: "sqlite" + version: 3 + connector: "sqlite" + relation_load_strategy: '["query"]' + + driver_adapters: + strategy: + fail-fast: false + matrix: + adapter: + - name: "planetscale (napi)" + setup_task: "dev-planetscale-js" + - name: "pg (napi)" + setup_task: "dev-pg-js" + - name: "neon (napi)" + setup_task: "dev-neon-js" + - name: "libsql (napi)" + setup_task: "dev-libsql-js" + - name: "planetscale (wasm)" + setup_task: "dev-planetscale-wasm" + - name: "pg (wasm)" + setup_task: "dev-pg-wasm" + - name: "neon (wasm)" + setup_task: "dev-neon-wasm" + - name: "libsql (wasm)" + setup_task: "dev-libsql-wasm" + - name: "d1 (wasm)" + setup_task: "dev-d1" + name: ${{ matrix.adapter.name }} + uses: ./.github/workflows/test-driver-adapters-template.yml + with: + setup_task: ${{ matrix.adapter.setup_task }} diff --git a/.github/workflows/utils/checkFinishedMarker.sh b/.github/workflows/utils/checkFinishedMarker.sh new file mode 100644 index 000000000000..2eb57f1600b9 --- /dev/null +++ b/.github/workflows/utils/checkFinishedMarker.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +set -eux + +# We check if the .finished file marker exists in the S3 bucket +# i.e. 'all_commits/[COMMIT]/.finished' +object_exists=$(aws s3api head-object --bucket "$BUCKET_NAME" --key "$FILE_PATH" || true) + +if [ -z "$object_exists" ]; then +echo ".finished file marker was NOT found at $FILE_PATH. Continuing..." +else +echo "::error::.finished file marker was found at $FILE_PATH - This means that artifacts were already uploaded in a previous run. Aborting to avoid overwriting the artifacts.", +exit 1 +fi; + + +# When we were using our Buildkite pipeline +# Before this GitHub Actions pipeline +# We were uploading the artifacts for each build separately +# And the .finished file marker was in the same directory as the build target +# i.e. 'all_commits/[COMMIT]/rhel-openssl-1.1.x/.finished' +object_exists_in_legacy_path=$(aws s3api head-object --bucket "$BUCKET_NAME" --key "$FILE_PATH_LEGACY" || true) + +if [ -z "$object_exists_in_legacy_path" ]; then +echo "(legacy) .finished file marker was NOT found at $FILE_PATH. Continuing..." +else +echo "::error::(legacy) .finished file marker was found at $FILE_PATH - This means that artifacts were already uploaded in a previous run. Aborting to avoid overwriting the artifacts.", +exit 1 +fi; diff --git a/.github/workflows/utils/constructDockerBuildCommand.sh b/.github/workflows/utils/constructDockerBuildCommand.sh new file mode 100644 index 000000000000..1d7adf80577a --- /dev/null +++ b/.github/workflows/utils/constructDockerBuildCommand.sh @@ -0,0 +1,31 @@ +#!/bin/bash +set -eux; + +# full command +command="docker run \ +-e SQLITE_MAX_VARIABLE_NUMBER=250000 \ +-e SQLITE_MAX_EXPR_DEPTH=10000 \ +-e LIBZ_SYS_STATIC=1 \ +-w /root/build \ +-v \"$(pwd)\":/root/build \ +-v \"$HOME\"/.cargo/bin:/root/cargo/bin \ +-v \"$HOME\"/.cargo/registry/index:/root/cargo/registry/index \ +-v \"$HOME\"/.cargo/registry/cache:/root/cargo/registry/cache \ +-v \"$HOME\"/.cargo/git/db:/root/cargo/git/db \ +$IMAGE \ +bash -c \ + \" \ + cargo clean \ + && cargo build --release -p query-engine --manifest-path query-engine/query-engine/Cargo.toml $TARGET_STRING $FEATURES_STRING \ + && cargo build --release -p query-engine-node-api --manifest-path query-engine/query-engine-node-api/Cargo.toml $TARGET_STRING $FEATURES_STRING \ + && cargo build --release -p schema-engine-cli --manifest-path schema-engine/cli/Cargo.toml $TARGET_STRING $FEATURES_STRING \ + && cargo build --release -p prisma-fmt --manifest-path prisma-fmt/Cargo.toml $TARGET_STRING $FEATURES_STRING \ + \" \ +" +# remove query-engine-node-api for "static" targets +if [[ "$TARGET_NAME" == *-static-* ]]; then + substring_to_replace="&& cargo build --release -p query-engine-node-api --manifest-path query-engine/query-engine-node-api/Cargo.toml $TARGET_STRING $FEATURES_STRING" + command="${command/$substring_to_replace/}" +fi + +echo "$command" \ No newline at end of file diff --git a/.github/workflows/utils/expectedFiles.txt b/.github/workflows/utils/expectedFiles.txt new file mode 100644 index 000000000000..2da123d8da2f --- /dev/null +++ b/.github/workflows/utils/expectedFiles.txt @@ -0,0 +1,373 @@ +. +./darwin +./darwin-arm64 +./darwin-arm64/libquery_engine.dylib.node.gz +./darwin-arm64/libquery_engine.dylib.node.gz.sha256 +./darwin-arm64/libquery_engine.dylib.node.gz.sig +./darwin-arm64/libquery_engine.dylib.node.sha256 +./darwin-arm64/libquery_engine.dylib.node.sig +./darwin-arm64/prisma-fmt.gz +./darwin-arm64/prisma-fmt.gz.sha256 +./darwin-arm64/prisma-fmt.gz.sig +./darwin-arm64/prisma-fmt.sha256 +./darwin-arm64/prisma-fmt.sig +./darwin-arm64/query-engine.gz +./darwin-arm64/query-engine.gz.sha256 +./darwin-arm64/query-engine.gz.sig +./darwin-arm64/query-engine.sha256 +./darwin-arm64/query-engine.sig +./darwin-arm64/schema-engine.gz +./darwin-arm64/schema-engine.gz.sha256 +./darwin-arm64/schema-engine.gz.sig +./darwin-arm64/schema-engine.sha256 +./darwin-arm64/schema-engine.sig +./darwin/libquery_engine.dylib.node.gz +./darwin/libquery_engine.dylib.node.gz.sha256 +./darwin/libquery_engine.dylib.node.gz.sig +./darwin/libquery_engine.dylib.node.sha256 +./darwin/libquery_engine.dylib.node.sig +./darwin/prisma-fmt.gz +./darwin/prisma-fmt.gz.sha256 +./darwin/prisma-fmt.gz.sig +./darwin/prisma-fmt.sha256 +./darwin/prisma-fmt.sig +./darwin/query-engine.gz +./darwin/query-engine.gz.sha256 +./darwin/query-engine.gz.sig +./darwin/query-engine.sha256 +./darwin/query-engine.sig +./darwin/schema-engine.gz +./darwin/schema-engine.gz.sha256 +./darwin/schema-engine.gz.sig +./darwin/schema-engine.sha256 +./darwin/schema-engine.sig +./debian-openssl-1.0.x +./debian-openssl-1.0.x/libquery_engine.so.node.gz +./debian-openssl-1.0.x/libquery_engine.so.node.gz.sha256 +./debian-openssl-1.0.x/libquery_engine.so.node.gz.sig +./debian-openssl-1.0.x/libquery_engine.so.node.sha256 +./debian-openssl-1.0.x/libquery_engine.so.node.sig +./debian-openssl-1.0.x/prisma-fmt.gz +./debian-openssl-1.0.x/prisma-fmt.gz.sha256 +./debian-openssl-1.0.x/prisma-fmt.gz.sig +./debian-openssl-1.0.x/prisma-fmt.sha256 +./debian-openssl-1.0.x/prisma-fmt.sig +./debian-openssl-1.0.x/query-engine.gz +./debian-openssl-1.0.x/query-engine.gz.sha256 +./debian-openssl-1.0.x/query-engine.gz.sig +./debian-openssl-1.0.x/query-engine.sha256 +./debian-openssl-1.0.x/query-engine.sig +./debian-openssl-1.0.x/schema-engine.gz +./debian-openssl-1.0.x/schema-engine.gz.sha256 +./debian-openssl-1.0.x/schema-engine.gz.sig +./debian-openssl-1.0.x/schema-engine.sha256 +./debian-openssl-1.0.x/schema-engine.sig +./debian-openssl-1.1.x +./debian-openssl-1.1.x/libquery_engine.so.node.gz +./debian-openssl-1.1.x/libquery_engine.so.node.gz.sha256 +./debian-openssl-1.1.x/libquery_engine.so.node.gz.sig +./debian-openssl-1.1.x/libquery_engine.so.node.sha256 +./debian-openssl-1.1.x/libquery_engine.so.node.sig +./debian-openssl-1.1.x/prisma-fmt.gz +./debian-openssl-1.1.x/prisma-fmt.gz.sha256 +./debian-openssl-1.1.x/prisma-fmt.gz.sig +./debian-openssl-1.1.x/prisma-fmt.sha256 +./debian-openssl-1.1.x/prisma-fmt.sig +./debian-openssl-1.1.x/query-engine.gz +./debian-openssl-1.1.x/query-engine.gz.sha256 +./debian-openssl-1.1.x/query-engine.gz.sig +./debian-openssl-1.1.x/query-engine.sha256 +./debian-openssl-1.1.x/query-engine.sig +./debian-openssl-1.1.x/schema-engine.gz +./debian-openssl-1.1.x/schema-engine.gz.sha256 +./debian-openssl-1.1.x/schema-engine.gz.sig +./debian-openssl-1.1.x/schema-engine.sha256 +./debian-openssl-1.1.x/schema-engine.sig +./debian-openssl-3.0.x +./debian-openssl-3.0.x/libquery_engine.so.node.gz +./debian-openssl-3.0.x/libquery_engine.so.node.gz.sha256 +./debian-openssl-3.0.x/libquery_engine.so.node.gz.sig +./debian-openssl-3.0.x/libquery_engine.so.node.sha256 +./debian-openssl-3.0.x/libquery_engine.so.node.sig +./debian-openssl-3.0.x/prisma-fmt.gz +./debian-openssl-3.0.x/prisma-fmt.gz.sha256 +./debian-openssl-3.0.x/prisma-fmt.gz.sig +./debian-openssl-3.0.x/prisma-fmt.sha256 +./debian-openssl-3.0.x/prisma-fmt.sig +./debian-openssl-3.0.x/query-engine.gz +./debian-openssl-3.0.x/query-engine.gz.sha256 +./debian-openssl-3.0.x/query-engine.gz.sig +./debian-openssl-3.0.x/query-engine.sha256 +./debian-openssl-3.0.x/query-engine.sig +./debian-openssl-3.0.x/schema-engine.gz +./debian-openssl-3.0.x/schema-engine.gz.sha256 +./debian-openssl-3.0.x/schema-engine.gz.sig +./debian-openssl-3.0.x/schema-engine.sha256 +./debian-openssl-3.0.x/schema-engine.sig +./linux-arm64-openssl-1.0.x +./linux-arm64-openssl-1.0.x/libquery_engine.so.node.gz +./linux-arm64-openssl-1.0.x/libquery_engine.so.node.gz.sha256 +./linux-arm64-openssl-1.0.x/libquery_engine.so.node.gz.sig +./linux-arm64-openssl-1.0.x/libquery_engine.so.node.sha256 +./linux-arm64-openssl-1.0.x/libquery_engine.so.node.sig +./linux-arm64-openssl-1.0.x/prisma-fmt.gz +./linux-arm64-openssl-1.0.x/prisma-fmt.gz.sha256 +./linux-arm64-openssl-1.0.x/prisma-fmt.gz.sig +./linux-arm64-openssl-1.0.x/prisma-fmt.sha256 +./linux-arm64-openssl-1.0.x/prisma-fmt.sig +./linux-arm64-openssl-1.0.x/query-engine.gz +./linux-arm64-openssl-1.0.x/query-engine.gz.sha256 +./linux-arm64-openssl-1.0.x/query-engine.gz.sig +./linux-arm64-openssl-1.0.x/query-engine.sha256 +./linux-arm64-openssl-1.0.x/query-engine.sig +./linux-arm64-openssl-1.0.x/schema-engine.gz +./linux-arm64-openssl-1.0.x/schema-engine.gz.sha256 +./linux-arm64-openssl-1.0.x/schema-engine.gz.sig +./linux-arm64-openssl-1.0.x/schema-engine.sha256 +./linux-arm64-openssl-1.0.x/schema-engine.sig +./linux-arm64-openssl-1.1.x +./linux-arm64-openssl-1.1.x/libquery_engine.so.node.gz +./linux-arm64-openssl-1.1.x/libquery_engine.so.node.gz.sha256 +./linux-arm64-openssl-1.1.x/libquery_engine.so.node.gz.sig +./linux-arm64-openssl-1.1.x/libquery_engine.so.node.sha256 +./linux-arm64-openssl-1.1.x/libquery_engine.so.node.sig +./linux-arm64-openssl-1.1.x/prisma-fmt.gz +./linux-arm64-openssl-1.1.x/prisma-fmt.gz.sha256 +./linux-arm64-openssl-1.1.x/prisma-fmt.gz.sig +./linux-arm64-openssl-1.1.x/prisma-fmt.sha256 +./linux-arm64-openssl-1.1.x/prisma-fmt.sig +./linux-arm64-openssl-1.1.x/query-engine.gz +./linux-arm64-openssl-1.1.x/query-engine.gz.sha256 +./linux-arm64-openssl-1.1.x/query-engine.gz.sig +./linux-arm64-openssl-1.1.x/query-engine.sha256 +./linux-arm64-openssl-1.1.x/query-engine.sig +./linux-arm64-openssl-1.1.x/schema-engine.gz +./linux-arm64-openssl-1.1.x/schema-engine.gz.sha256 +./linux-arm64-openssl-1.1.x/schema-engine.gz.sig +./linux-arm64-openssl-1.1.x/schema-engine.sha256 +./linux-arm64-openssl-1.1.x/schema-engine.sig +./linux-arm64-openssl-3.0.x +./linux-arm64-openssl-3.0.x/libquery_engine.so.node.gz +./linux-arm64-openssl-3.0.x/libquery_engine.so.node.gz.sha256 +./linux-arm64-openssl-3.0.x/libquery_engine.so.node.gz.sig +./linux-arm64-openssl-3.0.x/libquery_engine.so.node.sha256 +./linux-arm64-openssl-3.0.x/libquery_engine.so.node.sig +./linux-arm64-openssl-3.0.x/prisma-fmt.gz +./linux-arm64-openssl-3.0.x/prisma-fmt.gz.sha256 +./linux-arm64-openssl-3.0.x/prisma-fmt.gz.sig +./linux-arm64-openssl-3.0.x/prisma-fmt.sha256 +./linux-arm64-openssl-3.0.x/prisma-fmt.sig +./linux-arm64-openssl-3.0.x/query-engine.gz +./linux-arm64-openssl-3.0.x/query-engine.gz.sha256 +./linux-arm64-openssl-3.0.x/query-engine.gz.sig +./linux-arm64-openssl-3.0.x/query-engine.sha256 +./linux-arm64-openssl-3.0.x/query-engine.sig +./linux-arm64-openssl-3.0.x/schema-engine.gz +./linux-arm64-openssl-3.0.x/schema-engine.gz.sha256 +./linux-arm64-openssl-3.0.x/schema-engine.gz.sig +./linux-arm64-openssl-3.0.x/schema-engine.sha256 +./linux-arm64-openssl-3.0.x/schema-engine.sig +./linux-musl +./linux-musl-arm64-openssl-1.1.x +./linux-musl-arm64-openssl-1.1.x/libquery_engine.so.node.gz +./linux-musl-arm64-openssl-1.1.x/libquery_engine.so.node.gz.sha256 +./linux-musl-arm64-openssl-1.1.x/libquery_engine.so.node.gz.sig +./linux-musl-arm64-openssl-1.1.x/libquery_engine.so.node.sha256 +./linux-musl-arm64-openssl-1.1.x/libquery_engine.so.node.sig +./linux-musl-arm64-openssl-1.1.x/prisma-fmt.gz +./linux-musl-arm64-openssl-1.1.x/prisma-fmt.gz.sha256 +./linux-musl-arm64-openssl-1.1.x/prisma-fmt.gz.sig +./linux-musl-arm64-openssl-1.1.x/prisma-fmt.sha256 +./linux-musl-arm64-openssl-1.1.x/prisma-fmt.sig +./linux-musl-arm64-openssl-1.1.x/query-engine.gz +./linux-musl-arm64-openssl-1.1.x/query-engine.gz.sha256 +./linux-musl-arm64-openssl-1.1.x/query-engine.gz.sig +./linux-musl-arm64-openssl-1.1.x/query-engine.sha256 +./linux-musl-arm64-openssl-1.1.x/query-engine.sig +./linux-musl-arm64-openssl-1.1.x/schema-engine.gz +./linux-musl-arm64-openssl-1.1.x/schema-engine.gz.sha256 +./linux-musl-arm64-openssl-1.1.x/schema-engine.gz.sig +./linux-musl-arm64-openssl-1.1.x/schema-engine.sha256 +./linux-musl-arm64-openssl-1.1.x/schema-engine.sig +./linux-musl-arm64-openssl-3.0.x +./linux-musl-arm64-openssl-3.0.x/libquery_engine.so.node.gz +./linux-musl-arm64-openssl-3.0.x/libquery_engine.so.node.gz.sha256 +./linux-musl-arm64-openssl-3.0.x/libquery_engine.so.node.gz.sig +./linux-musl-arm64-openssl-3.0.x/libquery_engine.so.node.sha256 +./linux-musl-arm64-openssl-3.0.x/libquery_engine.so.node.sig +./linux-musl-arm64-openssl-3.0.x/prisma-fmt.gz +./linux-musl-arm64-openssl-3.0.x/prisma-fmt.gz.sha256 +./linux-musl-arm64-openssl-3.0.x/prisma-fmt.gz.sig +./linux-musl-arm64-openssl-3.0.x/prisma-fmt.sha256 +./linux-musl-arm64-openssl-3.0.x/prisma-fmt.sig +./linux-musl-arm64-openssl-3.0.x/query-engine.gz +./linux-musl-arm64-openssl-3.0.x/query-engine.gz.sha256 +./linux-musl-arm64-openssl-3.0.x/query-engine.gz.sig +./linux-musl-arm64-openssl-3.0.x/query-engine.sha256 +./linux-musl-arm64-openssl-3.0.x/query-engine.sig +./linux-musl-arm64-openssl-3.0.x/schema-engine.gz +./linux-musl-arm64-openssl-3.0.x/schema-engine.gz.sha256 +./linux-musl-arm64-openssl-3.0.x/schema-engine.gz.sig +./linux-musl-arm64-openssl-3.0.x/schema-engine.sha256 +./linux-musl-arm64-openssl-3.0.x/schema-engine.sig +./linux-musl-openssl-3.0.x +./linux-musl-openssl-3.0.x/libquery_engine.so.node.gz +./linux-musl-openssl-3.0.x/libquery_engine.so.node.gz.sha256 +./linux-musl-openssl-3.0.x/libquery_engine.so.node.gz.sig +./linux-musl-openssl-3.0.x/libquery_engine.so.node.sha256 +./linux-musl-openssl-3.0.x/libquery_engine.so.node.sig +./linux-musl-openssl-3.0.x/prisma-fmt.gz +./linux-musl-openssl-3.0.x/prisma-fmt.gz.sha256 +./linux-musl-openssl-3.0.x/prisma-fmt.gz.sig +./linux-musl-openssl-3.0.x/prisma-fmt.sha256 +./linux-musl-openssl-3.0.x/prisma-fmt.sig +./linux-musl-openssl-3.0.x/query-engine.gz +./linux-musl-openssl-3.0.x/query-engine.gz.sha256 +./linux-musl-openssl-3.0.x/query-engine.gz.sig +./linux-musl-openssl-3.0.x/query-engine.sha256 +./linux-musl-openssl-3.0.x/query-engine.sig +./linux-musl-openssl-3.0.x/schema-engine.gz +./linux-musl-openssl-3.0.x/schema-engine.gz.sha256 +./linux-musl-openssl-3.0.x/schema-engine.gz.sig +./linux-musl-openssl-3.0.x/schema-engine.sha256 +./linux-musl-openssl-3.0.x/schema-engine.sig +./linux-musl/libquery_engine.so.node.gz +./linux-musl/libquery_engine.so.node.gz.sha256 +./linux-musl/libquery_engine.so.node.gz.sig +./linux-musl/libquery_engine.so.node.sha256 +./linux-musl/libquery_engine.so.node.sig +./linux-musl/prisma-fmt.gz +./linux-musl/prisma-fmt.gz.sha256 +./linux-musl/prisma-fmt.gz.sig +./linux-musl/prisma-fmt.sha256 +./linux-musl/prisma-fmt.sig +./linux-musl/query-engine.gz +./linux-musl/query-engine.gz.sha256 +./linux-musl/query-engine.gz.sig +./linux-musl/query-engine.sha256 +./linux-musl/query-engine.sig +./linux-musl/schema-engine.gz +./linux-musl/schema-engine.gz.sha256 +./linux-musl/schema-engine.gz.sig +./linux-musl/schema-engine.sha256 +./linux-musl/schema-engine.sig +./linux-static-arm64 +./linux-static-arm64/prisma-fmt.gz +./linux-static-arm64/prisma-fmt.gz.sha256 +./linux-static-arm64/prisma-fmt.gz.sig +./linux-static-arm64/prisma-fmt.sha256 +./linux-static-arm64/prisma-fmt.sig +./linux-static-arm64/query-engine.gz +./linux-static-arm64/query-engine.gz.sha256 +./linux-static-arm64/query-engine.gz.sig +./linux-static-arm64/query-engine.sha256 +./linux-static-arm64/query-engine.sig +./linux-static-arm64/schema-engine.gz +./linux-static-arm64/schema-engine.gz.sha256 +./linux-static-arm64/schema-engine.gz.sig +./linux-static-arm64/schema-engine.sha256 +./linux-static-arm64/schema-engine.sig +./linux-static-x64 +./linux-static-x64/prisma-fmt.gz +./linux-static-x64/prisma-fmt.gz.sha256 +./linux-static-x64/prisma-fmt.gz.sig +./linux-static-x64/prisma-fmt.sha256 +./linux-static-x64/prisma-fmt.sig +./linux-static-x64/query-engine.gz +./linux-static-x64/query-engine.gz.sha256 +./linux-static-x64/query-engine.gz.sig +./linux-static-x64/query-engine.sha256 +./linux-static-x64/query-engine.sig +./linux-static-x64/schema-engine.gz +./linux-static-x64/schema-engine.gz.sha256 +./linux-static-x64/schema-engine.gz.sig +./linux-static-x64/schema-engine.sha256 +./linux-static-x64/schema-engine.sig +./react-native +./react-native/binaries.zip +./react-native/binaries.zip.sha256 +./react-native/binaries.zip.sig +./rhel-openssl-1.0.x +./rhel-openssl-1.0.x/libquery_engine.so.node.gz +./rhel-openssl-1.0.x/libquery_engine.so.node.gz.sha256 +./rhel-openssl-1.0.x/libquery_engine.so.node.gz.sig +./rhel-openssl-1.0.x/libquery_engine.so.node.sha256 +./rhel-openssl-1.0.x/libquery_engine.so.node.sig +./rhel-openssl-1.0.x/prisma-fmt.gz +./rhel-openssl-1.0.x/prisma-fmt.gz.sha256 +./rhel-openssl-1.0.x/prisma-fmt.gz.sig +./rhel-openssl-1.0.x/prisma-fmt.sha256 +./rhel-openssl-1.0.x/prisma-fmt.sig +./rhel-openssl-1.0.x/query-engine.gz +./rhel-openssl-1.0.x/query-engine.gz.sha256 +./rhel-openssl-1.0.x/query-engine.gz.sig +./rhel-openssl-1.0.x/query-engine.sha256 +./rhel-openssl-1.0.x/query-engine.sig +./rhel-openssl-1.0.x/schema-engine.gz +./rhel-openssl-1.0.x/schema-engine.gz.sha256 +./rhel-openssl-1.0.x/schema-engine.gz.sig +./rhel-openssl-1.0.x/schema-engine.sha256 +./rhel-openssl-1.0.x/schema-engine.sig +./rhel-openssl-1.1.x +./rhel-openssl-1.1.x/libquery_engine.so.node.gz +./rhel-openssl-1.1.x/libquery_engine.so.node.gz.sha256 +./rhel-openssl-1.1.x/libquery_engine.so.node.gz.sig +./rhel-openssl-1.1.x/libquery_engine.so.node.sha256 +./rhel-openssl-1.1.x/libquery_engine.so.node.sig +./rhel-openssl-1.1.x/prisma-fmt.gz +./rhel-openssl-1.1.x/prisma-fmt.gz.sha256 +./rhel-openssl-1.1.x/prisma-fmt.gz.sig +./rhel-openssl-1.1.x/prisma-fmt.sha256 +./rhel-openssl-1.1.x/prisma-fmt.sig +./rhel-openssl-1.1.x/query-engine.gz +./rhel-openssl-1.1.x/query-engine.gz.sha256 +./rhel-openssl-1.1.x/query-engine.gz.sig +./rhel-openssl-1.1.x/query-engine.sha256 +./rhel-openssl-1.1.x/query-engine.sig +./rhel-openssl-1.1.x/schema-engine.gz +./rhel-openssl-1.1.x/schema-engine.gz.sha256 +./rhel-openssl-1.1.x/schema-engine.gz.sig +./rhel-openssl-1.1.x/schema-engine.sha256 +./rhel-openssl-1.1.x/schema-engine.sig +./rhel-openssl-3.0.x +./rhel-openssl-3.0.x/libquery_engine.so.node.gz +./rhel-openssl-3.0.x/libquery_engine.so.node.gz.sha256 +./rhel-openssl-3.0.x/libquery_engine.so.node.gz.sig +./rhel-openssl-3.0.x/libquery_engine.so.node.sha256 +./rhel-openssl-3.0.x/libquery_engine.so.node.sig +./rhel-openssl-3.0.x/prisma-fmt.gz +./rhel-openssl-3.0.x/prisma-fmt.gz.sha256 +./rhel-openssl-3.0.x/prisma-fmt.gz.sig +./rhel-openssl-3.0.x/prisma-fmt.sha256 +./rhel-openssl-3.0.x/prisma-fmt.sig +./rhel-openssl-3.0.x/query-engine.gz +./rhel-openssl-3.0.x/query-engine.gz.sha256 +./rhel-openssl-3.0.x/query-engine.gz.sig +./rhel-openssl-3.0.x/query-engine.sha256 +./rhel-openssl-3.0.x/query-engine.sig +./rhel-openssl-3.0.x/schema-engine.gz +./rhel-openssl-3.0.x/schema-engine.gz.sha256 +./rhel-openssl-3.0.x/schema-engine.gz.sig +./rhel-openssl-3.0.x/schema-engine.sha256 +./rhel-openssl-3.0.x/schema-engine.sig +./windows +./windows/prisma-fmt.exe.gz +./windows/prisma-fmt.exe.gz.sha256 +./windows/prisma-fmt.exe.gz.sig +./windows/prisma-fmt.exe.sha256 +./windows/prisma-fmt.exe.sig +./windows/query-engine.exe.gz +./windows/query-engine.exe.gz.sha256 +./windows/query-engine.exe.gz.sig +./windows/query-engine.exe.sha256 +./windows/query-engine.exe.sig +./windows/query_engine.dll.node.gz +./windows/query_engine.dll.node.gz.sha256 +./windows/query_engine.dll.node.gz.sig +./windows/query_engine.dll.node.sha256 +./windows/query_engine.dll.node.sig +./windows/schema-engine.exe.gz +./windows/schema-engine.exe.gz.sha256 +./windows/schema-engine.exe.gz.sig +./windows/schema-engine.exe.sha256 +./windows/schema-engine.exe.sig diff --git a/.github/workflows/utils/uploadAndVerify.sh b/.github/workflows/utils/uploadAndVerify.sh new file mode 100644 index 000000000000..606a4c2532fa --- /dev/null +++ b/.github/workflows/utils/uploadAndVerify.sh @@ -0,0 +1,128 @@ +#!/bin/bash + +set -eux; + +# engines-artifacts-for-r2 +# engines-artifacts-for-s3 +LOCAL_DIR_PATH=$1 + +if [ -z "$LOCAL_DIR_PATH" ]; then + echo "::error::LOCAL_DIR_PATH is not set." + exit 1 +fi + +echo "Uploading files..." +cd engines-artifacts +aws s3 sync . "$DESTINATION_TARGET_PATH" --no-progress \ + --exclude "*" \ + --include "*.gz" \ + --include "*.zip" \ + --include "*.sha256" \ + --include "*.sig" +cd ".." + +echo "Downloading files..." +mkdir "$LOCAL_DIR_PATH" +cd "$LOCAL_DIR_PATH" +aws s3 sync "$DESTINATION_TARGET_PATH" . --no-progress + +echo "Verifing downloaded files..." +ls -R . + +FILECOUNT_FOR_SHA256=$(find . -type f -name "*.sha256" | wc -l) +if [ "$FILECOUNT_FOR_SHA256" -eq 0 ]; then + echo "::error::No .sha256 files found." + exit 1 +fi + +FILECOUNT_FOR_GZ=$(find . -type f -name "*.gz" | wc -l) +if [ "$FILECOUNT_FOR_GZ" -eq 0 ]; then + echo "::error::No .gz files found." + exit 1 +fi + +FILECOUNT_FOR_SIG=$(find . -type f -name "*.sig" | wc -l) +if [ "$FILECOUNT_FOR_SIG" -eq 0 ]; then + echo "::error::No .sig files found." + exit 1 +fi + +# Manual check +# +# Set PROD env vars +# mkdir engines-artifacts-from-prod +# Download the artifacts from the S3 bucket +# aws s3 sync s3://prisma-builds/all_commits/6f3b8db04fa234ab2812fdd27456e9d9590eedb1 engines-artifacts-from-prod/ +# Print the files and save the output to a file +# cd engines-artifacts-from-prod +# find . | sort > ../expectedFiles.txt +# +# cd .. +# +# Set DEV env vars +# mkdir engines-artifacts-from-dev +# Download the artifacts from the S3 bucket +# aws s3 sync s3://prisma-builds-github-actions/all_commits/6f3b8db04fa234ab2812fdd27456e9d9590eedb1 engines-artifacts-from-dev/ +# Print the files and save the output to a file +# cd engines-artifacts-from-dev +# find . | sort > ../currentFiles.txt + +# Automated check +# expectedFiles.txt is in the same directory as this script + +echo "Create list of files" +find . | sort > ../currentFiles.txt +cd .. +echo "Comparing expectedFiles.txt vs currentFiles.txt" +diff -c .github/workflows/utils/expectedFiles.txt currentFiles.txt +cd "$LOCAL_DIR_PATH" + +# Unpack all .gz files first +find . -type f | while read -r filename; do + echo "Unpacking $filename file." + gzip -d "$filename" --keep -q +done + +# Verify .sha256 files +find . -type f -name "*.sha256" | while read -r filename; do + echo "Validating sha256 sum." + sha256sum -c "$filename" +done + +# Verify .sig files +find . -type f -name "*.sig" | while read -r filename; do + # Remove .sig from the file name + fileToVerify=$(echo "$filename" | rev | cut -c5- | rev) + + echo "Validating signature $filename for $fileToVerify" + gpg --verify "$filename" "$fileToVerify" +done + +echo "Validating OpenSSL linking." +if [[ "$(uname)" == 'Darwin' ]]; then + echo "::error::Mac OS does not have ldd command." + exit 1 +fi + +FILES_TO_VALIDATE_WITH_LDD=$(find . -type f | grep -E "./(rhel|debian)-openssl-(3.0|1.1).*(query-engine|schema-engine|libquery_engine.so.node)$") +echo "FILES_TO_VALIDATE_WITH_LDD: $FILES_TO_VALIDATE_WITH_LDD" + +for filename in $FILES_TO_VALIDATE_WITH_LDD +do + echo "Validating libssl linking for $filename." + GREP_OUTPUT=$(ldd "$filename" | grep "libssl") + OUTPUT=$(echo "$GREP_OUTPUT" | cut -f2 | cut -d'.' -f1) + + if [[ "$OUTPUT" == "libssl" ]]; then + echo "Linux build linked correctly to libssl." + else + echo "GREP_OUTPUT: $GREP_OUTPUT" + echo "Linux build linked incorrectly to libssl." + exit 1 + fi +done + +echo "Upload .finished marker file" +touch .finished +aws s3 cp .finished "$DESTINATION_TARGET_PATH/.finished" +rm .finished diff --git a/query-engine/connector-test-kit-rs/query-engine-tests/tests/queries/aggregation/many_count_relation.rs b/query-engine/connector-test-kit-rs/query-engine-tests/tests/queries/aggregation/many_count_relation.rs index 94fc36388af7..b757eb4d13c8 100644 --- a/query-engine/connector-test-kit-rs/query-engine-tests/tests/queries/aggregation/many_count_relation.rs +++ b/query-engine/connector-test-kit-rs/query-engine-tests/tests/queries/aggregation/many_count_relation.rs @@ -900,7 +900,7 @@ mod many_count_rel { // Nullable counts should be COALESCE'd to 0. insta::assert_snapshot!( run_query!(&runner, r#"{ - findManyPost { + findManyPost(orderBy: {id: "asc"}) { _count { comments } } } diff --git a/rust-toolchain.toml b/rust-toolchain.toml index fd5803cb5fba..593e44aa569a 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -17,5 +17,6 @@ targets = [ # Server targets we support. "x86_64-unknown-linux-musl", "aarch64-unknown-linux-gnu", - "aarch64-unknown-linux-musl" + "aarch64-unknown-linux-musl", + "aarch64-apple-darwin" ]