@@ -2,6 +2,8 @@ name: Compatibility binaries
22on :
33 push :
44 branches : [gitar-0.6.11, gitar-rustls-engines]
5+ pull_request :
6+ branches : [gitar-0.6.11, gitar-rustls-engines]
57 workflow_dispatch :
68permissions :
79 contents : read
@@ -15,12 +17,15 @@ jobs:
1517 - target : aarch64-apple-darwin
1618 runner : namespace-profile-gitar-macos
1719 features : postgresql,mocking
20+ platform : darwin
1821 - target : x86_64-unknown-linux-gnu
1922 runner : namespace-profile-gitar
2023 features : postgresql,mocking
24+ platform : linux/amd64
2125 - target : aarch64-unknown-linux-gnu
2226 runner : namespace-profile-gitar
2327 features : postgresql,mocking
28+ platform : linux/arm64
2429 runs-on : ${{ matrix.runner }}
2530 steps :
2631 - uses : namespacelabs/nscloud-checkout-action@v8
@@ -60,27 +65,62 @@ jobs:
6065 zip "prisma-cli-$TARGET.zip" "prisma-cli-$TARGET" source-sha.txt
6166 - name : Test archive verification
6267 if : matrix.target == 'aarch64-apple-darwin'
63- run : cargo test --locked -p prisma-client-rust-cli --no-default-features --features postgresql,mocking --lib binaries::tests
64- - name : Test x86 binary on Debian 12 with an empty engine cache
65- if : matrix.target == 'x86_64-unknown-linux-gnu'
68+ run : cargo test --locked -p prisma-client-rust-cli --no-default-features --features postgresql,mocking --lib binaries
69+ - name : Check runner formatting and lints
70+ if : matrix.target == 'aarch64-apple-darwin'
71+ run : |
72+ cargo fmt --check -p prisma-client-rust-cli
73+ cargo clippy --locked -p prisma-client-rust-cli -p prisma-cli \
74+ --no-default-features --features postgresql,mocking --all-targets
75+ - name : Download the previous generator baseline
76+ env :
77+ TARGET : ${{ matrix.target }}
78+ run : |
79+ python3 tests/compatibility/baseline.py "$TARGET"
80+ - name : Test macOS runner with an empty cache
81+ if : matrix.target == 'aarch64-apple-darwin'
6682 run : |
67- cp artifacts/prisma-cli-x86_64-unknown-linux-gnu tests/compatibility/prisma
68- docker run --rm -v "$PWD/tests/compatibility:/work" debian:bookworm-slim sh -ec '
69- apt-get update -qq
70- apt-get install -y -qq ca-certificates rustfmt
71- # Fail if the wrapper regresses to invoking OpenSSL for engine selection.
72- printf "#!/bin/sh\nexit 99\n" > /work/openssl
73- chmod +x /work/openssl
74- export PATH=/work:$PATH
75- export DATABASE_URL=postgresql://postgres@localhost:5432/postgres
76- prisma generate --schema /work/schema.prisma
77- test -s /work/prisma.rs
78- prisma --version
79- if prisma generate --schema /work/does-not-exist.prisma; then
80- echo "Invalid Prisma commands must fail"
81- exit 1
82- fi
83- '
83+ python3 tests/compatibility/runner.py target/${{ matrix.target }}/release/prisma \
84+ --baseline baseline/prisma --work-dir runner-results
85+ - uses : docker/setup-qemu-action@v3
86+ if : matrix.target == 'aarch64-unknown-linux-gnu'
87+ with :
88+ platforms : arm64
89+ - name : Test Linux runner with disposable PostgreSQL
90+ if : matrix.target != 'aarch64-apple-darwin'
91+ env :
92+ TARGET : ${{ matrix.target }}
93+ PLATFORM : ${{ matrix.platform }}
94+ run : |
95+ docker network create runner-test
96+ trap 'docker rm -f runner-db; docker network rm runner-test' EXIT
97+ docker run -d --name runner-db --network runner-test --network-alias fixture-db \
98+ -e POSTGRES_PASSWORD=fixture -e POSTGRES_DB=runner_fixture postgres:17
99+ for attempt in $(seq 1 30); do
100+ if docker exec runner-db pg_isready -U postgres; then break; fi
101+ sleep 1
102+ done
103+ docker run --rm --platform "$PLATFORM" --network runner-test \
104+ -v "$PWD:/work" -e TARGET="$TARGET" -w /work debian:bookworm-slim sh -ec '
105+ apt-get update -qq
106+ apt-get install -y -qq ca-certificates openssl rustfmt python3
107+ python3 tests/compatibility/runner.py "target/$TARGET/release/prisma" \
108+ --baseline baseline/prisma --work-dir runner-results \
109+ --database-url postgresql://postgres:fixture@fixture-db:5432/runner_fixture
110+ '
111+ - uses : actions/upload-artifact@v4
112+ if : always()
113+ with :
114+ name : runner-results-${{ matrix.target }}
115+ path : |
116+ runner-results/results.json
117+ runner-results/*.stdout
118+ runner-results/*.stderr
119+ runner-results/schema-*/*.stdout
120+ runner-results/schema-*/*.stderr
121+ runner-results/database/*.stdout
122+ runner-results/database/*.stderr
123+ retention-days : 7
84124 - uses : actions/upload-artifact@v4
85125 with :
86126 name : prisma-cli-${{ matrix.target }}-${{ github.sha }}
@@ -142,3 +182,17 @@ jobs:
142182 if grep -E '^(native-tls|openssl|openssl-sys|postgres-native-tls) v' /tmp/quaint-dependencies.txt; then
143183 exit 1
144184 fi
185+ ci-success :
186+ if : always()
187+ needs : [build, driver-tests, quaint-tests]
188+ runs-on : ubuntu-latest
189+ steps :
190+ - name : Require every compatibility job
191+ env :
192+ JOB_RESULTS : ${{ toJson(needs) }}
193+ run : |
194+ python3 - <<'PYTHON'
195+ import json, os
196+ results = json.loads(os.environ["JOB_RESULTS"])
197+ assert all(job["result"] == "success" for job in results.values()), results
198+ PYTHON
0 commit comments