summary history files

Taskfile.yml
---
version: '3'
silent: true

env:
  FLASK_SKIP_DOTENV: 1
  FLASK_APP: penny
  CONFIG_FILE: ./conf.py
  FLASK_DEBUG: 1
dotenv: ['{{.HOME}}/.penny.env', '.env']
vars:
  CONTAINER_TAG:
    sh: git log -n1 --format=%h
  CONTAINER_REGISTRY: ghcr.io
  CONTAINER_IMAGE_NAME: rene00/penny

tasks:
  desktop:tests:
    dir: desktop/
    cmds:
      - go test ./...

  desktop:bin-data:
    desc: "go-bindata"
    dir: desktop/db/migrations
    cmds:
      - go-bindata -o bindata.go -pkg migrations -ignore bindata.go .

  desktop:sqlboiler:
    desc: "sqlboiler"
    dir: desktop
    deps: [desktop:bin-data]
    cmds:
      - migrate -source file://db/migrations -database sqlite3://.pennyapp.db up
      - sqlboiler --no-tests --no-hooks --no-auto-timestamps --wipe sqlite3

  desktop:db:migrate:create:
    desc: "db migrate create"
    dir: desktop
    cmds:
      - migrate create -dir=./db/migrations -seq -digits 6 -ext sql {{.CLI_ARGS}}

  desktop:db:migrate:up:
    desc: "db migrate up 1"
    dir: desktop
    cmds:
      - migrate -source file://db/migrations -database sqlite3://.pennyapp.db up 1

  desktop:db:migrate:down:
    desc: "db migrate down 1"
    dir: desktop
    cmds:
      - migrate -source file://db/migrations -database sqlite3://.pennyapp.db down 1

  desktop:wails:build:
    desc: "wails build"
    dir: desktop
    cmds:
      - wails build -v 2 -debug

  desktop:wails:dev:nodebug:
    desc: "wails dev"
    dir: desktop
    env:
      PENNY_DEBUG: false
    cmds:
      - wails dev -appargs "--debug=false"

  desktop:wails:dev:
    desc: "wails dev"
    dir: desktop
    env:
      PENNY_DEBUG: true
    cmds:
      - wails dev -appargs "--debug=true"

  desktop:dt:build:
    desc: "dt build"
    dir: desktop
    cmds:
      - go build -o ./dt ./backend/cmd/dt

  web:build:python3.9:
    desc: "check if python 3.9 is installed"
    dir: web
    vars:
      PYTHON_MAJOR_MINOR_VERSION:
        sh: python -c 'import sys;print(f"{sys.version_info.major}{sys.version_info.minor}")'
    preconditions:
      - sh: '[ {{.PYTHON_MAJOR_MINOR_VERSION}} == "39" ]'
        msg: "python 3.9 must be installed"
  web:build:
    deps: [web:build:python3.9]
    dir: web
    cmds:
      - poetry install --no-dev
  web:db:migrate:
    desc: "run flask db migrate"
    dir: web
    cmds:
      - poetry run flask db migrate
  web:db:upgrade:
    env:
      FLASK_APP: penny
      PENNY_SKIP_IMPORT_ALL_TYPES: 1
    dir: web
    cmds:
      - poetry run flask db upgrade
  web:build:dev:
    deps: [web:build:python3.9]
    dir: web
    cmds:
      - poetry install
  web:run:queue:
    desc: "run the penny worker app locally"
    dir: web
    cmds:
      - poetry run rqworker --url redis://localhost:6379/0 --verbose --path=.
  web:run:www:
    desc: "run the penny web app locally"
    dir: web
    vars:
      FLASK_HOST: 127.0.0.1
      FLASK_PORT: 5000
    cmds:
      - mkdir -p files/transactions files/uploads
      - poetry run flask run --host={{ .FLASK_HOST }} --port={{ .FLASK_PORT }}
  web:container:build:
    desc: "build web container"
    dir: web
    cmds:
      - podman build . -t {{.CONTAINER_REGISTRY}}/{{.CONTAINER_IMAGE_NAME}}:{{.CONTAINER_TAG}} {{.PODMAN_BUILD_ARGS}}
  web:container:run:
    desc: "run web container"
    vars:
      HOST_PORT: 5000
    dir: web
    cmds:
      - |
        podman run -it --restart always \
          --publish {{ .HOST_PORT }}:5000 \
          -e CONFIG_FILE=/app/penny/conf.py \
          --mount type=bind,src=penny,target=/penny \
          --name penny {{.CONTAINER_REGISTRY}}/{{.CONTAINER_IMAGE_NAME}}:{{.CONTAINER_TAG}}
  web:test:
    desc: "run web tests"
    deps: [web:build:dev]
    dir: web
    cmds:
      - poetry run pytest .
  web:seed:account:
    desc: "seed the db with a test user account and resources"
    dir: web
    cmds:
      - poetry run flask seed account
  web:seed:types:
    desc: "seed the db with types"
    dir: web
    cmds:
      - poetry run flask seed types
  web:task:tag_match:
    desc: "run web task tag_match"
    dir: web
    cmds:
      - poetry run flask task tag_match
  web:task:fetch_tx_meta:
    desc: "run web task fetch_tx_meta"
    dir: web
    cmds:
      - poetry run flask task fetch-tx-meta {{.CLI_ARGS}}
  web:task:txmeta:transaction:
    desc: "run web task txmeta transaction"
    dir: web
    cmds:
      - poetry run flask txmeta transaction {{.CLI_ARGS}}
  web:task:transaction:get:
    desc: "run web task get transaction"
    dir: web
    cmds:
      - poetry run flask transaction get {{.CLI_ARGS}}
  web:report:account_monthly_breakdown:
    desc: "run web report account_monthly_breakdown"
    dir: web
    cmds:
      - poetry run flask report account_monthly_breakdown $USER_ID $ACCOUNT_ID
  web:report:tag_monthly_breakdown:
    desc: "run web report tag_monthly_breakdown"
    dir: web
    cmds:
      - poetry run flask report tag_monthly_breakdown $USER_ID $TAG_ID