From 90100f43818daf3af2e6057aba5610cfaaa3da98 Mon Sep 17 00:00:00 2001 From: Dhruv Thakur <13575379+dhth@users.noreply.github.com> Date: Tue, 13 Aug 2024 09:09:16 +0200 Subject: [PATCH 01/10] ci: add more assertions --- .github/workflows/back-compat-pr.yml | 1 + .github/workflows/back-compat.yml | 1 + .github/workflows/build.yml | 1 + assets/sample-tasks.txt | 12 ++++++++++++ cmd/assets/guide/actions-markdown-in-context.md | 2 -- cmd/assets/guide/visuals-list-density.md | 5 ++--- 6 files changed, 17 insertions(+), 5 deletions(-) create mode 100644 assets/sample-tasks.txt diff --git a/.github/workflows/back-compat-pr.yml b/.github/workflows/back-compat-pr.yml index ef301b8..1eccbab 100644 --- a/.github/workflows/back-compat-pr.yml +++ b/.github/workflows/back-compat-pr.yml @@ -44,3 +44,4 @@ jobs: run: | /var/tmp/omm_head --db-path=/var/tmp/throwaway.db 'test: a task from PR HEAD' /var/tmp/omm_head --db-path=/var/tmp/throwaway.db tasks + [ "$(/var/tmp/omm_head tasks | wc -l)" -eq 2 ] diff --git a/.github/workflows/back-compat.yml b/.github/workflows/back-compat.yml index a0c677b..6a727b4 100644 --- a/.github/workflows/back-compat.yml +++ b/.github/workflows/back-compat.yml @@ -42,3 +42,4 @@ jobs: run: | /var/tmp/omm_head --db-path=/var/tmp/throwaway.db 'test: a task from main HEAD' /var/tmp/omm_head --db-path=/var/tmp/throwaway.db tasks + [ "$(/var/tmp/omm_head tasks | wc -l)" -eq 2 ] diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index db57f29..9b1ddb2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -35,5 +35,6 @@ jobs: - name: run omm run: | go build . + cat assets/sample-tasks.txt | ./omm import ./omm 'test: a task' ./omm tasks diff --git a/assets/sample-tasks.txt b/assets/sample-tasks.txt new file mode 100644 index 0000000..f923d1a --- /dev/null +++ b/assets/sample-tasks.txt @@ -0,0 +1,12 @@ +traps: Set up an ACME trap for the Road Runner +tech: Order new ACME rocket skates +traps: Draw fake tunnel on the canyon wall +tech: Check ACME catalog for new gadgets +tech: Test the giant slingshot +tech: Assemble ACME jet-propelled pogo stick +plan: Plan the next trap location +orders: Buy more bird seed for the bait +tech: Install spring-loaded boxing glove +design: Design a new blueprint for capturing the Road Runner +order: Order a lifetime supply of ACME bird seed to lure Road Runner +traps: Paint a fake bridge over a dry riverbed diff --git a/cmd/assets/guide/actions-markdown-in-context.md b/cmd/assets/guide/actions-markdown-in-context.md index 4c0b1df..d2456cd 100644 --- a/cmd/assets/guide/actions-markdown-in-context.md +++ b/cmd/assets/guide/actions-markdown-in-context.md @@ -37,8 +37,6 @@ This is a URL: [omm](https://github.com/dhth/omm) --- > This is a block quote -> that spans -> multiple lines --- diff --git a/cmd/assets/guide/visuals-list-density.md b/cmd/assets/guide/visuals-list-density.md index 6170a81..2d29ba7 100644 --- a/cmd/assets/guide/visuals-list-density.md +++ b/cmd/assets/guide/visuals-list-density.md @@ -2,10 +2,9 @@ omm's task lists can be viewed in two density modes: **compact** and **spacious**. This is the compact mode. As opposed to this, the spacious mode shows tasks in a -more roomier list, alongside highlighting prefixes (we'll see what that means), -and showing creation timestamps. +more roomier list, alongside showing creation timestamps. -omm starts up with spacious mode by default (you can change this, as we'll see +omm starts up with compact mode by default (you can change this, as we'll see soon). You can toggle between the two modes by pressing `v`. Choose whichever mode fits your workflow better. From 8b8f049993849e7763dc7adae7f5fb73b9d0877b Mon Sep 17 00:00:00 2001 From: Dhruv Thakur <13575379+dhth@users.noreply.github.com> Date: Tue, 13 Aug 2024 09:16:10 +0200 Subject: [PATCH 02/10] ci: fix check command --- .github/workflows/back-compat-pr.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/back-compat-pr.yml b/.github/workflows/back-compat-pr.yml index 1eccbab..ef68597 100644 --- a/.github/workflows/back-compat-pr.yml +++ b/.github/workflows/back-compat-pr.yml @@ -44,4 +44,6 @@ jobs: run: | /var/tmp/omm_head --db-path=/var/tmp/throwaway.db 'test: a task from PR HEAD' /var/tmp/omm_head --db-path=/var/tmp/throwaway.db tasks - [ "$(/var/tmp/omm_head tasks | wc -l)" -eq 2 ] + if [ "$(/var/tmp/omm_head tasks | wc -l)" -ne 2 ]; then + false + fi From 93e0ad29766470947347369f1a705363aa743416 Mon Sep 17 00:00:00 2001 From: Dhruv Thakur <13575379+dhth@users.noreply.github.com> Date: Tue, 13 Aug 2024 19:55:20 +0200 Subject: [PATCH 03/10] ci: put num tasks check in shell script --- .github/scripts/checknumtasks.sh | 12 ++++++++++++ .github/workflows/back-compat-pr.yml | 4 +--- 2 files changed, 13 insertions(+), 3 deletions(-) create mode 100755 .github/scripts/checknumtasks.sh diff --git a/.github/scripts/checknumtasks.sh b/.github/scripts/checknumtasks.sh new file mode 100755 index 0000000..8820651 --- /dev/null +++ b/.github/scripts/checknumtasks.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +if [ "$#" -ne 1 ]; then + echo "Usage: ./checknumtasks.sh " + exit 1 +fi + +num_tasks=$(/var/tmp/omm_head tasks | wc -l | xargs) +if [ "$num_tasks" -ne "$1" ]; then + echo "Number of tasks: $num_tasks; expected: $1" + exit 1 +fi diff --git a/.github/workflows/back-compat-pr.yml b/.github/workflows/back-compat-pr.yml index ef68597..1871f34 100644 --- a/.github/workflows/back-compat-pr.yml +++ b/.github/workflows/back-compat-pr.yml @@ -44,6 +44,4 @@ jobs: run: | /var/tmp/omm_head --db-path=/var/tmp/throwaway.db 'test: a task from PR HEAD' /var/tmp/omm_head --db-path=/var/tmp/throwaway.db tasks - if [ "$(/var/tmp/omm_head tasks | wc -l)" -ne 2 ]; then - false - fi + ./.github/scripts/checknumtasks.sh 2 From 91b5896a4fadb8453a0549abadeabd80109b9c84 Mon Sep 17 00:00:00 2001 From: Dhruv Thakur <13575379+dhth@users.noreply.github.com> Date: Tue, 13 Aug 2024 20:03:21 +0200 Subject: [PATCH 04/10] fix: use working-directory --- .github/workflows/back-compat-pr.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/back-compat-pr.yml b/.github/workflows/back-compat-pr.yml index 1871f34..daf8902 100644 --- a/.github/workflows/back-compat-pr.yml +++ b/.github/workflows/back-compat-pr.yml @@ -44,4 +44,8 @@ jobs: run: | /var/tmp/omm_head --db-path=/var/tmp/throwaway.db 'test: a task from PR HEAD' /var/tmp/omm_head --db-path=/var/tmp/throwaway.db tasks - ./.github/scripts/checknumtasks.sh 2 + ls -a + - name: Validate number of tasks + working-directory: .github/scripts + run: | + ./checknumtasks.sh 2 From 8e6220d506766041f5c6e70d3a89aeab9392ee53 Mon Sep 17 00:00:00 2001 From: Dhruv Thakur <13575379+dhth@users.noreply.github.com> Date: Tue, 13 Aug 2024 20:14:19 +0200 Subject: [PATCH 05/10] fix: add debug command --- .github/workflows/back-compat-pr.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/back-compat-pr.yml b/.github/workflows/back-compat-pr.yml index daf8902..486b263 100644 --- a/.github/workflows/back-compat-pr.yml +++ b/.github/workflows/back-compat-pr.yml @@ -44,8 +44,9 @@ jobs: run: | /var/tmp/omm_head --db-path=/var/tmp/throwaway.db 'test: a task from PR HEAD' /var/tmp/omm_head --db-path=/var/tmp/throwaway.db tasks - ls -a + pwd + ls -a .github - name: Validate number of tasks - working-directory: .github/scripts + working-directory: ./.github/scripts run: | ./checknumtasks.sh 2 From bdf8b8d10d7a5c9a716948e62e04de9aea82582f Mon Sep 17 00:00:00 2001 From: Dhruv Thakur <13575379+dhth@users.noreply.github.com> Date: Tue, 13 Aug 2024 20:19:48 +0200 Subject: [PATCH 06/10] fix: move scripts to project root --- .github/scripts/checknumtasks.sh | 12 ------------ .github/workflows/back-compat-pr.yml | 7 +------ scripts/checknumtasks.sh | 11 +++++++++++ 3 files changed, 12 insertions(+), 18 deletions(-) delete mode 100755 .github/scripts/checknumtasks.sh create mode 100755 scripts/checknumtasks.sh diff --git a/.github/scripts/checknumtasks.sh b/.github/scripts/checknumtasks.sh deleted file mode 100755 index 8820651..0000000 --- a/.github/scripts/checknumtasks.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash - -if [ "$#" -ne 1 ]; then - echo "Usage: ./checknumtasks.sh " - exit 1 -fi - -num_tasks=$(/var/tmp/omm_head tasks | wc -l | xargs) -if [ "$num_tasks" -ne "$1" ]; then - echo "Number of tasks: $num_tasks; expected: $1" - exit 1 -fi diff --git a/.github/workflows/back-compat-pr.yml b/.github/workflows/back-compat-pr.yml index 486b263..6d2502f 100644 --- a/.github/workflows/back-compat-pr.yml +++ b/.github/workflows/back-compat-pr.yml @@ -44,9 +44,4 @@ jobs: run: | /var/tmp/omm_head --db-path=/var/tmp/throwaway.db 'test: a task from PR HEAD' /var/tmp/omm_head --db-path=/var/tmp/throwaway.db tasks - pwd - ls -a .github - - name: Validate number of tasks - working-directory: ./.github/scripts - run: | - ./checknumtasks.sh 2 + ./scripts/checknumtasks.sh 2 "$(/var/tmp/omm_head tasks | wc -l | xargs)" diff --git a/scripts/checknumtasks.sh b/scripts/checknumtasks.sh new file mode 100755 index 0000000..d0d896f --- /dev/null +++ b/scripts/checknumtasks.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +if [ "$#" -ne 2 ]; then + echo "Usage: ./checknumtasks.sh " + exit 1 +fi + +if [ "$1" -ne "$2" ]; then + echo "Number of tasks: $1; expected: $2" + exit 1 +fi From 69fe05bb2428b09f48f2efc5e2d56bab65d008c4 Mon Sep 17 00:00:00 2001 From: Dhruv Thakur <13575379+dhth@users.noreply.github.com> Date: Tue, 13 Aug 2024 22:02:17 +0200 Subject: [PATCH 07/10] fix: check out head second How stupid am I? --- {scripts => .github/scripts}/checknumtasks.sh | 0 .github/workflows/back-compat-pr.yml | 18 ++++++++++-------- 2 files changed, 10 insertions(+), 8 deletions(-) rename {scripts => .github/scripts}/checknumtasks.sh (100%) diff --git a/scripts/checknumtasks.sh b/.github/scripts/checknumtasks.sh similarity index 100% rename from scripts/checknumtasks.sh rename to .github/scripts/checknumtasks.sh diff --git a/.github/workflows/back-compat-pr.yml b/.github/workflows/back-compat-pr.yml index 6d2502f..6a252fc 100644 --- a/.github/workflows/back-compat-pr.yml +++ b/.github/workflows/back-compat-pr.yml @@ -22,21 +22,23 @@ jobs: runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 + with: + ref: main - name: Set up Go uses: actions/setup-go@v5 with: go-version: ${{ env.GO_VERSION }} - - name: build head - run: | - go build -o omm_head - cp omm_head /var/tmp - - uses: actions/checkout@v4 - with: - ref: main - name: build main run: | go build -o omm_main cp omm_main /var/tmp + rm omm_main + - uses: actions/checkout@v4 + - name: build head + run: | + go build -o omm_head + cp omm_head /var/tmp + rm omm_head - name: Run last version run: | /var/tmp/omm_main --db-path=/var/tmp/throwaway.db 'test: a task from main' @@ -44,4 +46,4 @@ jobs: run: | /var/tmp/omm_head --db-path=/var/tmp/throwaway.db 'test: a task from PR HEAD' /var/tmp/omm_head --db-path=/var/tmp/throwaway.db tasks - ./scripts/checknumtasks.sh 2 "$(/var/tmp/omm_head tasks | wc -l | xargs)" + ./.github/scripts/checknumtasks.sh 2 "$(/var/tmp/omm_head tasks | wc -l | xargs)" From c00b20709a7c7553170fc15a725a2787615b3003 Mon Sep 17 00:00:00 2001 From: Dhruv Thakur <13575379+dhth@users.noreply.github.com> Date: Tue, 13 Aug 2024 22:09:56 +0200 Subject: [PATCH 08/10] fix: use correct db path --- .github/workflows/back-compat-pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/back-compat-pr.yml b/.github/workflows/back-compat-pr.yml index 6a252fc..e375749 100644 --- a/.github/workflows/back-compat-pr.yml +++ b/.github/workflows/back-compat-pr.yml @@ -46,4 +46,4 @@ jobs: run: | /var/tmp/omm_head --db-path=/var/tmp/throwaway.db 'test: a task from PR HEAD' /var/tmp/omm_head --db-path=/var/tmp/throwaway.db tasks - ./.github/scripts/checknumtasks.sh 2 "$(/var/tmp/omm_head tasks | wc -l | xargs)" + ./.github/scripts/checknumtasks.sh 2 "$(/var/tmp/omm_head --db-path=/var/tmp/throwaway.db tasks | wc -l | xargs)" From 0f3d3a88cb118e75ca79beec35aa03759648f979 Mon Sep 17 00:00:00 2001 From: Dhruv Thakur <13575379+dhth@users.noreply.github.com> Date: Tue, 13 Aug 2024 23:29:01 +0200 Subject: [PATCH 09/10] ci: adapt back-compact --- .github/scripts/checknumtasks.sh | 2 ++ .github/workflows/back-compat.yml | 14 ++++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/scripts/checknumtasks.sh b/.github/scripts/checknumtasks.sh index d0d896f..19b1711 100755 --- a/.github/scripts/checknumtasks.sh +++ b/.github/scripts/checknumtasks.sh @@ -9,3 +9,5 @@ if [ "$1" -ne "$2" ]; then echo "Number of tasks: $1; expected: $2" exit 1 fi + +echo "Actual and expected number of tasks match" diff --git a/.github/workflows/back-compat.yml b/.github/workflows/back-compat.yml index 6a727b4..1dec22c 100644 --- a/.github/workflows/back-compat.yml +++ b/.github/workflows/back-compat.yml @@ -21,20 +21,22 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 2 + - run: git checkout HEAD~1 - name: Set up Go uses: actions/setup-go@v5 with: go-version: ${{ env.GO_VERSION }} + - name: build last commit + run: | + go build -o omm_prev + cp omm_prev /var/tmp + rm omm_prev + - run: git checkout main - name: build head run: | go build -o omm_head cp omm_head /var/tmp rm omm_head - - run: git checkout HEAD~1 - - name: build main - run: | - go build -o omm_prev - cp omm_prev /var/tmp - name: Run last version run: | /var/tmp/omm_prev --db-path=/var/tmp/throwaway.db 'test: a task from previous commit' @@ -42,4 +44,4 @@ jobs: run: | /var/tmp/omm_head --db-path=/var/tmp/throwaway.db 'test: a task from main HEAD' /var/tmp/omm_head --db-path=/var/tmp/throwaway.db tasks - [ "$(/var/tmp/omm_head tasks | wc -l)" -eq 2 ] + ./.github/scripts/checknumtasks.sh 2 "$(/var/tmp/omm_head --db-path=/var/tmp/throwaway.db tasks | wc -l | xargs)" From 9aedcfc6d94f06dce59f870abb7b04a4fa569ee7 Mon Sep 17 00:00:00 2001 From: Dhruv Thakur <13575379+dhth@users.noreply.github.com> Date: Tue, 13 Aug 2024 23:33:36 +0200 Subject: [PATCH 10/10] ci: fix argument ordering --- .github/workflows/back-compat-pr.yml | 2 +- .github/workflows/back-compat.yml | 2 +- .github/workflows/build.yml | 1 + assets/sample-tasks.txt | 2 -- 4 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/back-compat-pr.yml b/.github/workflows/back-compat-pr.yml index e375749..1653df3 100644 --- a/.github/workflows/back-compat-pr.yml +++ b/.github/workflows/back-compat-pr.yml @@ -46,4 +46,4 @@ jobs: run: | /var/tmp/omm_head --db-path=/var/tmp/throwaway.db 'test: a task from PR HEAD' /var/tmp/omm_head --db-path=/var/tmp/throwaway.db tasks - ./.github/scripts/checknumtasks.sh 2 "$(/var/tmp/omm_head --db-path=/var/tmp/throwaway.db tasks | wc -l | xargs)" + ./.github/scripts/checknumtasks.sh "$(/var/tmp/omm_head --db-path=/var/tmp/throwaway.db tasks | wc -l | xargs)" 2 diff --git a/.github/workflows/back-compat.yml b/.github/workflows/back-compat.yml index 1dec22c..fa0c22f 100644 --- a/.github/workflows/back-compat.yml +++ b/.github/workflows/back-compat.yml @@ -44,4 +44,4 @@ jobs: run: | /var/tmp/omm_head --db-path=/var/tmp/throwaway.db 'test: a task from main HEAD' /var/tmp/omm_head --db-path=/var/tmp/throwaway.db tasks - ./.github/scripts/checknumtasks.sh 2 "$(/var/tmp/omm_head --db-path=/var/tmp/throwaway.db tasks | wc -l | xargs)" + ./.github/scripts/checknumtasks.sh "$(/var/tmp/omm_head --db-path=/var/tmp/throwaway.db tasks | wc -l | xargs)" 2 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9b1ddb2..934cbdf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -38,3 +38,4 @@ jobs: cat assets/sample-tasks.txt | ./omm import ./omm 'test: a task' ./omm tasks + ./.github/scripts/checknumtasks.sh "$(./omm tasks | wc -l | xargs)" 11 diff --git a/assets/sample-tasks.txt b/assets/sample-tasks.txt index f923d1a..d277953 100644 --- a/assets/sample-tasks.txt +++ b/assets/sample-tasks.txt @@ -1,4 +1,3 @@ -traps: Set up an ACME trap for the Road Runner tech: Order new ACME rocket skates traps: Draw fake tunnel on the canyon wall tech: Check ACME catalog for new gadgets @@ -7,6 +6,5 @@ tech: Assemble ACME jet-propelled pogo stick plan: Plan the next trap location orders: Buy more bird seed for the bait tech: Install spring-loaded boxing glove -design: Design a new blueprint for capturing the Road Runner order: Order a lifetime supply of ACME bird seed to lure Road Runner traps: Paint a fake bridge over a dry riverbed