Skip to content

Commit

Permalink
test: Test against KRB5 instead of SQLite3 (#13)
Browse files Browse the repository at this point in the history
GitHub Actions runners come pre-loaded with sqlite3.pc so the old test will trigger false positives.
This change uses krb5 instead which actually ensures that etc-profiles successfully provides it.
  • Loading branch information
aakropotkin authored Jul 5, 2023
1 parent c25be86 commit fe737f4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 22 deletions.
12 changes: 4 additions & 8 deletions .github/workflows/compare-nix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,11 @@ on:
paths:
- '**'
- '!**/README*'
- '!.github/workflows/*'
- '.github/workflows/compare-nix.yml'
push:
branches: [main]
paths:
- '**'
- '!**/README*'
- '!.github/workflows/*'
- '.github/workflows/compare-nix.yml'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down Expand Up @@ -50,7 +46,7 @@ jobs:
set -o pipefail;
nix registry pin nixpkgs github:NixOS/nixpkgs/23.05;
- name: SQLite3 pkg-config Test
- name: KRB5 pkg-config Test
shell: bash
env:
REPO: ${{ github.repository }}
Expand All @@ -66,7 +62,7 @@ jobs:
echo "selfURI: $selfURI" >&2;
echo "Installing deps" >&2;
nix profile install 'nixpkgs#sqlite^bin,out,dev' -L;
nix profile install 'nixpkgs#krb5^out,dev' -L;
nix profile install 'nixpkgs#pkg-config' -L;
nix profile install "$selfURI#etc-profiles" -L;
Expand All @@ -75,8 +71,8 @@ jobs:
export LD_FLOXLIB_DEBUG=1;
. "$FLOX_ENV/etc/profile";
echo "Checking if pkg-config can find sqlite" >&2;
if pkg-config --list-all|grep '^sqlite3';
echo "Checking if pkg-config can find KRB5" >&2;
if pkg-config --list-all|grep -i 'krb5';
then
echo "PASS" >&2;
exit 0;
Expand Down
24 changes: 10 additions & 14 deletions .github/workflows/trivial-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,11 @@ on:
paths:
- '**'
- '!**/README*'
- '!.github/workflows/*'
- '.github/workflows/trivial-test.yml'
push:
branches: [main]
paths:
- '**'
- '!**/README*'
- '!.github/workflows/*'
- '.github/workflows/trivial-test.yml'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -39,7 +35,7 @@ jobs:
cat "$PWD/flox.nix" > "$1";' > ./bin/flox-inject;
chmod +x ./bin/flox-inject;
- name: SQLite3 pkg-config Test
- name: KRB5 pkg-config Test
shell: bash
env:
REPO: ${{ github.repository }}
Expand All @@ -54,14 +50,14 @@ jobs:
fi
echo "selfURI: $selfURI" >&2;
echo "Creating sqlite-dev" >&2;
flox create -e sqlite-dev;
echo "Creating krb5-dev" >&2;
flox create -e krb5-dev;
echo "Creating flox.nix" >&2;
cat <<EOF > ./flox.nix
{
packages.nixpkgs-flox.sqlite = {
meta.outputsToInstall = ["bin" "out" "dev"];
packages.nixpkgs-flox.krb5 = {
meta.outputsToInstall = ["out" "dev"];
};
packages."$selfURI".etc-profiles = {};
shell.hook = ''
Expand All @@ -76,18 +72,18 @@ jobs:
echo "---" >&2;
echo "Inject flox.nix" >&2;
EDITOR="$PWD/bin/flox-inject" flox edit -e sqlite-dev;
EDITOR="$PWD/bin/flox-inject" flox edit -e krb5-dev;
rm -f ./flox.nix;
echo "Installing deps" >&2;
flox install -e sqlite-dev pkg-config;
flox install -e krb5-dev pkg-config;
runEnv() { flox activate -e sqlite-dev -- "$@"; }
runEnv() { flox activate -e krb5-dev -- "$@"; }
echo "Activating env" >&2;
runEnv true;
echo "Checking if pkg-config can find sqlite" >&2;
if runEnv pkg-config --list-all|grep '^sqlite3';
echo "Checking if pkg-config can find KRB5" >&2;
if runEnv pkg-config --list-all|grep -i 'krb5';
then
echo "PASS" >&2;
exit 0;
Expand Down

0 comments on commit fe737f4

Please sign in to comment.