Skip to content

Commit

Permalink
test: wire CLI tests up in Taskfile
Browse files Browse the repository at this point in the history
Signed-off-by: Will Murphy <will.murphy@anchore.com>
  • Loading branch information
willmurphyscode committed May 9, 2024
1 parent b58ada0 commit 70d3341
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ vars:

TMP_DIR: .tmp
SNAPSHOT_DIR: snapshot
# .ROOT_DIR is built-in variable, see https://taskfile.dev/api/#special-variables
SNAPSHOT_BIN: "{{ .ROOT_DIR }}/{{ .SNAPSHOT_DIR }}/{{ OS }}-build_{{ OS }}_{{ ARCH }}/{{ .PROJECT }}"
CHANGELOG: CHANGELOG.md
NEXT_VERSION: VERSION
MAKEDIR_P: 'python -c "import sys; import os; os.makedirs(sys.argv[1], exist_ok=True)"'
Expand Down Expand Up @@ -37,6 +39,7 @@ tasks:
desc: Run all levels of test
cmds:
- task: unit
- task: cli

## Bootstrap tasks #################################

Expand Down Expand Up @@ -134,6 +137,19 @@ tasks:
- cmd: '{{if eq OS "windows"}}python {{end}}.github/scripts/coverage.py {{ .COVERAGE_THRESHOLD }} {{ .TMP_DIR }}/unit-coverage-details.txt'
silent: true

cli:
desc: Run CLI tests
deps: [snapshot]
vars:
TEST_PKGS: "go list ./test/cli/..."
sources:
- "{{ .SNAPSHOT_BIN }}"
- ./test/cli/**
- ./**/*.go
cmds:
- cmd: "echo 'testing {{ .SNAPSHOT_BIN }}'"
- cmd: "go test ./test/cli/..."

## Build-related targets #################################

changelog:
Expand All @@ -151,6 +167,10 @@ tasks:
aliases:
- build
deps: [tools]
sources:
- "{{ .SNAPSHOT_BIN }}"
- ./test/cli/**
- ./**/*.go
cmds:
- silent: true
cmd: |
Expand Down Expand Up @@ -197,3 +217,5 @@ tasks:
- cmd: "cat CHANGELOG.md"
silent: true
- "{{ .TOOL_DIR }}/goreleaser release --clean --release-notes CHANGELOG.md"

# yaml-language-server: $schema=https://taskfile.dev/schema.json

0 comments on commit 70d3341

Please sign in to comment.