Skip to content

Commit

Permalink
Fix CI (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
garbas authored Oct 30, 2024
1 parent 6aa3506 commit 4cf7735
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 11 deletions.
12 changes: 5 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,22 +33,20 @@ jobs:
envs_test="["
envs_push="["
update_all=
update_all=${{ github.event_name == 'schedule' && 'true' || '' }}
if git diff --name-only HEAD~1 HEAD -- | grep -E "flake.nix|flake.lock|.github" ; then
echo detected major change
echo "detected major change"
update_all=true
fi
while IFS= read manifest_path; do
env_path=$(realpath -s $(dirname $manifest_path)/../..)
rel_env_path="${env_path#$PWD/}"
if [ -f "$env_path/test.sh" ]; then
echo "env_path=$env_path"
echo "rel_env_path=$rel_env_path"
if [ -f "$env_path/test.sh" ] && [ "$update_all" == "true" ] || ( git diff --name-only HEAD~1 HEAD | grep -q "$rel_env_path/" ; ); then
name=$(basename $env_path)
if [ "$update_all" != "true" ] && ( git diff --name-only HEAD~1 HEAD | grep -qv "$rel_env_path/" ; ) ; then
continue
fi
num_of_services=$(yq -oy '.services | length' $manifest_path)
start_services="true"
if [ "$num_of_services" -eq 0 ]; then
Expand Down
31 changes: 27 additions & 4 deletions dotenv/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,32 @@ set -eo pipefail

MULTILINE_TEST=$(echo -e "ONE\nTWO\nTHREE")

if [ "$PING" != "PONG" ]; then exit 1; fi
if [ "$MULTILINE" != "$(echo -e 'ONE\nTWO\nTHREE')" ]; then exit 1; fi
if [ "$SECRET_KEY" != "YOURSECRETKEYGOESHERE" ]; then exit 1; fi
if [ "$SECRET_HASH" != "something-with-a-#-hash" ]; then exit 1; fi
if [ "$PING" != "PONG" ]; then
echo "Error: ping poing failed"
echo " Left -> $PING"
echo " Right -> PONG"
exit 1
fi

if [ "$MULTILINE" != "$(echo -e 'ONE\nTWO\nTHREE')" ]; then
echo "Error: multiline failed"
echo " Left -> $MULTILINE"
echo " Right -> $(echo -e 'ONE\nTWO\nTHREE')"
exit 1
fi

if [ "$SECRET_KEY" != "YOURSECRETKEYGOESHERE" ]; then
echo "Error: secret key failed"
echo " Left -> $SECRET_KEY"
echo " Right -> YOURSECRETKEY"
exit 1
fi

if [ "$SECRET_HASH" != "something-with-a-#-hash" ]; then
echo "Error: secret hash failed"
echo " Left -> $SECRET_HASH"
echo " Right -> something-with-a-#-hash"
exit 1
fi

echo ">>> All tests pass"
3 changes: 3 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@
export TESTDIR="$(mktemp -d --suffix floxenvs-${name}-example)"
cp -R ${path}/* $TESTDIR
cp -R ${path}/.flox* $TESTDIR
if [ -f ${path}/.env ]; then
cp -R ${path}/.env $TESTDIR
fi
chown -R $(whoami) $TESTDIR/.flox*
chmod -R +w $TESTDIR/.flox*
Expand Down
1 change: 1 addition & 0 deletions python-poetry/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ echo ">>> pyjokes python package installed"

pyjokes
echo ">>> pyjokes binary works"

0 comments on commit 4cf7735

Please sign in to comment.