floxify #181
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
name: Trivial Test | |
on: | |
workflow_dispatch: | |
pull_request: | |
types: [opened, synchronize, reopened] | |
paths: | |
- '**' | |
- '!**/README*' | |
push: | |
branches: [main] | |
paths: | |
- '**' | |
- '!**/README*' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
tests-flox: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install flox | |
uses: flox/[email protected] | |
with: | |
flox-installable-uri: "github:flox/floxpkgs#flox-prerelease.fromCatalog" | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Make Injector | |
shell: bash | |
run: | | |
set -eu; | |
set -o pipefail; | |
mkdir ./bin; | |
echo '#! /usr/bin/env bash | |
cat "$PWD/flox.nix" > "$1";' > ./bin/flox-inject; | |
chmod +x ./bin/flox-inject; | |
- name: KRB5 pkg-config Test | |
shell: bash | |
env: | |
REPO: ${{ github.repository }} | |
run: | | |
set -eu; | |
set -o pipefail; | |
if [[ "$GITHUB_REF" == "refs/heads/main" ]]; then | |
selfURI="github:$REPO"; | |
else | |
selfURI="github:$REPO/$GITHUB_REF"; | |
fi | |
echo "selfURI: $selfURI" >&2; | |
echo "Creating krb5-dev" >&2; | |
flox create -e krb5-dev; | |
echo "Creating flox.nix" >&2; | |
cat <<EOF > ./flox.nix | |
{ | |
packages.nixpkgs-flox.nodejs = {}; | |
packages.nixpkgs-flox.krb5 = { | |
meta.outputsToInstall = ["out" "dev"]; | |
}; | |
packages."$selfURI".etc-profiles = {}; | |
shell.hook = '' | |
[[ -r "\$FLOX_ENV/etc/profile" ]] && . "\$FLOX_ENV/etc/profile"; | |
''; | |
} | |
EOF | |
echo "flox.nix contents:" >&2; | |
echo "---" >&2; | |
cat ./flox.nix >&2; | |
echo "---" >&2; | |
echo "Inject flox.nix" >&2; | |
EDITOR="$PWD/bin/flox-inject" flox edit -e krb5-dev; | |
rm -f ./flox.nix; | |
echo "Installing deps" >&2; | |
flox install -e krb5-dev pkg-config; | |
runEnv() { flox activate -e krb5-dev -- "$@"; } | |
echo "Activating env" >&2; | |
runEnv true; | |
echo "Checking if pkg-config can find KRB5" >&2; | |
if runEnv pkg-config --list-all|grep -i 'krb5'; | |
then | |
echo "PASS" >&2; | |
exit 0; | |
else | |
echo "FAIL" >&2; | |
echo "pkg-config --list results:" >&2; | |
echo "---" >&2; | |
runEnv pkg-config --list-all >&2; | |
echo "---" >&2; | |
exit 1; | |
fi | |
- name: Node.js KRB5 Test | |
shell: bash | |
run: | | |
runEnv() { flox activate -e krb5-dev -- "$@"; } | |
mkdir ./node-krb5; | |
cd ./node-krb5; | |
# Install `krb5' module with `npm'. | |
runEnv npm i krb5; | |
if [[ -x "$PWD/node_modules/krb5/build/Release/krb5.node" ]]; then | |
echo "PASS: npm" >&2; | |
exit 0; | |
else | |
echo "FAIL: npm" >&2; | |
exit 1; | |
fi |