Skip to content

Commit

Permalink
Housekeeping: Build: Fix tests to add test-run on each push via scrip…
Browse files Browse the repository at this point in the history
…ting-setup

Merge branch 'feature/gh-testing'
  • Loading branch information
inkarkat committed Dec 18, 2024
2 parents cdfac27 + 8fad3be commit 66d354d
Show file tree
Hide file tree
Showing 9 changed files with 88 additions and 57 deletions.
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
18 changes: 18 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Build scripts
on:
push:
branches:
- '**'
tags-ignore:
- '**'
pull_request:
# Allows you to run this workflow manually from the Actions tab.
workflow_dispatch:

jobs:
build:
uses: inkarkat/scripting-setup/.github/workflows/build.yml@master
with:
packages: ''
testrunner-settings: DEPENDENCY_DIR=dependencies/todo.txt-cli
secrets: inherit
8 changes: 5 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@ TESTS = $(wildcard tests/t[0-9][0-9][0-9][0-9]-*.sh)

# Use the main todo.sh executable and the test library and utilities from a
# ../todo.txt-cli working copy next to this.
DEPENDENCY_DIR ?= ../todo.txt-cli

test-copy-deps: todo.sh tests/test-lib.sh tests/aggregate-results.sh

todo.sh: ../todo.txt-cli/todo.sh
todo.sh: $(DEPENDENCY_DIR)/todo.sh
cp $< .

tests/test-lib.sh: ../todo.txt-cli/tests/test-lib.sh
tests/test-lib.sh: $(DEPENDENCY_DIR)/tests/test-lib.sh
cp $< tests/

tests/aggregate-results.sh: ../todo.txt-cli/tests/aggregate-results.sh
tests/aggregate-results.sh: $(DEPENDENCY_DIR)/tests/aggregate-results.sh
cp $< tests/

test-pre-clean:
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

_A set of extensions for todo.txt-cli, a shell script for managing your todo.txt file._

![Build Status](https://github.com/inkarkat/todo.txt-cli-ex/actions/workflows/build.yml/badge.svg)

The [Command Line Interface](https://github.com/todotxt/todo.txt-cli) of
the [Todo.txt](http://todotxt.org/) task tracking system allows extension via
**add-ons** (which supply customized or additional actions) and **filters** (which
Expand Down
6 changes: 3 additions & 3 deletions actions/add
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#
# REMARKS:
#
# COPYRIGHT: (C) 2010-2023 Ingo Karkat
# COPYRIGHT: (C) 2010-2024 Ingo Karkat
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License.
# See http://www.gnu.org/copyleft/gpl.txt
Expand Down Expand Up @@ -44,8 +44,8 @@ TOTAL=$(sed -n '$ =' "$TODO_FILE") || exit $?
task="$("${scriptDir}/renderrelativemarkers" --task "$((TOTAL+1))" "$task")" || exit $?

# Translate @here to the actual lowercased hostname.
hostname="$TODOTXT_HOSTNAME"
[ -n "$hostname" ] || hostname="$(readableHostname)"
hostname="${TODOTXT_HOSTNAME:-$(type -t readableHostname >/dev/null && readableHostname)}"
hostname="${hostname:-$HOSTNAME}"
if [ -n "$hostname" ]; then
literalHostname="${hostname,,}"
literalHostname="${literalHostname//\\/\\\\}"
Expand Down
5 changes: 4 additions & 1 deletion filter/relativeDates
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,17 @@
#
# REMARKS:
#
# COPYRIGHT: (C) 2010-2016 Ingo Karkat
# COPYRIGHT: (C) 2010-2024 Ingo Karkat
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License.
# See http://www.gnu.org/copyleft/gpl.txt
#
# @(#)relativeDates $Id$ todo.txt-cli-ex
###############################################################################

if [ $TODOTXT_PLAIN = 1 ]; then
export COLOR_TRASH=$NONE
fi
if [ ${TODOTXT_RELDATE:-1} -ne 0 ]; then
awk -v date=$1 -v dayRange=${TODOTXT_RELDATE_DAYRANGE:-14} '
function highlight(colorVar, color) {
Expand Down
86 changes: 43 additions & 43 deletions tests/t2200-scheduledFilter.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,19 @@ X 2009-02-12 2009-02-01 prioritized A but already trashed A:2009-02-09
EOF

test_todo_session 'synthesized prioritization' <<EOF
>>> todo.sh list prioritized
[1;33m[7m12[1;33m (A) (12 days ago) first not yet prioritized A task A:(in 9 days) A:(4 days ago)[0m
[1;33m[7m13[1;33m (A) (12 days ago) last not yet prioritized A task A:(4 days ago) A:(in 9 days)[0m
[1;33m[7m05[1;33m (A) (12 days ago) prioritized A A:(4 days ago)[0m
[0;32m[7m07[0;32m (B) (12 days ago) prioritized B out of three A:(in 9 days) B:(4 days ago) C:(5 days ago)[0m
[1;34m[7m09[1;34m (C) (12 days ago) override priority B with lower prioritized C C:(4 days ago)[0m
[1;34m[7m10[1;34m (C) (12 days ago) override priority D with higher prioritized C C:(4 days ago)[0m
[1;34m[7m08[1;34m (C) (12 days ago) prioritized C because it is last A:(in 9 days) B:(4 days ago) D:(4 days ago) C:(4 days ago) E:(in 9 days)[0m
[1;37m[7m06[1;37m (X) (12 days ago) prioritized X X:(4 days ago)[0m
[7m11[0m (12 days ago) invalid prioritized I task I:2009-02-0911
[0m[47m[7m04[0m[47m (12 days ago) not yet prioritized A A:(in 9 days)[0m
[0;37m02 x (yesterday, after 11 days) prioritized A but already done A:(4 days ago)[0m
[1;30m03 X (yesterday, after 11 days) prioritized A but already trashed A:(4 days ago)[0m
>>> todo.sh -p list prioritized
12 (A) (12 days ago) first not yet prioritized A task A:(in 9 days) A:(4 days ago)
13 (A) (12 days ago) last not yet prioritized A task A:(4 days ago) A:(in 9 days)
05 (A) (12 days ago) prioritized A A:(4 days ago)
07 (B) (12 days ago) prioritized B out of three A:(in 9 days) B:(4 days ago) C:(5 days ago)
09 (C) (12 days ago) override priority B with lower prioritized C C:(4 days ago)
10 (C) (12 days ago) override priority D with higher prioritized C C:(4 days ago)
08 (C) (12 days ago) prioritized C because it is last A:(in 9 days) B:(4 days ago) D:(4 days ago) C:(4 days ago) E:(in 9 days)
06 (X) (12 days ago) prioritized X X:(4 days ago)
11 (12 days ago) invalid prioritized I task I:2009-02-0911
04 (12 days ago) not yet prioritized A A:(in 9 days)
02 x (yesterday, after 11 days) prioritized A but already done A:(4 days ago)
03 X (yesterday, after 11 days) prioritized A but already trashed A:(4 days ago)
--
TODO: 12 of 13 tasks shown
EOF
Expand All @@ -58,18 +58,18 @@ X (A) 2009-02-12 2009-02-01 depri of prioritized A but already trashed d:2009-02
EOF

test_todo_session 'synthesized deprioritization' <<EOF
>>> todo.sh list depri
[1;33m[7m12[1;33m (A) (12 days ago) last not yet depri of prioritized A task d:(4 days ago) d:(in 9 days)[0m
[1;33m[7m06[1;33m (A) (12 days ago) not yet depri of prioritized A task d:(in 9 days)[0m
[1;34m[7m09[1;34m (C) (12 days ago) not yet depri of synthetically prioritized C task C:(11 days ago) d:(in 9 days)[0m
[1;37m[7m10[1;37m (I) (12 days ago) invalid depri of prioritized I task d:2009-02-0911[0m
[7m05[0m (12 days ago) depri of prioritized A task d:(4 days ago)
[0m[47m[7m07[0m[47m (12 days ago) depri of prioritized Z task d:(4 days ago)[0m
[7m08[0m (12 days ago) depri of synthetically prioritized C task C:(11 days ago) d:(4 days ago)
[0m[47m[7m04[0m[47m (12 days ago) depri of unprioritized task d:(4 days ago)[0m
[7m11[0m (12 days ago) first not yet depri of prioritized A task d:(in 9 days) d:(4 days ago)
[0;37m02 x (A) yesterday (12 days ago) depri of prioritized A but already done d:(4 days ago)[0m
[1;30m03 X (A) yesterday (12 days ago) depri of prioritized A but already trashed d:(4 days ago)[0m
>>> todo.sh -p list depri
12 (A) (12 days ago) last not yet depri of prioritized A task d:(4 days ago) d:(in 9 days)
06 (A) (12 days ago) not yet depri of prioritized A task d:(in 9 days)
09 (C) (12 days ago) not yet depri of synthetically prioritized C task C:(11 days ago) d:(in 9 days)
10 (I) (12 days ago) invalid depri of prioritized I task d:2009-02-0911
05 (12 days ago) depri of prioritized A task d:(4 days ago)
07 (12 days ago) depri of prioritized Z task d:(4 days ago)
08 (12 days ago) depri of synthetically prioritized C task C:(11 days ago) d:(4 days ago)
04 (12 days ago) depri of unprioritized task d:(4 days ago)
11 (12 days ago) first not yet depri of prioritized A task d:(in 9 days) d:(4 days ago)
02 x (A) yesterday (12 days ago) depri of prioritized A but already done d:(4 days ago)
03 X (A) yesterday (12 days ago) depri of prioritized A but already trashed d:(4 days ago)
--
TODO: 11 of 12 tasks shown
EOF
Expand All @@ -87,14 +87,14 @@ X 2009-02-12 2009-02-01 trashed and already trashed x:2009-02-09
EOF

test_todo_session 'synthesized trashing' <<EOF
>>> todo.sh list trashed
[7m6[0m (12 days ago) invalid trashed x:2009-02-0911
[0m[47m[7m8[0m[47m (12 days ago) last not yet trashed x:(4 days ago) x:(in 9 days)[0m
[7m4[0m (12 days ago) not yet trashed x:(in 9 days)
[1;30m7 X (4 days ago, after 8 days) first not yet trashed x:(in 9 days) x:(4 days ago)[0m
[1;30m5 X (4 days ago, after 8 days) trashed x:(4 days ago)[0m
[1;30m3 X (yesterday, after 11 days) trashed and already trashed x:(4 days ago)[0m
[0;37m2 x (yesterday, after 11 days) trashed but already done x:(4 days ago)[0m
>>> todo.sh -p list trashed
6 (12 days ago) invalid trashed x:2009-02-0911
8 (12 days ago) last not yet trashed x:(4 days ago) x:(in 9 days)
4 (12 days ago) not yet trashed x:(in 9 days)
7 X (4 days ago, after 8 days) first not yet trashed x:(in 9 days) x:(4 days ago)
5 X (4 days ago, after 8 days) trashed x:(4 days ago)
3 X (yesterday, after 11 days) trashed and already trashed x:(4 days ago)
2 x (yesterday, after 11 days) trashed but already done x:(4 days ago)
--
TODO: 7 of 8 tasks shown
EOF
Expand All @@ -114,16 +114,16 @@ X 2009-02-12 2009-02-01 do-until-then-trash and already trashed z:2009-02-09
EOF

test_todo_session 'synthesized do-until-then-trash' <<EOF
>>> todo.sh list do-until-then-trash
[0m[48;5;202m[7m06[0m[48;5;202m (12 days ago) do-until-then-trash on the until day z:today[0m
[7m08[0m (12 days ago) invalid do-until-then-trash z:2009-02-0911
[0m[47m[7m10[0m[47m (12 days ago) last not yet do-until-then-trash z:(4 days ago) z:(in 9 days)[0m
[7m04[0m (12 days ago) not yet do-until-then-trash z:(in 9 days)
[1;30m05 X (4 days ago, after 8 days) do-until-then-trash z:(4 days ago)[0m
[1;30m09 X (4 days ago, after 8 days) first not yet do-until-then-trash z:(in 9 days) z:(4 days ago)[0m
[1;30m03 X (yesterday, after 11 days) do-until-then-trash and already trashed z:(4 days ago)[0m
[0;37m02 x (yesterday, after 11 days) do-until-then-trash but already done z:(4 days ago)[0m
[1;30m07 X (yesterday, after 11 days) do-until-then-trash one after the until day z:yesterday[0m
>>> todo.sh -p list do-until-then-trash
06 (12 days ago) do-until-then-trash on the until day z:today
08 (12 days ago) invalid do-until-then-trash z:2009-02-0911
10 (12 days ago) last not yet do-until-then-trash z:(4 days ago) z:(in 9 days)
04 (12 days ago) not yet do-until-then-trash z:(in 9 days)
05 X (4 days ago, after 8 days) do-until-then-trash z:(4 days ago)
09 X (4 days ago, after 8 days) first not yet do-until-then-trash z:(in 9 days) z:(4 days ago)
03 X (yesterday, after 11 days) do-until-then-trash and already trashed z:(4 days ago)
02 x (yesterday, after 11 days) do-until-then-trash but already done z:(4 days ago)
07 X (yesterday, after 11 days) do-until-then-trash one after the until day z:yesterday
--
TODO: 9 of 10 tasks shown
EOF
Expand Down
10 changes: 5 additions & 5 deletions tests/t2210-rendermarkers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ EOF
test_todo_session 'rendering synthesized prioritization' <<EOF
>>> TODOTXT_VERBOSE=0 todo.sh rendermarkers 2009-02-13
>>> todo.sh list prioritized
>>> TERM_COLORS=16 todo.sh list prioritized
12 (A) (12 days ago) first not yet prioritized A task A:(in 9 days)
13 (A) (12 days ago) last not yet prioritized A task A:(in 9 days)
05 (A) (12 days ago) prioritized A
Expand Down Expand Up @@ -62,7 +62,7 @@ EOF
test_todo_session 'rendering synthesized deprioritization' <<EOF
>>> TODOTXT_VERBOSE=0 todo.sh rendermarkers 2009-02-13
>>> todo.sh list depri
>>> TERM_COLORS=16 todo.sh list depri
12 (A) (12 days ago) last not yet depri of prioritized A task d:(4 days ago) d:(in 9 days)
06 (A) (12 days ago) not yet depri of prioritized A task d:(in 9 days)
09 (C) (12 days ago) not yet depri of synthetically prioritized C task d:(in 9 days)
Expand Down Expand Up @@ -93,7 +93,7 @@ EOF
test_todo_session 'rendering synthesized trashing' <<EOF
>>> TODOTXT_VERBOSE=0 todo.sh rendermarkers 2009-02-13
>>> todo.sh list trashed
>>> TERM_COLORS=16 todo.sh list trashed
6 (12 days ago) invalid trashed x:2009-02-0911
8 (12 days ago) last not yet trashed x:(4 days ago) x:(in 9 days)
4 (12 days ago) not yet trashed x:(in 9 days)
Expand Down Expand Up @@ -122,8 +122,8 @@ EOF
test_todo_session 'rendering synthesized do-until-then-trash' <<EOF
>>> TODOTXT_VERBOSE=0 todo.sh rendermarkers 2009-02-13
>>> todo.sh list do-until-then-trash
[0m[48;5;202m[7m06[0m[48;5;202m (12 days ago) do-until-then-trash on the until day z:today[0m
>>> TERM_COLORS=16 todo.sh list do-until-then-trash
[0m[37;41m[7m06[0m[37;41m (12 days ago) do-until-then-trash on the until day z:today[0m
08 (12 days ago) invalid do-until-then-trash z:2009-02-0911
10 (12 days ago) last not yet do-until-then-trash z:(4 days ago) z:(in 9 days)
04 (12 days ago) not yet do-until-then-trash z:(in 9 days)
Expand Down
4 changes: 2 additions & 2 deletions todo.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ export COLOR_TRASH=$DARK_GREY
export COLOR_DATE_EXT=

# === BEHAVIOR ===
[ "$HIDE_COLOR_DONE" ] && unset COLOR_DONE
[ "$HIDE_COLOR_TRASH" ] && unset COLOR_TRASH
[ "$HIDE_COLOR_DONE" ] && COLOR_DONE="$NONE"
[ "$HIDE_COLOR_TRASH" ] && COLOR_TRASH="$NONE"

## customize list output
#
Expand Down

0 comments on commit 66d354d

Please sign in to comment.