|
| 1 | +name: PostgreSQL rustls engines |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: [gitar-4.8-rustls] |
| 5 | + workflow_dispatch: |
| 6 | +permissions: |
| 7 | + contents: read |
| 8 | +env: |
| 9 | + # Legacy engine crates deny compiler warnings that newer Rust versions add. |
| 10 | + # Preserve those sources while retaining compiler errors and dependency guards. |
| 11 | + RUSTFLAGS: --cap-lints=warn |
| 12 | + ENGINE_FEATURES: query-engine/postgresql,migration-engine-cli/postgresql,introspection-core/postgresql |
| 13 | +jobs: |
| 14 | + build: |
| 15 | + strategy: |
| 16 | + fail-fast: false |
| 17 | + matrix: |
| 18 | + include: |
| 19 | + - target: aarch64-apple-darwin |
| 20 | + runner: namespace-profile-gitar-macos |
| 21 | + - target: x86_64-unknown-linux-gnu |
| 22 | + runner: namespace-profile-gitar |
| 23 | + - target: aarch64-unknown-linux-gnu |
| 24 | + runner: namespace-profile-gitar |
| 25 | + runs-on: ${{ matrix.runner }} |
| 26 | + steps: |
| 27 | + - uses: namespacelabs/nscloud-checkout-action@v8 |
| 28 | + - uses: dtolnay/rust-toolchain@stable |
| 29 | + with: |
| 30 | + targets: ${{ matrix.target }} |
| 31 | + - uses: goto-bus-stop/setup-zig@v2 |
| 32 | + if: matrix.target != 'aarch64-apple-darwin' |
| 33 | + with: |
| 34 | + version: 0.13.0 |
| 35 | + - run: cargo install cargo-zigbuild --locked |
| 36 | + if: matrix.target != 'aarch64-apple-darwin' |
| 37 | + - uses: Swatinem/rust-cache@v2 |
| 38 | + with: |
| 39 | + key: rustls-engines-${{ matrix.target }} |
| 40 | + - name: Verify PostgreSQL engine dependencies |
| 41 | + run: | |
| 42 | + cargo tree --locked --target ${{ matrix.target }} -e normal,build --prefix none \ |
| 43 | + -p query-engine -p migration-engine-cli -p introspection-core -p prisma-fmt \ |
| 44 | + --no-default-features --features "$ENGINE_FEATURES" > engine-dependencies.txt |
| 45 | + if grep -E '^(native-tls|tokio-native-tls|openssl|openssl-sys|hyper-tls|postgres-native-tls) v' engine-dependencies.txt; then |
| 46 | + exit 1 |
| 47 | + fi |
| 48 | + - name: Build macOS engines |
| 49 | + if: matrix.target == 'aarch64-apple-darwin' |
| 50 | + run: | |
| 51 | + cargo build --locked --release --target ${{ matrix.target }} \ |
| 52 | + -p query-engine -p migration-engine-cli -p introspection-core -p prisma-fmt \ |
| 53 | + --no-default-features --features "$ENGINE_FEATURES" |
| 54 | + for engine in query-engine migration-engine introspection-engine prisma-fmt; do |
| 55 | + target/${{ matrix.target }}/release/$engine --version |
| 56 | + otool -L target/${{ matrix.target }}/release/$engine |
| 57 | + done |
| 58 | + - name: Build portable Linux engines |
| 59 | + if: matrix.target != 'aarch64-apple-darwin' |
| 60 | + run: | |
| 61 | + cargo zigbuild --locked --release --target ${{ matrix.target }}.2.28 \ |
| 62 | + -p query-engine -p migration-engine-cli -p introspection-core -p prisma-fmt \ |
| 63 | + --no-default-features --features "$ENGINE_FEATURES" |
| 64 | + for engine in query-engine migration-engine introspection-engine prisma-fmt; do |
| 65 | + readelf -d target/${{ matrix.target }}/release/$engine > /tmp/linkage.txt |
| 66 | + cat /tmp/linkage.txt |
| 67 | + if grep -E 'NEEDED.*lib(ssl|crypto)' /tmp/linkage.txt; then exit 1; fi |
| 68 | + done |
| 69 | + - name: Test PostgreSQL TLS and engine protocols |
| 70 | + if: matrix.target == 'x86_64-unknown-linux-gnu' |
| 71 | + run: python3 tests/rustls/smoke.py target/${{ matrix.target }}/release |
| 72 | + - name: Package immutable engine assets |
| 73 | + env: |
| 74 | + TARGET: ${{ matrix.target }} |
| 75 | + run: | |
| 76 | + python3 tests/rustls/package.py "$TARGET" |
| 77 | + - uses: actions/upload-artifact@v4 |
| 78 | + with: |
| 79 | + name: engines-${{ matrix.target }}-${{ github.sha }} |
| 80 | + path: artifacts/* |
| 81 | + retention-days: 30 |
0 commit comments