Skip to content

Commit 52a7d8c

Browse files
committed
optimize taskfile tasks, remove unused code
1 parent a4953a3 commit 52a7d8c

File tree

2 files changed

+29
-77
lines changed

2 files changed

+29
-77
lines changed

Taskfile.dist.yaml

Lines changed: 14 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,9 @@ dotenv: ['.env', '.env.local']
55

66
vars:
77
APP_VERSION_FILE: './lib/version/app-version.go'
8-
ENTRY_FILENAME: './app/main.go'
98
BUILD_OUTPUT_DIR: './dist'
10-
BINARY_FILENAME: 'stackup'
11-
DIST_TARGET_FILE: '{{.BUILD_OUTPUT_DIR}}/{{.BINARY_FILENAME}}'
12-
DOTENV_FILES:
13-
sh: find . -name ".env*" -print | sort -u | egrep -v '^./dist.*$' | tr '\n' ' '
9+
DIST_TARGET_FILE: '{{.BUILD_OUTPUT_DIR}}/stackup'
10+
ENTRY_FILENAME: './app/main.go'
1411

1512
tasks:
1613

@@ -29,7 +26,7 @@ tasks:
2926
- task: update-version-file
3027
cmds:
3128
- task: build-stackup
32-
- task: copy-config-template-to-dist
29+
- task: copy-config-files-to-dist
3330

3431
clean:
3532
desc: Cleans up build artifacts
@@ -40,42 +37,18 @@ tasks:
4037
- rm -f {{.DIST_TARGET_FILE}}
4138

4239
lint:
43-
cmds:
44-
- task: lint-dotenv
45-
- task: lint-stackup
46-
- task: lint-spell
47-
48-
update-version-file:
49-
cmds:
50-
- go run tools/generate-version-file.go
51-
52-
lint-dotenv:
53-
desc: Lints all dotenv files
5440
preconditions:
41+
- which golangci-lint
5542
- which dotenv-linter
56-
cmds:
57-
- dotenv-linter {{.DOTENV_FILES}}
58-
59-
lint-spell:
60-
desc: Check for typos in filenames and source code
61-
ignore_error: true
62-
preconditions:
6343
- which typos
64-
vars:
65-
SRC_DIRS:
66-
sh: "/bin/ls -1F | grep '/' | egrep -v '(\\..+|build|dist|assets|tools)' | tr -s '\\n/' ' '"
6744
cmds:
68-
- typos ./lib ./templates ./README.md
45+
- golangci-lint run
46+
- dotenv-linter --not-check-updates --recursive
47+
- typos
6948

70-
lint-stackup:
71-
desc: Runs golangci-lint
72-
vars:
73-
SRC_DIRS:
74-
sh: find . -name "*.go" -printf '%h\n' | awk -F/ '{ print "./" $2 }' | sort -u | grep -v './tools' | tr '\n' ' '
75-
preconditions:
76-
- which golangci-lint
49+
update-version-file:
7750
cmds:
78-
- golangci-lint run {{.SRC_DIRS}}
51+
- go run tools/generate-version-file.go
7952

8053
prepare-dist-folder:
8154
desc: Prepares dist folder
@@ -92,46 +65,26 @@ tasks:
9265
- task: prepare-dist-folder
9366
sources:
9467
- '{{.ENTRY_FILENAME}}'
68+
- ./lib/**/*.go
69+
- ./lib/*.go
9570
generates:
9671
- '{{.DIST_TARGET_FILE}}'
9772
cmds:
9873
- go build -trimpath -ldflags="-s -w -X main.Version={{.VERSION}}-{{.GIT_COMMIT}}" -o {{.DIST_TARGET_FILE}} {{.ENTRY_FILENAME}}
9974

100-
copy-config-template-to-dist:
75+
copy-config-files-to-dist:
10176
desc: Copies config template to dist folder
10277
deps:
10378
- task: prepare-dist-folder
10479
cmds:
10580
- cp -f ./templates/*.yaml {{.BUILD_OUTPUT_DIR}}
106-
107-
bump-minor-version-and-tag:
108-
run: once
109-
desc: Bumps minor version and creates a new git tag
110-
preconditions:
111-
- which svu
112-
cmds:
113-
- echo "bumping version to $(svu minor)"
114-
- git tag $(svu minor)
115-
116-
release-new-minor-version:
117-
desc: Create a new minor version release on github
118-
cmds:
119-
- task: bump-minor-version-and-tag
120-
- task: update-version-file
121-
- git push --tags
81+
- cp -f ./.env {{.BUILD_OUTPUT_DIR}}
12282

12383
update-checksums:
12484
dir: templates/remote-includes
12585
cmds:
12686
- sha256sum *.yaml > checksums.sha256.txt
127-
- task: commit-updated-checksums
128-
129-
commit-updated-checksums:
130-
desc: Commits updated checksum files
131-
internal: true
132-
silent: true
133-
cmds:
134-
- git add templates/remote-includes/checksums.*.txt
87+
- git add checksums.sha256.txt
13588
- git commit -m "update checksum files"
13689

13790
autobuild:

lib/app/WorkflowInclude.go

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,21 @@ import (
1212
)
1313

1414
type WorkflowInclude struct {
15-
Url string `yaml:"url"`
16-
Headers []string `yaml:"headers"`
17-
File string `yaml:"file"`
18-
ChecksumUrl string `yaml:"checksum-url"`
19-
VerifyChecksum bool `yaml:"verify,omitempty"`
20-
AccessKey string `yaml:"access-key"`
21-
SecretKey string `yaml:"secret-key"`
22-
Secure bool `yaml:"secure"`
23-
identifierString string
24-
ValidationState ChecksumVerificationState
25-
Contents string
26-
Hash string
27-
FoundChecksum string
28-
HashAlgorithm checksums.ChecksumAlgorithm
29-
FromCache bool
30-
Workflow *StackupWorkflow
15+
Url string `yaml:"url"`
16+
Headers []string `yaml:"headers"`
17+
File string `yaml:"file"`
18+
ChecksumUrl string `yaml:"checksum-url"`
19+
VerifyChecksum bool `yaml:"verify,omitempty"`
20+
AccessKey string `yaml:"access-key"`
21+
SecretKey string `yaml:"secret-key"`
22+
Secure bool `yaml:"secure"`
23+
ValidationState ChecksumVerificationState
24+
Contents string
25+
Hash string
26+
FoundChecksum string
27+
HashAlgorithm checksums.ChecksumAlgorithm
28+
FromCache bool
29+
Workflow *StackupWorkflow
3130
}
3231

3332
func expandUrlPrefixes(url string) string {

0 commit comments

Comments
 (0)