ci: verify that static executable is static

This commit is contained in:
Robert Vollmert
2022-07-12 23:25:06 +02:00
committed by Robert
parent 8230128ff6
commit 9252ec2509
2 changed files with 24 additions and 0 deletions
+3
View File
@@ -113,9 +113,12 @@ jobs:
uses: ./.github/actions/setup-nix
with:
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
tools: tests
- name: Build static executable
run: nix-build -A postgrestStatic
- name: Check static executable
run: postgrest-check-static result/bin/postgrest
- name: Save built executable as artifact
uses: actions/upload-artifact@v3
with:
+21
View File
@@ -207,6 +207,26 @@ let
sed -i 's|^module \(.*\):|module \1/|g' test/coverage.overlay
'';
checkStatic =
checkedShellScript
{
name = "postgrest-check-static";
docs = "Verify that the argument is a static executable.";
args = [ "ARG_POSITIONAL_SINGLE([executable], [Executable])" ];
inRootDir = true;
withEnv = postgrest.env;
}
''
exe="$_arg_executable"
ldd_output=$(ldd "$exe" 2>&1 || true)
if ! grep -q "not a dynamic executable" <<< "$ldd_output"; then
echo "not a static executable, ldd output:"
echo "$ldd_output"
exit 1
fi
"$exe" --help
'';
in
buildToolbox
{
@@ -221,5 +241,6 @@ buildToolbox
dumpSchema
coverage
coverageDraftOverlay
checkStatic
];
}