-
Notifications
You must be signed in to change notification settings - Fork 233
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: Migrate to GH Actions for release (#4947)
* ci(github): Build Linux engines (#1) * add run-name * fix: add target_path to Linux Status (x86_64) (#3) * chore: update actions and autoformat * ci: do all the things `engineer` CLI does for releasing engines (#4) * remove /target from cache * add release if github.event_name == 'workflow_dispatch' * Comment out push/pr triggers * Run on PR (tmp) * Remove old pipelines, make commit optional * Run linux jobs in docker containers * Revert "Run linux jobs in docker containers" This reverts commit aa6e6cc. * Remove explicit repository * Try to mount cache dirs, use rust-toolchain files * No quotes * Add osx arm toolchain * Uncomment s3 upload * Fix shellcheck * Correct bucket * Comment out R2 * Setup R2 uploads again * Add workflow-dispatch for engines-wrapper * Fix script * Use github.sha everywhere * Use prisma bot token * Use repository dispatch * Use short branch name * Correct repo for dispatch * head-ref? * Skip engines build if no release is necessary * Add all DBs tested on buildkite to GH Actions * Split qe test job into multiple jobs because FML * Adjust job/workflows names * And again * Run mysql as single threaded * Ignore joins test on old mysql * Bring back mariadb * Organize pipelines better * Add order by to fix postgres9 * Move DA tests into unified view * Cleanup * Address some of the review comments * Pull command construction into separate script [integration] * Correctly check for [integration] [integration] * PR-safe way of getting commit message [integration] * n1 [integration] * Correct multiline string [integration] * Checkout different ref [integration] * Try more things [integration] * Fix shellcheck [integration] * Check repository owner [integration] * I am sad [integration] * permissions? * Revert to prisma bot token * Revert back to membership check [integration] * Please [integration] * Uncomment triggers --------- Co-authored-by: Jan Piotrowski <piotrowski+github@gmail.com> Co-authored-by: Joël Galeran <Jolg42@users.noreply.github.com>
- Loading branch information
1 parent
68bfdeb
commit f66d888
Showing
16 changed files
with
1,522 additions
and
260 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
Oops, something went wrong.